vue-draggable-resizable
vue-draggable-resizable copied to clipboard
Percent for width/height (not pixels)
Was wondering if it's possible to use percent instead of pixels.
@mauricius This would be awesome. Can you point to someone who has got this down? or noone found a way around it?
+1 here. Looking for exactly that…
Percent of what? Screen size? or element? Anyway in both cases you can easily calculate it. What you need is just a bit of math and for example read this.
Absolute positioning with object width in percentage relative to the parent. And someone already made it: https://www.npmjs.com/package/volplane-drag-resize Tried it today, but it has some hickups for my use case so I ended up using jQueryUI again which does the job just fine if you integrate it on the right hooks. I tried to add it to a fork of this git first, but my webpack skills are still terrible, so I chose jQueryUI - it's the devil I know…
Oh and just calculating is not possible if you want to scale it with respect to the screen size for example, because the component style is set by the component itself.
Percent of what? Screen size? or element? Anyway in both cases you can easily calculate it. What you need is just a bit of math and for example read this.
If I calculate it with the screen width / height, the component breaks and stops moving, reactivity must be busted.
Problem is I need, dragging, resizing and checking for collisions, with percentage based width and height. And no, jQuery is never the solution.!