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

export default {
    components: { Moveable },
    data() {
        const hideChildMoveableDefaultLines = "$preview_hideChildMoveableDefaultLines";
        const draggable = "$preview_draggable";
        const throttleDrag = "$preview_throttleDrag";
        const edgeDraggable = "$preview_edgeDraggable";
        const startDragRotate = "$preview_startDragRotate";
        const throttleDragRotate = "$preview_throttleDragRotate";
        const keepRatio = "$preview_keepRatio";
        const throttleScale = "$preview_throttleScale";
        const renderDirections = "$preview_renderDirections";
        const rotatable = "$preview_rotatable";
        const throttleRotate = "$preview_throttleRotate";
        const rotationPosition = "$preview_rotationPosition";
        return {
            hideChildMoveableDefaultLines,
            draggable,
            throttleDrag,
            edgeDraggable,
            startDragRotate,
            throttleDragRotate,
            keepRatio,
            throttleScale,
            renderDirections,
            rotatable,
            throttleRotate,
            rotationPosition
        };
    },
    methods: {
        onRenderGroup(e) {
            e.events.forEach(ev => {
                ev.target.style.transform = ev.transform;
            });
        }
    }
};
</script>
<template>
    <div class="root">
        <div class="container">
            <div
                class="target target1"
                style="transform: translate(0px, 0px) rotate(0deg) scale(1, 1);"
            >Target1</div>
            <div
                class="target target2"
                style="transform: translate(0px, 0px) rotate(0deg) scale(1, 1);"
            >Target2</div>
            <div
                class="target target3"
                style="transform: translate(0px, 0px) rotate(0deg) scale(1, 1);"
            >Target3</div>
            <Moveable
                :target="'.target'"
                :hideChildMoveableDefaultLines="hideChildMoveableDefaultLines"
                :draggable="draggable"
                :throttleDrag="throttleDrag"
                :edgeDraggable="edgeDraggable"
                :startDragRotate="startDragRotate"
                :throttleDragRotate="throttleDragRotate"
                :scalable="true"
                :keepRatio="keepRatio"
                :throttleScale="throttleScale"
                :renderDirections="renderDirections"
                :rotatable="rotatable"
                :throttleRotate="throttleRotate"
                :rotationPosition="rotationPosition"
                @renderGroup="onRenderGroup"/>
        </div>
    </div>
</template>