Overview
Implement simplified zoom interface just introduced a bug.
When using the range slider to adjust the zoom level to any percentage greater than 25%, both the zoom-in (plus) and zoom-out (minus) buttons exhibit incorrect behaviour. Specifically:
-Zoom-In Behaviour: Clicking the plus button after setting the zoom level to more than 25% causes the zoom level to first reset to 25% before gradually increasing.
-Zoom-Out Behaviour: Clicking the minus button after setting the zoom level to more than 25% directly sets the zoom level to 25%, instead of decrementing from the current zoom level.
Proposed resolution
User interface changes
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 3470647-12.gif | 10.72 MB | shyam_bhatt |
| #7 | 3470647-7.mp4 | 3.57 MB | shyam_bhatt |
| zoom.mov | 1.8 MB | utkarsh_33 |
Issue fork experience_builder-3470647
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
lauriiiComment #3
utkarsh_33 commentedComment #4
omkar-pd commentedIn
uiSlice.tswe haveIf the current scale does not match any of the above values it just resets to 1st value. i.e 25%.
In
ZoomControl.tsxComment #6
omkar-pd commentedComment #7
shyam_bhatt@omkar-pd I have checked the "MR !218" in my local, and the issue still exists. Clicking the plus button after setting the zoom level to more than 25% causes the zoom level to reset to 25% before gradually increasing and the same with the minus button.
I have added the "merge request !257" to fix the issue, after adding this patch the viewport will gradually increase and decrease by clicking the plus and minus buttons.
Comment #9
shyam_bhattComment #10
jessebaker commentedAs it stands I think both MR's for this issue have solved (not solved) slightly different variations of this problem.
To break things down I think part of the challenge here is that there are several different ways in which Zoom can happen and those are possibly being discussed/fixed interchangeably.
The actions that can change the zoom are as follows (and in brackets is the action those things firein uiSlice reducer).
1) You can zoom by clicking on and dragging the slider at the bottom (setCanvasViewPort)
2) You can zoom by clicking the blue + and - buttons either side of the slider (setCanvasViewPort)
3) You can zoom by holding down CTRL and rolling the wheel on a mouse (canvasViewPortZoomDelta)
4) You can zoom by using the pinch gesture on a laptop trackpad (canvasViewPortZoomDelta)
5) You can zoom by pressing
=and-ornumpad +andnumpad -on the keyboard (canvasViewPortZoomIn/canvasViewPortZoomOut)In cases 3,4 and 5 there is additional complexity introduced by the fact that when focused in (or with your mouse pointer over) the preview iFrame the event listeners are inside the iFrame and are passing on those events to the parent document via postMessages.
Regarding this specific problem, it seems to me that the reported issue is occuring in 2) and 5) in the above list.
Finally, at this point, through my testing, I can see that MR257 addresses 2) but not 5). I don't think MR218 addresses either issue and the bug still seems present on that branch.
Comment #11
shyam_bhattComment #12
shyam_bhatt@jessebaker issues 2) and 5) from the above list, were resolved in the MR257. Please check the image below.
Comment #13
jessebaker commentedThe code changed in MR257 isn't called when zooming using the + and - keyboard keys so issue 5 is still a problem even on that branch.
In Devtools place a breakpoint on the first line of the
handleIncrementfunction in ZoomControl.tsxSet the zoom to a "irregular" value like 118%
Click a component in the preview to ensure your focus is inside iFrame
Press the + or - keys
Note the breakpoint is not hit.
The code where the issue described in 5) occurs is in
canvasViewPortZoomIn/canvasViewPortZoomOutin uiSlice (called in two places in Canvas.tsx)Comment #14
shyam_bhattComment #16
shyam_bhattComment #17
wim leersThis is now ~1 week behind commits, so I'm not sure I can trust the green CI anymore 😅
Can you do:
to update this MR's branch to be tested against latest
0.x? 🙏Comment #18
shyam_bhattI have checked the code after rebasing the latest code. The #13 scenario is fixed on the MR !257.
Comment #19
wim leersThanks!
Comment #21
jessebaker commentedApproved and merged.