Closed jprustv closed 5 years ago
this.onlock
is intended to prevent translation when zooming on the touch screen
there is problem with a missed pointerup
event: end()
will not be triggered and translation will be locked
Fixed in v1.4.1-rc.2
. Please test it
Tested. Working like a charm ! Thank you!
Hello,
I was facing an issue where when I was trying to translate the editor area, if I happened to release the mouse's left button outside of the editor content div, the editor.view.area.transform was getting odd values. K was being set to 1, X and Y were being set to NaN.
After some debugging I found out that at this line of zoom.ts , on move() function:
let delta = distance / this.previous.distance - 1;
the this.previous.distance had 0 (zero) as value, which was causing delta to become NaN and consequently, that bug.The solution I found was to add another condition before that line to check if the value was 0, so:
if (this.previous !== null) {
becameif (this.previous !== null && this.previous.distance != 0) {
This almost fixed the bug, except that at down() function, the translating was getting locked for my next click as I noticed that at my next click the this.pointers array had two pointers. To fix that I changed this:
this.onlock(true);
tothis.onlock(false);
This apparently fixed everything for me, but since I'm not sure what was the original intention of having that onlock(true) there (maybe for mobile devices?), I suggest that you investigate this further and maybe find a more clean solution.