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

Support switching VisCanvas's sizing behaviour dynamically #924

Merged
merged 1 commit into from
Jan 12, 2022

Conversation

axelboc
Copy link
Contributor

@axelboc axelboc commented Jan 11, 2022

We can now toggle the value of VisCanvas's canvasRatio prop (between a ratio and undefined) and the the sizing behaviour of the canvas will change accordingly (i.e. adapt its ratio on resize or just fill the screen). This is thanks to react-hookz/web@4c6f074, which now allows useMeasure to be toggled on/off dynamically.

@axelboc axelboc requested a review from loichuder January 11, 2022 16:44
@axelboc
Copy link
Contributor Author

axelboc commented Jan 11, 2022

Note that you cannot test this in Storybook. According to storybookjs/storybook#13259 (comment), you cannot set a control's value to undefined if if was given a value in the story. Unfortunately, it seems you can't test it from another story either, as the reset button doesn't seem to reset the value of canvasRatio to undefined as suggested in the comment.

Only way to test is to run the Storybook in dev and change the default control value manually.

@axelboc axelboc merged commit 62e10cf into main Jan 12, 2022
@axelboc axelboc deleted the fix-dynamic-layout branch January 12, 2022 07:48
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