summaryrefslogtreecommitdiffstats
path: root/editor/plugins/texture_region_editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/texture_region_editor_plugin.cpp')
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 73de15631a..2a8b357559 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -33,10 +33,10 @@
#include "core/input/input.h"
#include "core/os/keyboard.h"
#include "editor/editor_node.h"
-#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/editor_undo_redo_manager.h"
+#include "editor/themes/editor_scale.h"
#include "scene/gui/check_box.h"
#include "scene/gui/option_button.h"
#include "scene/gui/panel_container.h"
@@ -698,7 +698,7 @@ void TextureRegionEditor::_set_snap_sep_y(float p_val) {
}
void TextureRegionEditor::_zoom_on_position(float p_zoom, Point2 p_position) {
- if (p_zoom < 0.25 || p_zoom > 8) {
+ if (p_zoom < min_draw_zoom || p_zoom > max_draw_zoom) {
return;
}
@@ -1166,6 +1166,11 @@ TextureRegionEditor::TextureRegionEditor() {
hb_grid->hide();
+ // Default the zoom to match the editor scale, but don't dezoom on editor scales below 100% to prevent pixel art from looking bad.
+ draw_zoom = MAX(1.0f, EDSCALE);
+ max_draw_zoom = 128.0f * MAX(1.0f, EDSCALE);
+ min_draw_zoom = 0.01f * MAX(1.0f, EDSCALE);
+
texture_preview = memnew(PanelContainer);
vb->add_child(texture_preview);
texture_preview->set_v_size_flags(Control::SIZE_EXPAND_FILL);