-
-
Notifications
You must be signed in to change notification settings - Fork 949
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: Specify size for the SpriteWidget #1760
Merged
erickzanardo
merged 4 commits into
flame-engine:main
from
st-pasha:ps.sprite-widget-size
Jun 29, 2022
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
02a1cc2
fix: Specify size for the SpriteWidget
st-pasha ff9632c
Merge branch 'main' into ps.sprite-widget-size
erickzanardo 01a88c4
refactor!: Matcher closeToVector() now accepts Vector2 as an argument…
st-pasha 853c479
Merge branch 'main' into ps.sprite-widget-size
spydon 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.
This will prevent the user to render the sprite bigger than its original size right?
I think that a better approach here would be to use the BoxFit enum. Or, maybe something like that. wdyt?
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.
This could be considered a feature request: adding explicit
size
parameter to SpriteWidget, and then taking it into account within SpriteRenderer.Current PR only addresses the problem that SpriteWidget is currently rendered at size 0, which is problematic if someone tries to do layout.
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.
Yeah, I get that, but this will solve one issue, while adding a new one, where all sprite widgets will always have the size of the image. And it will be impossible to render it bigger than its original size.
So we need an alternative here.
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.
So, i'm looking at
RenderCustomPaint
render-box, and it says that it considers the provided size as the preferred size, meaning it will attempt to find the size that is as close as possible to the given size, while still satisfying the parent's constraints. Meaning that if constrains say that minSize=maxSize=100, then that will be size of the widget regardless of what itssize
property says.I've tried this with the SpriteWidgetExample, and it can still scale the sprite both up and down.
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.
Interesting! So my concern will not happen! Thanks for checking on that. LGTM!
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.
Interesting indeed, can someone open an issue for setting custom sizes?