daybrush / moveable

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

Setting `setFixedDirection` while resizing #623

Closed seahindeniz closed 2 years ago

seahindeniz commented 2 years ago

Environments

Description

Setting the setFixedDirection with onResizeStart event is possible, but seems like we can't change its value without clicking on the handler again to change its value.

I have a case where I need to change setFixedDirection value while I'm resizing an element (possibly with onResize event). For example, when I resize an element, I want to hold Shift button to toggle the value so that I can have more functionality. Is there are way that we can achieve this without forcing the onResizeStart event to be triggered again?

daybrush commented 2 years ago

@seahindeniz

okay I'll add this function on resize event.

daybrush commented 2 years ago

@seahindeniz

moveable's new version is released.

use beforeResize event

onBeforeResize={e => {
   // direction
   e.setFixedDirection([0, 0]);
}}