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

export default {
    components: { Moveable },
    data() {
        const warpable = "$preview_warpable";
        const renderDirections = "$preview_renderDirections";
        const targetRef = null;
        return { warpable, renderDirections, targetRef };
    },
    methods: { onWarp(e) {
        e.target.style.transform = e.transform;
    } },
    mounted() {
        this.targetRef = this.$refs.targetRef;
    }
};
</script>
<template>
    <div class="root">
        <div class="container">
            <div
                class="target"
                ref="targetRef"
            >Target</div>
            <Moveable
                :target="targetRef"
                :warpable="warpable"
                :renderDirections="renderDirections"
                @warp="onWarp"/>
        </div>
    </div>
</template>