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

export default {
    components: { Moveable },
    data() {
        const threshold = "$preview_threshold";
        const checkScrollEvent = "$preview_checkScrollEvent";
        const throttleTime = "$preview_throttleTime";
        return { threshold, checkScrollEvent, throttleTime };
    },
    methods: {
        onRender(e) {
            e.target.style.cssText += e.cssText;
        },
        onScroll({ scrollContainer, direction }) {
            scrollContainer.scrollBy(direction[0] * 10, direction[1] * 10);
        }
    }
};
</script>
<template>
    <div class="container">
        <div class="scrollArea">
            <div class="target">Target</div>
            <Moveable
                :scrollable="true"
                :scrollOptions="({ container: '.scrollArea', threshold: threshold, checkScrollEvent: checkScrollEvent, throttleTime: throttleTime })"
                :target="'.target'"
                :draggable="true"
                :resizable="true"
                :rotatable="true"
                @render="onRender"
                @scroll="onScroll"
            ></Moveable>
        </div>
    </div>
</template>