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

Option to disable automatic resizing of the canvas #1897

Closed
wants to merge 3 commits into from
Closed

Option to disable automatic resizing of the canvas #1897

wants to merge 3 commits into from

Conversation

Code-Chops
Copy link

@Code-Chops Code-Chops commented Dec 19, 2021

At the moment it's not possible to disable automatic resizing of the canvas. Besides that there is a bug in the automatic resizing, I don't want the functionality at all for my project.

I added parameter 'AutoResize' to SKGLView and SKCanvasView (which is true by default). When it is disabled, the SizeWatcherInterop won't be used.

See issue:
#1896

Added:

/// <summary>
/// If true (default), the canvas will be automatically resized to fit the client width and height. 
/// </summary>
[Parameter]
public bool AutoResize { get; set; } = true;

@robloo
Copy link

robloo commented Dec 21, 2021

It looks like if you set AutoResize from false to true nothing will happen until the next paint. It might be a good idea, in the AutoResize property setter, to handle changes and then refresh things.

@Code-Chops
Copy link
Author

I changed the code so that the AutoResize script will always be imported. Observing is not started anymore when the script is loaded, but will start when the AutoResize-proprety is set to true. If the property is set to false, the element will not be observed anymore.

@mattleibow
Copy link
Contributor

Are you talking about this bug: #1889

@Code-Chops
Copy link
Author

Yes :)

@mgood7123
Copy link
Contributor

why would you want to disable automatic resizing?

@mattleibow
Copy link
Contributor

I think if you want to disable auto-resizing maybe you just need to set a fixed with/height?

@mgood7123
Copy link
Contributor

mgood7123 commented Mar 9, 2022

I think if you want to disable auto-resizing maybe you just need to set a fixed with/height?

heavily agreed, having an AutoResize option as a replacement for setting a fixed width/height instead is just stupid

@Code-Chops Code-Chops closed this by deleting the head repository Jan 9, 2023
@ViRuSTriNiTy
Copy link

Fixed with and height can be enforced via CSS, see solution posted here: #2038 (comment)

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.

5 participants