-
-
Notifications
You must be signed in to change notification settings - Fork 967
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
fix: Slider put in Canvas NaN Exception #2604
Open
TranquilAbyss
wants to merge
1
commit into
stride3d:master
Choose a base branch
from
TranquilAbyss:fix_slider_nan_in_canvas
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry I can't accept this change as is, this is a workaround, you're using
MaxValue
here because it doesn't cause an issue, not because it makes sense with the rest of the logic.availableSizeWithoutMargins
is positive infinity here I'm guessing, if that's the case you should fix this higher up the call stack.Measure()
could be used to replace infinities with the actual maximum size the element can take inside the container it is in for exampleThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put a Slider into a Canvas.
In
Measure
we use theCanvas
OverrideMeasure
toThis is what happens in
![image](https://private-user-images.githubusercontent.com/2864849/408832719-7be41144-b1bd-4fdf-b538-aa3d9fd69e8d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4OTI1NjUsIm5iZiI6MTczODg5MjI2NSwicGF0aCI6Ii8yODY0ODQ5LzQwODgzMjcxOS03YmU0MTE0NC1iMWJkLTRmZGYtYjUzOC1hYTNkOWZkNjllOGQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMDEzNzQ1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGE4NjQ2MzU1NDNkMjRkMzIwZTE2Zjg3ZDQ2MWFjYmFiZDk2N2Q1YzdiNjlkMjIyYmM1MDI5NWZjMWE2YTljMiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.1EhXiKdeknYZZMBmc5_Hq9MEhxSvEyX7dlvSBNRxfQ0)
![image](https://private-user-images.githubusercontent.com/2864849/408832738-e5f09077-969c-4c37-a74c-2025eed332b9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4OTI1NjUsIm5iZiI6MTczODg5MjI2NSwicGF0aCI6Ii8yODY0ODQ5LzQwODgzMjczOC1lNWYwOTA3Ny05NjljLTRjMzctYTc0Yy0yMDI1ZWVkMzMyYjkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMDEzNzQ1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTJhZWNjNzkwNjkwYzI3ZWJjMjdiYWE2NjQ4M2FhYWU4YWI0NWVhYmEyMGFjZTM0NjNhNWQ3MTU1ZGNmY2QyMiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.l_syJ4D-k5wtmC3grP2kxksHechoxoBSrC6fr5vu9Ko)
Canvas
OverrideMeasure
Due to this this section of the code
It is the Canvas MeasureOverride that calls the Slider's Messure. With the following value
![image](https://private-user-images.githubusercontent.com/2864849/408833685-6828ff0e-cb2d-415a-9569-1ec642059fc0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4OTI1NjUsIm5iZiI6MTczODg5MjI2NSwicGF0aCI6Ii8yODY0ODQ5LzQwODgzMzY4NS02ODI4ZmYwZS1jYjJkLTQxNWEtOTU2OS0xZWM2NDIwNTlmYzAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMDEzNzQ1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjA5MDllNTFjZTY3NGYwNGZjMzUyMDNhNGI5NjE0ZDQ1MDMwZTdhYmE5NTdmOGZkMzJjYzJhODk1NzkzZmMxOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.2IOa_rjhvWQHxslX5c8EMpDq3Nag-82KvdtwmQnrhFw)
How can I use the Canvas's Measure size value when its still trying to calculate the measure of the children (Slider) to be use to get the parents initial measurement? Kind of a what comes first problem (Chicken or Egg)?
In regards to using containers (Canvas?) actual maximum size I am not sure where to get that either within the Canvas MeasureOverride or the Child.Measure? This a first frame kind of problem.
My guess was Canvas was suppose to provide infinity size so handle it within the Slider, since a Slider is the only UI Element with the issue.