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

export default {
    components: { Moveable },
    data() {
        const moveableRef = null;
        return { moveableRef };
    },
    methods: {
        onScroll() {
            this.$refs.moveableRef?.updateRect();
        },
        onDrag(e) {
            e.target.style.transform = e.transform;
        }
    },
    mounted() {
        this.moveableRef = this.$refs.moveableRef;
    }
};
</script>
<template>
    <div class="root">
        <div
            class="container"
            style="height: 100px;"
        >
            <div
                class="target"
                style="overflow: auto;"
                @scroll="onScroll"
            >
                <div
                    class="scroll"
                    style="width: 100%;height: 1000px;"
                ></div>
            </div>
            <Moveable
                ref="moveableRef"
                :target="'.target'"
                :resizable="true"
                :preventClickDefault="true"
                :draggable="true"
                @drag="onDrag"/>
        </div>
    </div>
</template>