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

Avoid accidentally changing the logical size when changing user scale due to rounding errors #443

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

robbert-vdh
Copy link
Contributor

This happened due to rounding errors in the conversion to and from integers. We can detect this by doing the same computation, and treating the resize as a noop if it does happen. This prevents the logical size from slowly drifting when changing the user scale many times in a row.

This happened due to rounding errors in the conversion to and from
integers. We can detect this by doing the same computation, and treating
the resize as a noop if it does happen. This prevents the logical size
from slowly drifting when changing the user scale many times in a row.
Comment on lines +218 to 221
// TODO: Without this `WindowEvent::GeoChanged` isn't emitted for every element, even
// though this same function is also called in the
// `baseview::WindowEvent::Resized` event handler. Why?
cx.set_scale_factor(self.window_scale_factor * self.current_user_scale_factor);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the part I don't get. This call shouldn't be necessary since the event handler calls the same function with the same values, but without it not all GeometryChanged events are fired. Specifically, the event is not fired for Models, like in the user_scale example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Something similar happens when changing just the window size (and this call doesn't help there). GeometryChanged isn't called for Models when changing just the window size.

@robbert-vdh
Copy link
Contributor Author

I'll probably end up changing the Window::resize semantics in baseview (so it's consistent between platforms, which it isn't right now) and then I'll update Vizia to match.

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.

None yet

2 participants