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

export default {
    components: { Moveable },
    setup() {
        const containerScale = "$preview_containerScale";
        const onRender = (e) => {
            e.target.style.cssText += e.cssText;
        };
        const onRender$0 = (e) => {
            e.target.style.cssText += e.cssText;
        };
        return { containerScale, onRender, onRender$0 };
    }
};
</script>
<template>
    <div class="root">
        <div
            class="container"
            :style="`transform-origin: 0 0;transform: ${`scale(${containerScale})`};`"
        >
            <svg
                viewBox="0 0 500 500"
                style="border: 1px solid black;width: 500px;height: 500px;"
            >
                <rect
                    id="rect-1"
                    x="100"
                    y="100"
                    width="50"
                    height="50"
                    style="fill: red;transform-box: fill-box;"
                    transform="rotate(45)"
                    {...{ "transform-origin": "50% 50%" }}/>
            </svg>
            <Moveable
                :target="'#rect-1'"
                :draggable="true"
                :rotatable="true"
                :scalable="true"
                svgOrigin="50% 50%"
                @render="onRender"/>
            <Moveable
                :target="'#rect-2'"
                :draggable="true"
                :rotatable="true"
                :scalable="true"
                svgOrigin="50% 50%"
                @render="onRender$0"/>
        </div>
    </div>
</template>