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

Introduce custom viewport layout to fix container shrinking #149

Merged
merged 2 commits into from
Jan 26, 2023

Conversation

bric3
Copy link
Owner

@bric3 bric3 commented Jan 26, 2023

Customize the viewport layout code to handle container shrinking. The default viewport layout asks the preferred size of the view. But that cannot work since the canvas won't update
its width, it receives its size from the layout container.

The default algorithm only updates the size after it has received the preferred size, or if the viewport got bigger.

This code makes the necessary query to the canvas to asks if it needs a new size given the viewport width change, in order to keep the same zoom factor.

The view location is also updated.

Fixes #46

bric3 added 2 commits January 26, 2023 22:36
Custom layout code to handle container shrinking.
The default view port layout asks the preferred size
of the view.

But that cannot work since the canvas won;t update
its width, it receives its size from the layout container.
However, the default algorithm only updates the size
after it has received the preferred size, or if the
viewport got bigger.

This code makes the necessary query to the canvas to
asks if it needs a new size given the viewport width change,
in order to keep the same zoom factor.

The view location is also updated.

Fixes #46
@bric3
Copy link
Owner Author

bric3 commented Jan 26, 2023

Due to computation, the zoom factor is not stable. And thus I believe a proper ZoomModel needs to be introduced (#150).

@bric3 bric3 merged commit 1a25ac2 into master Jan 26, 2023
@bric3 bric3 deleted the custom-layout-to-fix-issue-46 branch January 26, 2023 22:05
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.

Flamegraph should maintain scale when container is shrinked
1 participant