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

live preview: Update selection when size of UI changes #4644

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

hunger
Copy link
Member

@hunger hunger commented Feb 20, 2024

Changing the size of a UI will most likely move elements around. So reselect the current selection when that happens.

This is not a proper solution: It e.g. ignores animations changing element sizes, etc. but it does handle one annoying case.

Changing the size of a UI will most likely move elements
around. So reselect the current selection when that happens.

This is not a proper solution: It e.g. ignores animations
changing element sizes, etc. but it does handle one
annoying case.
@@ -93,6 +93,21 @@ pub fn set_contents(url: &VersionedUrl, content: String) {
}
}

pub fn reselect_element() {
Copy link
Member

Choose a reason for hiding this comment

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

doesn't this belong in the selection module?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it belongs into element selection, but it also needs PREVIEW_STATE and I am trying to keep that in preview.rs. So I moved the re-selection code there.

Copy link
Member

Choose a reason for hiding this comment

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

you can always use super::PREVIEW_STATE

@hunger hunger merged commit 2c096aa into slint-ui:master Feb 20, 2024
35 checks passed
@hunger hunger deleted the lp_reselect_on_resize branch February 20, 2024 11:30
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.

2 participants