summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2021-06-08 20:33:07 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2021-06-08 20:33:07 +0200
commit74c584472c7a353eda3ed774c066ceecde4956b7 (patch)
treecaa7e81b99abb008a1e4d670074a6940e5e3c4f5
parent5793988b8da27e459a36482f9658a936d3e26286 (diff)
Allow higher and lower maximum zoom values in GraphEdit
Low zoom values result in unreadable text, but it can still be useful for previewing purposes. Eventually, characters could be replaced by rectangles at very low zoom levels to improve the visual appearance.
-rw-r--r--scene/gui/graph_edit.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 5a4dacd897..4ac6e7d836 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -42,8 +42,13 @@
#define ZOOM_SCALE 1.2
-#define MIN_ZOOM (((1 / ZOOM_SCALE) / ZOOM_SCALE) / ZOOM_SCALE)
-#define MAX_ZOOM (1 * ZOOM_SCALE * ZOOM_SCALE * ZOOM_SCALE)
+// Allow dezooming 8 times from the default zoom level.
+// At low zoom levels, text is unreadable due to its small size and poor filtering,
+// but this is still useful for previewing purposes.
+#define MIN_ZOOM (1 / Math::pow(ZOOM_SCALE, 8))
+
+// Allow zooming 4 times from the default zoom level.
+#define MAX_ZOOM (1 * Math::pow(ZOOM_SCALE, 4))
#define MINIMAP_OFFSET 12
#define MINIMAP_PADDING 5