-
Notifications
You must be signed in to change notification settings - Fork 86
refactor: extract and unify dialog bounds handling logic #9486
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bdcd05b
always set bounds when dragging or resizing
jouni f361491
refactor: extract dialog bounds logic into separate class
web-padawan 1676341
refactor: use single method to get event coordinates
web-padawan c76f5e1
refactor: do not store dialog unnecessarily
web-padawan 83f89a0
fix: restore logic for only setting top and left on drag
web-padawan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm not sure if this an improvement in terms of structure and readability. Some (very small) parts of the drag and resize logic are now "hidden" in the manager class, while the majority of it stays in the mixins. The class itself doesn't encapsulate any logic on its own, but just contains some utilities and some state. Its purpose is not clear from the name and it's also hard to come up with a better one. The weak map was also confusing me at first.
I think I prefer the duplication in this case, makes it easier to understand what's going on. As an alternative, a random idea would be to merge the two mixins. Or extract some utility functions that avoid duplicating some of the calculations at least. But I don't see a lot of value here in general, unless I'm missing some context where we would need to introduce more duplication for a new feature.
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.
Thanks, actually I was also thinking about merging mixins. It's probably ok to keep the code the way it is.
I still think we should revert some changes from the base styles PR and update tests accordingly.