-
Couldn't load subscription status.
- Fork 116
Builder overlay + Sizing #3501
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
Builder overlay + Sizing #3501
Conversation
|
This PR targets the un-managed branch odoo-dev/odoo:master-mysterious-egg, it needs to be retargeted before it can be merged. |
7417088 to
cdc50b5
Compare
|
This PR targets the un-managed branch odoo-dev/odoo:master-mysterious-egg, it needs to be retargeted before it can be merged. |
aeacbc1 to
395880e
Compare
57ca2df to
e5a0389
Compare
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay.js
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay_plugin.js
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay_plugin.js
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay_plugin.js
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay_plugin.js
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay_plugin.js
Outdated
Show resolved
Hide resolved
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.
=== _update ?
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 would say that, for now, let's keep them separated: when the sizing,... will be implemented, we could still add an update function later to do both at once if we repeat them a lot 🙂
And if you meant "using the _update function of the plugin after calling toggleOverlay", then I prefer doing the refresh here, so the overlay logic is grouped at one place (easier to follow the flow), like each overlay updates itself 👍
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.
do we still need need with _update
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 prefer keeping everything separated, because we do not always need to update both at the same time, e.g.:
- scrolling only needs to refresh the position, as the handles are not supposed to change
- using an option may change both the size and the "status" of an element, so we need to refresh both the handles and the position
However, I agree that refreshHandles alone is not needed yet, but let's keep it for now to be consistent, we can remove it later if really no case needs it in the end 🙂
Also, the update was needed to use it in handleCommand, and also to make all the changes in one loop, to be a bit more efficient 🙂
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.
window.document === document ?
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.
rename contextItem => scrollingElement
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.
document is not defined there, so we need to use window.document 🙂 (see the function just above that uses it too)
318f42b to
2b89573
Compare
|
I made the changes, see diff 🙂 (don't mind the |
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay.scss
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay.scss
Outdated
Show resolved
Hide resolved
|
|
||
| // On keydown, hide the overlay and then show it again when the mouse | ||
| // moves. | ||
| let wasKeydown; |
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 would rather have a variable isOverlayVisible set by toggleOverlayVisibility. If we try to set a visibility that is the same as the previous one, we directly return.
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay_plugin.js
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay_plugin.js
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay_plugin.js
Outdated
Show resolved
Hide resolved
| // TODO check if resizeObserver still needed. | ||
| // this.resizeObserver = new ResizeObserver(this.update.bind(this)); | ||
| // this.resizeObserver.observe(this.overlayTarget); |
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 would still add it if some code changes the size of the box without adding a step (eg. a preview)
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay_plugin.js
Show resolved
Hide resolved
| refreshPosition() { | ||
| this.overlays.forEach((overlay) => { | ||
| overlay.refreshPosition(); | ||
| }); | ||
| } | ||
|
|
||
| refreshHandles() { | ||
| this.overlays.forEach((overlay) => { | ||
| overlay.refreshHandles(); | ||
| }); | ||
| } |
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.
As refreshing the handles is rather cheap, I would call update when we need to refresh the positions to avoid having one more method.
refreshHandles is not call in the plugin so we can remove the method.
| }); | ||
| } | ||
|
|
||
| toggleOverlayVisibility(show) { |
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.
setOverlaysVisibility?
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay_plugin.js
Outdated
Show resolved
Hide resolved
5d420ac to
2071836
Compare
53d83ba to
7b6623f
Compare
fef1800 to
e3afa34
Compare
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.
Well play ! This is a huge feature 💯
A few of my comments are nitpicking, you can ignore few of those if you want 👍
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay.js
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/utils/grid_layout_utils.js
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/plugins/builder_overlay/builder_overlay.js
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/utils/grid_layout_utils.js
Outdated
Show resolved
Hide resolved
Needed in order for the sizing to be smoother (compared to master) but mostly to allow it to be tested, as the tests make big pointer moves, which therefore did not work with the previous implementation since it increments the indexes one by one, instead of considering the delta.
f2ad721 to
9ff074b
Compare
No description provided.