daybrush / moveable

Moveable! Draggable! Resizable! Scalable! Rotatable! Warpable! Pinchable! Groupable! Snappable!
https://daybrush.com/moveable/
MIT License
10.08k stars 618 forks source link

SVG just does not seem to work. #880

Open nathnolt opened 1 year ago

nathnolt commented 1 year ago

Environments

Description

SVG just does not seem to work, or I'm missing something.

I know this was kind of already addressed by https://github.com/daybrush/moveable/issues/842 But this issue specifically mentioned Svelte, when problem happens in vanilla as well. I'm not sure what other frameworks are doing if it works in these.

I'm not really sure if this is user error, and if there is a way to fix it, or if it's an error. I tried previous versions, but they also broke in this case.

I did use unpkg for the movable code: https://www.unpkg.com/moveable@0.45.0/dist/moveable.js Maybe the dist/ builds are broken, and it only works when you do import?

Thanks for reading, feel free to tell my what I'm doing wrong and / or how to fix it.

daybrush commented 1 year ago

@nathnolt

It is not possible to insert a moveable inside an svg element.

Try injecting moveable into document.body.

nathnolt commented 1 year ago

So what you're saying is to set the container on an HTML element instead of the SVG element, like this? https://codepen.io/nathnolt/pen/ExeBEVG

Because this seems to work.

daybrush commented 1 year ago

@nathnolt

You are right. It works as per your codepen demo.