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

export default {
    components: { Moveable },
    data() {
        const keepRatio = "$preview_keepRatio";
        const throttleScale = "$preview_throttleScale";
        const renderDirections = "$preview_renderDirections";
        const targetRef = null;
        return { keepRatio, throttleScale, renderDirections, targetRef };
    },
    methods: { onScale(e) {
        e.target.style.transform = e.drag.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"
                :scalable="true"
                :keepRatio="keepRatio"
                :throttleScale="throttleScale"
                :renderDirections="renderDirections"
                @scale="onScale"/>
        </div>
    </div>
</template>