Add zooming functionality to designs in Design view (#13217 part 2)
What does this MR do?
Gives user the ability to zoom in and out of designs in Design view (#13217 (closed)).
Scope
A user can:
- Zoom in and out, and reset the zoom, with the buttons provided
- Scroll around the image using native scroll (i.e. scrollbars)
- See comment pins and place new ones in any zoom state
Out of scope:
- Click-and-drag to explore image when zoomed in (coming in !22867 (closed))
- Mouse scroll-wheel to zoom
Demo
Video demo here. This demos the basics of the functionality on desktop.
Screenshots
What's in this MR?
3 main parts:
- New component,
design_scaler.vue
- Adding scaling capabilities to
design_presentation.vue
andimage.vue
- Adding "automatically centering scroll" capability to
design_presentation.vue
. Includes the concept of a "focal point" which can shift around the image as the user scrolls
This feature will need documentation, but will happen in a follow-up MR.
scrollable-design-view
branch, and depends on !22852 (merged) and !22942 (merged) being merged. At the time of writing, these are both waiting on maintainer review.
Implementation notes
For an overview of the general approach here, see the PoC MR description
Why not use transform: scale(x)
?
A number of reasons, but boils down to:
- Ensuring the entire image is visible (see this comment on the original issue related to this initial PoC)
- Complexity in positioning the image correctly in all scenarios
- Further relevant discussion about performance/mobile use here
Performance
Initial load
The following results are the averages of 4 tests, grouped by activity, and focused on the time between where the loading spinner disappears, to when the pin painting is finalised.
- | Before | After |
---|---|---|
Composite layers | 272.66ms | 236.25ms |
Javascript | 147.733ms | 19.775ms |
Paint | 4.9ms | 3.5ms |
Performance is fortunately slightly improved with this MR for initial load. This is likely mostly due to the fact that we now only show the commenting pins once we have image dimensions to work with - before, they were drawn immediately, then recalculated when the image loads.
Zooming
No experiments done for the actual zooming portion, because we have nothing to ccompare to! We should encounter them as they arise.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Chrome -
Firefox -
Safari -
Edge -
Internet Explorer
-