Skip to content

Option to disable automatic resizing of the canvas - #1897

Closed
Code-Chops wants to merge 3 commits into
mono:mainfrom
Code-Chops:main
Closed

Option to disable automatic resizing of the canvas#1897
Code-Chops wants to merge 3 commits into
mono:mainfrom
Code-Chops:main

Conversation

@Code-Chops

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

Copy link
Copy Markdown

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

robloo commented Dec 21, 2021

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Contributor

Are you talking about this bug: #1889

@Code-Chops

Copy link
Copy Markdown
Author

Yes :)

@mgood7123

Copy link
Copy Markdown
Contributor

why would you want to disable automatic resizing?

@mattleibow

Copy link
Copy Markdown
Contributor

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

@mgood7123

mgood7123 commented Mar 9, 2022

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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