Draggable.create(".poly", {
bounds:"svg",
onDragEnd(e) {
//...
}
});
Draggable.create('.rect', {
type: 'x',
onDrag(e) {
//...
},
onDragEnd(e) {
//...
}
})
<svg width="1920px" height="1080px" class="assemble__svg">
<defs>
<pattern id="img1" patternUnits="userSpaceOnUse" width="2771" height="520">
<image preserveAspectRatio="none" xlink:href="../assets/linen.png" x="0" y="0" width="2771" height="520" />
</pattern>
</defs>
<polygon class="rect" ref="drag" id="rect" index="0" points="-2300 562, 471 562, 471 1002, -2300 1002" fill="url(#img1)"/>
<g class="poly-group" :class="{ active: stages.second }">
<polygon class="poly" :class="{ active: isValid(1) }" id="poly-1" index="1" points="200,10 250,190 160,210" style="fill:lime;stroke:purple;stroke-width:1" />
<polygon class="poly" :class="{ active: isValid(2) }" id="poly-2" index="2" points="320,110 400,310 270,350 223,334" style="fill:lime;stroke:purple;stroke-width:1" />
</g>
<image xlink:href="../assets/fake_wood.png" x="0" y="500" height="566" width="122" />
<image xlink:href="../assets/linen-box.png" x="50" y="515" height="533" width="256" />
</svg>
All my '.poly' elements cant move vertically, until i move it horizontally... What's wrong?