<script>
import Moveable from "vue3-moveable";
import { ref } from "vue";

export default {
    components: { Moveable },
    setup() {
        const targetRef = ref(null);
        const moveableRef = ref(null);
        const onClick = () => {
            console.log("Click");
        };
        const onMouseDown = () => {
            console.log("MouseDown");
        };
        const onDrag = e => {
            e.target.style.transform = e.transform;
        };
        return { onClick, onMouseDown, targetRef, moveableRef, onDrag };
    }
};
</script>
<template>
    <div class="root">
        <div
            class="container"
            style="height: 100px;"
            @click="onClick"
            @mouseDown="onMouseDown"
        >
            <div
                class="target"
                ref="targetRef"
            >Target</div>
            <Moveable
                ref="moveableRef"
                :target="targetRef"
                :resizable="true"
                :preventClickDefault="true"
                :draggable="true"
                @drag="onDrag"/>
        </div>
    </div>
</template>