Increase default zoom for small sprite sheets in SpriteFramesEditor
#111471
+10
−4
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.
This pull request changes the sprite sheet zoom reset behavior in the
SpriteFramesEditorto have a larger default for smaller sprites. Specifically, sprites will be scaled up as much as possible without overflowing the display area. The behavior for larger sprites is unchanged. This addresses part of what was discussed in godotengine/godot-proposals#7021 in that "better" defaults for zoom reduce the need to store user preferences.The largest change is to
SpriteFramesEditor::_sheet_zoom_reset. Instead of zoom always resetting to a minimum of 1.0, the minimum value increases to an integer value based on the ratio of the texture size to the display area size. If the sprite can be scaled up by 2 while still fitting, it will. If it can be scaled up by 3, it will. Etc.The second change is to when
SpriteFramesEditor::_sheet_zoom_resetis called during loading of a new texture. Due to the pop up dialogue not knowing it's size until after it has popped up and been drawn once, the calculations inSpriteFramesEditor::_sheet_zoom_resetwouldn't be accurate for the first pop up. This resulted in all sprites having zoom 1.0 on that first popup, regardless of size. To remedy this, I changedSpriteFramesEditor::_sheet_zoom_resetto be triggered by a one shot signal after the popup has been shown.