Skip to content
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 #3501

Open
wants to merge 3 commits into
base: master-mysterious-egg
Choose a base branch
from
Open

Conversation

sobo-odoo
Copy link

No description provided.

@robodoo
Copy link

robodoo commented Nov 12, 2024

This PR targets the un-managed branch odoo-dev/odoo:master-mysterious-egg, it needs to be retargeted before it can be merged.

@sobo-odoo sobo-odoo force-pushed the master-mysterious-egg-sobo branch 3 times, most recently from 7417088 to cdc50b5 Compare November 14, 2024 15:42
@sobo-odoo sobo-odoo marked this pull request as ready for review November 15, 2024 14:05
@robodoo
Copy link

robodoo commented Nov 15, 2024

This PR targets the un-managed branch odoo-dev/odoo:master-mysterious-egg, it needs to be retargeted before it can be merged.

addons/html_builder/static/src/builder/utils/utils.js Outdated Show resolved Hide resolved
Comment on lines +237 to +225
this.refreshPosition();
this.refreshHandles();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=== _update ?

Copy link
Author

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 👍

Comment on lines +156 to +154
refreshHandles() {
this.overlays.forEach((overlay) => {
overlay.refreshHandles();
});
}

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

Copy link
Author

@sobo-odoo sobo-odoo Nov 15, 2024

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 🙂

@@ -192,3 +192,9 @@ export function getScrollingElement(document = window.document) {
}
return baseScrollingElement;
}

export function getScrollingTarget(contextItem = window.document) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

window.document === document ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename contextItem => scrollingElement

Copy link
Author

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)

@sobo-odoo
Copy link
Author

I made the changes, see diff 🙂 (don't mind the NumberInput.js file that you already fixed, I rebased after my changes 😉)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants