-
-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with zoom #54
Comments
I understand the first part of the ticket (width instead of Height)...but the second part is not clear to me. |
Hi, it was quite a while ago, but as far as I can remember the problem in second part is that in setDimension we are calling this.setZoom with the first argument being zoomFactor of canvas, which after being passed to WheelZoomPolicy's zoom handler is checked for equality with itself in that condition and thus condition will always be true. Line 683 in f228358
Line 623 in f228358
draw2d/src/policy/canvas/WheelZoomPolicy.js Line 134 in f228358
draw2d/src/policy/canvas/WheelZoomPolicy.js Line 149 in f228358
in the end zoom and canvas.zoomFactor is the same variable. Thus there is no actions from WheelZoomPolicy's zoom handler on changing dimensions and as far as I can remember the problem was that zoom is reset to 1:1 in the start of setDimension but because of that condition was not applied back in the end. Unfortunately I don't remember how I thought to fix it, haven't worked with draw2d for a while. |
I got it. Try to fix it |
I'm trying to use WeelZoomPolicy but I have some problems.
I get in console
|
Not sure if this is the same issue, but there is a bug in the wheel zoom policy. This line calls _zoom with three parameters (zoom, centerX, centerY): https://github.com/freegroup/draw2d/blob/master/src/policy/canvas/WheelZoomPolicy.js#L127 But _zoom expects two parameters (zoom, centerPoint). |
Hi, found a few problems with zoom policy:
draw2d/src/policy/canvas/WheelZoomPolicy.js
Line 114 in f228358
This line should use height() instead of width()
draw2d/src/policy/canvas/WheelZoomPolicy.js
Line 149 in f228358
This is always true when canvas dimensions are changed via setDimension here:
draw2d/src/Canvas.js
Line 683 in f228358
Because of that currently if you call canvas.setDimension when canvas is zoomed, zoom is not applied back after resize, which results in zoom being visually reset, but still applied on canvas coordinates calculation producing wrong results.
The text was updated successfully, but these errors were encountered: