Element moves when i resize it after toggling the resizable options
[Codepen] [https://codepen.io/dlmu-lq/pen/xedRme]
// pseudo code
dragInteractor = interact(".resize-drag").resizable({...})
dragInteractor.resizable(false);
dragInteractor = interact(".resize-drag").resizable({...})
Expected behavior
First, make a div resizable,it works fine, after 2 seconds, disable it; When I want to resize it again after re-enable it, the div should be resizable as new.
Actual behavior
But when I resize it again after re-enable it, the div will move when I resize it from left or top. Reisizing it from bottom or right works just fine.
System configuration
interact.js version: interactjs@next Browser name and version: Chrome 73.0.3683.86 Operating System: Windows 10 (1809) (17763.437)
You're adding the resizemove listener multiple times with .on().
You could instead use the listeners array to clear previous listeners and add new ones in the action options object.
interactable.resizable({
listeners: [{ move: function (event) {...} }]
// ...
})
@taye Thanks!