diff options
| author | Rémi Verschelde <remi@verschelde.fr> | 2022-01-12 11:36:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-12 11:36:41 +0100 |
| commit | b5495783b2c1848eab321aedde3d3805d9be6b3b (patch) | |
| tree | 5d03cfc7cffe8924f3dc56aea9811b5d9bdbf334 /scene/gui/graph_edit.h | |
| parent | dc3b2e6ea26ae6d76dfdfa180d3dbd59cd8d0df8 (diff) | |
| parent | ba7ed0579296464642f1cc90fe76590467793131 (diff) | |
| download | redot-engine-b5495783b2c1848eab321aedde3d3805d9be6b3b.tar.gz | |
Merge pull request #53185 from KoBeWi/viewing_pan
Diffstat (limited to 'scene/gui/graph_edit.h')
| -rw-r--r-- | scene/gui/graph_edit.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h index 145e0dcc59..4e998d30a7 100644 --- a/scene/gui/graph_edit.h +++ b/scene/gui/graph_edit.h @@ -41,6 +41,7 @@ #include "scene/gui/texture_rect.h" class GraphEdit; +class ViewPanner; class GraphEditFilter : public Control { GDCLASS(GraphEditFilter, Control); @@ -103,6 +104,12 @@ public: float activity = 0.0; }; + // Should be in sync with ControlScheme in ViewPanner. + enum PanningScheme { + SCROLL_ZOOMS, + SCROLL_PANS, + }; + private: Label *zoom_label; Button *zoom_minus; @@ -122,6 +129,11 @@ private: float port_grab_distance_horizontal = 0.0; float port_grab_distance_vertical; + Ref<ViewPanner> panner; + void _scroll_callback(Vector2 p_scroll_vec); + void _pan_callback(Vector2 p_scroll_vec); + void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin); + bool connecting = false; String connecting_from; bool connecting_out = false; @@ -136,6 +148,7 @@ private: bool connecting_valid = false; Vector2 click_pos; + PanningScheme panning_scheme = SCROLL_ZOOMS; bool dragging = false; bool just_selected = false; bool moving_selection = false; @@ -277,6 +290,9 @@ public: void remove_valid_connection_type(int p_type, int p_with_type); bool is_valid_connection_type(int p_type, int p_with_type) const; + void set_panning_scheme(PanningScheme p_scheme); + PanningScheme get_panning_scheme() const; + void set_zoom(float p_zoom); void set_zoom_custom(float p_zoom, const Vector2 &p_center); float get_zoom() const; @@ -338,4 +354,6 @@ public: GraphEdit(); }; +VARIANT_ENUM_CAST(GraphEdit::PanningScheme); + #endif // GRAPHEdit_H |
