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

reworked autoresize to work with render area #25

Merged
merged 1 commit into from
Mar 2, 2025
Merged

Conversation

cxreiff
Copy link
Owner

@cxreiff cxreiff commented Mar 2, 2025

The previous autoresize functionality wasn't very flexible, as it was tied to window size as opposed to render_area size. Any layout other than complete fullscreen meant that the dimensions provided by crossterm resize events wouldn't be the same as the area the RatatuiCameraWidget would be rendered in. autoresize_fn was provided as a workaround to adjust the dimensions proportionally after the fact, but it is unnecessary manual work for the user when 99% of the time people just want the render texture to fill the ratatui area Rect that it's being rendered in.

That autoresize functionality has been removed and replaced by a new way to resize each frame: RatatuiCameraWidget::render_autoresize(...).

Just call render_autoresize in your draw function instead of render and any frame where there is a size mismatch, rendering will be skipped and a resize will be triggered instead.

@cxreiff cxreiff force-pushed the autoresize_rework branch from 6e8178a to ec606d2 Compare March 2, 2025 06:48
@cxreiff cxreiff merged commit b7aa678 into main Mar 2, 2025
8 checks passed
@cxreiff cxreiff deleted the autoresize_rework branch March 2, 2025 07:19
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.

1 participant