Skip to content

Commit 085629a

Browse files
committed
Extend minimum/maximum zoom level of TextureRegion editor
This also applies a similar change to the SpriteFrames editor.
1 parent fa48a51 commit 085629a

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

editor/plugins/sprite_frames_editor_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2178,7 +2178,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
21782178
min_thumbnail_zoom = 0.1f * MAX(1.0f, EDSCALE);
21792179
// Default the zoom to match the editor scale, but don't dezoom on editor scales below 100% to prevent pixel art from looking bad.
21802180
sheet_zoom = MAX(1.0f, EDSCALE);
2181-
max_sheet_zoom = 16.0f * MAX(1.0f, EDSCALE);
2181+
max_sheet_zoom = 128.0f * MAX(1.0f, EDSCALE);
21822182
min_sheet_zoom = 0.01f * MAX(1.0f, EDSCALE);
21832183
_zoom_reset();
21842184

editor/plugins/texture_region_editor_plugin.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ void TextureRegionEditor::_set_snap_sep_y(float p_val) {
698698
}
699699

700700
void TextureRegionEditor::_zoom_on_position(float p_zoom, Point2 p_position) {
701-
if (p_zoom < 0.25 || p_zoom > 8) {
701+
if (p_zoom < min_draw_zoom || p_zoom > max_draw_zoom) {
702702
return;
703703
}
704704

@@ -1166,6 +1166,11 @@ TextureRegionEditor::TextureRegionEditor() {
11661166

11671167
hb_grid->hide();
11681168

1169+
// Default the zoom to match the editor scale, but don't dezoom on editor scales below 100% to prevent pixel art from looking bad.
1170+
draw_zoom = MAX(1.0f, EDSCALE);
1171+
max_draw_zoom = 128.0f * MAX(1.0f, EDSCALE);
1172+
min_draw_zoom = 0.01f * MAX(1.0f, EDSCALE);
1173+
11691174
texture_preview = memnew(PanelContainer);
11701175
vb->add_child(texture_preview);
11711176
texture_preview->set_v_size_flags(Control::SIZE_EXPAND_FILL);

editor/plugins/texture_region_editor_plugin.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class TextureRegionEditor : public AcceptDialog {
7676

7777
Vector2 draw_ofs;
7878
float draw_zoom = 1.0;
79+
float min_draw_zoom = 1.0;
80+
float max_draw_zoom = 1.0;
7981
bool updating_scroll = false;
8082

8183
SnapMode snap_mode = SNAP_NONE;

0 commit comments

Comments
 (0)