-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Canvas] Feat: Zoom In/Out #38832
[Canvas] Feat: Zoom In/Out #38832
Conversation
💚 Build Succeeded |
💔 Build Failed |
@@ -14,6 +14,7 @@ export const getInitialState = path => { | |||
assets: {}, // assets end up here | |||
transient: { | |||
canUserWrite: capabilities.get().canvas.save, | |||
zoomLevel: 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zoomScale
?
@@ -25,3 +25,6 @@ export const DEFAULT_WORKPAD_CSS = '.canvasPage {\n\n}'; | |||
export const DEFAULT_ELEMENT_CSS = '.canvasRenderEl{\n\n}'; | |||
export const VALID_IMAGE_TYPES = ['gif', 'jpeg', 'png', 'svg+xml']; | |||
export const ASSET_MAX_SIZE = 25000; | |||
export const ZOOM_LEVELS = [0.5, 0.75, 0.9, 1, 1.5, 2, 3, 4]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[0.2, 0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4]
Allows 5K resolution on 1K screens, FWIW.
@cqliu1 design PR to delineate top and side sections, so that the page will appear to go under them as you zoom in or scroll around: Check out this design PR - https://github.com/cqliu1/kibana/pull/9 |
retest |
💔 Build Failed |
@cqliu1 what do you think of this? |
💔 Build Failed |
💔 Build Failed |
It looks good! I think I'm going to leave the keyboard shortcuts off the menu item for now though. I've talked with @ryankeairns about adding the shortcuts to context menu items so that they align on the right, but I don't think it's possible to add them that way yet. |
@andreadelrio |
💔 Build Failed |
@cqliu1 the zoom icons have been merged on the EUI side, so we'll just have to wait for the next EUI build and subsequent Kibana update. In the meantime, we could try out the icons if you'd like to store the SVGs in Kibana ( Preview |
@ryankeairns I'm okay with waiting for the next EUI update as long as it gets into to 7.3.0 before FF. |
💔 Build Failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me so far 💪 Will approve assuming green CI, the UI steps you discussed with Andrea and Ryan and remaining checklist items, glad to take another look on Friday or next week if the code changes significantly
x: clientX - left, | ||
y: clientY - top, | ||
x: (clientX - left) * (1 / zoomScale), | ||
y: (clientY - top) * (1 / zoomScale), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the JIT will optimize it away in any case, we can also do (clientX - left) / zoomScale
to save a few bytes
The plan is to start a new EUI release tomorrow (6/21)... stay tuned 📺 |
💔 Build Failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM. This is great, nice work! We can circle back to swap out the icon later.
💚 Build Succeeded |
* Added zoomScale to transient state * Added scaling to workpad * Fixed transform origin * Fixed mouse coordinate calculation * Unscaled BorderResizeHandle and RotationHandle * Added keyboard shortcuts * Fixed keyboard shortcuts reference * Updated tests for getPrettyShortcut * Added tooltip shortcuts * Added preventDefault to workpad shortcuts * define interface sections * Refactor key handler * Added zoom context menu * Updated zoom levels * Fixed ts errors and tests * Simplified mouse coordinate calculation * Moved new files to x-pack/legacy/plugins/canvas * Added TODOs to change icons
* Added zoomScale to transient state * Added scaling to workpad * Fixed transform origin * Fixed mouse coordinate calculation * Unscaled BorderResizeHandle and RotationHandle * Added keyboard shortcuts * Fixed keyboard shortcuts reference * Updated tests for getPrettyShortcut * Added tooltip shortcuts * Added preventDefault to workpad shortcuts * define interface sections * Refactor key handler * Added zoom context menu * Updated zoom levels * Fixed ts errors and tests * Simplified mouse coordinate calculation * Moved new files to x-pack/legacy/plugins/canvas * Added TODOs to change icons
Excelent!!! |
💚 Build Succeeded |
Summary
Closes #27123.
This adds the ability to zoom in/out of the work space in Canvas.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers