<script>
import Moveable from "vue-moveable";

export default {
    components: { Moveable },
    data() {
        return {};
    },
    methods: {
        onDrag(e) {
            e.target.style.transform = e.transform;
        },
        onResize(e) {
            e.target.style.cssText += `width: ${e.width}px; height: ${e.height}px`;
            e.target.style.transform = e.drag.transform;
        },
        onRotate(e) {
            e.target.style.transform = e.drag.transform;
        }
    }
};
</script>
<template>
    <div class="root">
        <div
            class="container"
            style="height: 400px;border: 10px solid black;transform: translate(40px, 40px);"
        >
            <div
                class="target"
                style="position: fixed;width: 200px;height: 100px;top: 50px;left: 50px;"
            >Fixed Target</div>
            <Moveable
                :target="'.target'"
                :resizable="true"
                :draggable="true"
                :rotatable="true"
                @drag="onDrag"
                @resize="onResize"
                @rotate="onRotate"/>
        </div>
    </div>
</template>