<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.width = `${e.width}px`;
            e.target.style.height = `${e.height}px`;
            e.target.style.transform = e.drag.transform;
        },
        onClip(e) {
            e.target.style.clipPath = e.clipStyle;
        }
    }
};
</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>