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

export default {
    components: { Moveable },
    setup() {
        const onDrag = e => {
            e.target.style.transform = e.transform;
        };
        const onResize = e => {
            e.target.style.width = `${e.width}px`;
            e.target.style.height = `${e.height}px`;
            e.target.style.transform = e.drag.transform;
        };
        const onClip = e => {
            e.target.style.clipPath = e.clipStyle;
        };
        return { onDrag, onResize, onClip };
    }
};
</script>
<template>
    <div class="root">
        <div class="container">
            <div
                class="target"
                style="position: relative;top: 50px;left: 50px;width: 200px;height: 200px;"
            >Target</div>
            <Moveable
                target=".target"
                :draggable="true"
                :resizable="({ keepRatio: true })"
                :clippable="({ keepRatio: false })"
                @drag="onDrag"
                @resize="onResize"
                @clip="onClip"/>
        </div>
    </div>
</template>