summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scene/gui/graph_edit.cpp17
-rw-r--r--scene/gui/graph_edit.h4
-rw-r--r--scene/gui/graph_node.cpp13
-rw-r--r--scene/gui/graph_node.h2
-rw-r--r--scene/main/viewport.cpp4
5 files changed, 39 insertions, 1 deletions
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 946e8a2ad5..f2f98b1889 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -62,6 +62,15 @@ GraphEditMinimap::GraphEditMinimap(GraphEdit *p_edit) {
is_resizing = false;
}
+Control::CursorShape GraphEditMinimap::get_cursor_shape(const Point2 &p_pos) const {
+ Ref<Texture2D> resizer = get_theme_icon(SNAME("resizer"));
+ if (is_resizing || (p_pos.x < resizer->get_width() && p_pos.y < resizer->get_height())) {
+ return CURSOR_FDIAGSIZE;
+ }
+
+ return Control::get_cursor_shape(p_pos);
+}
+
void GraphEditMinimap::update_minimap() {
Vector2 graph_offset = _get_graph_offset();
Vector2 graph_size = _get_graph_size();
@@ -190,6 +199,14 @@ void GraphEditMinimap::_adjust_graph_scroll(const Vector2 &p_offset) {
ge->set_scroll_ofs(p_offset + graph_offset - camera_size / 2);
}
+Control::CursorShape GraphEdit::get_cursor_shape(const Point2 &p_pos) const {
+ if (moving_selection) {
+ return CURSOR_MOVE;
+ }
+
+ return Control::get_cursor_shape(p_pos);
+}
+
PackedStringArray GraphEdit::get_configuration_warnings() const {
PackedStringArray warnings = Control::get_configuration_warnings();
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index dfe6b94906..8b02fbfddc 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -64,6 +64,8 @@ protected:
public:
GraphEditMinimap(GraphEdit *p_edit);
+ virtual CursorShape get_cursor_shape(const Point2 &p_pos = Point2i()) const override;
+
void update_minimap();
Rect2 get_camera_rect();
@@ -286,6 +288,8 @@ protected:
GDVIRTUAL4R(bool, _is_node_hover_valid, StringName, int, StringName, int);
public:
+ virtual CursorShape get_cursor_shape(const Point2 &p_pos = Point2i()) const override;
+
PackedStringArray get_configuration_warnings() const override;
Error connect_node(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port);
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 8b2d462d85..6031730b81 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -990,7 +990,6 @@ void GraphNode::gui_input(const Ref<InputEvent> &p_ev) {
Ref<InputEventMouseMotion> mm = p_ev;
if (resizing && mm.is_valid()) {
Vector2 mpos = mm->get_position();
-
Vector2 diff = mpos - resizing_from;
emit_signal(SNAME("resize_request"), resizing_from_size + diff);
@@ -1055,6 +1054,18 @@ bool GraphNode::is_selectable() {
return selectable;
}
+Control::CursorShape GraphNode::get_cursor_shape(const Point2 &p_pos) const {
+ if (resizable) {
+ Ref<Texture2D> resizer = get_theme_icon(SNAME("resizer"));
+
+ if (resizing || (p_pos.x > get_size().x - resizer->get_width() && p_pos.y > get_size().y - resizer->get_height())) {
+ return CURSOR_FDIAGSIZE;
+ }
+ }
+
+ return Control::get_cursor_shape(p_pos);
+}
+
Vector<int> GraphNode::get_allowed_size_flags_horizontal() const {
Vector<int> flags;
flags.append(SIZE_FILL);
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index a118efb37a..e6ecc3d89b 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -197,6 +197,8 @@ public:
virtual Size2 get_minimum_size() const override;
+ virtual CursorShape get_cursor_shape(const Point2 &p_pos = Point2i()) const override;
+
virtual Vector<int> get_allowed_size_flags_horizontal() const override;
virtual Vector<int> get_allowed_size_flags_vertical() const override;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index f3c2f4b0cc..07560b4a82 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2601,6 +2601,10 @@ bool Viewport::_sub_windows_forward_input(const Ref<InputEvent> &p_event) {
}
gui.subwindow_focused->_rect_changed_callback(new_rect);
+
+ if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_CURSOR_SHAPE)) {
+ DisplayServer::get_singleton()->cursor_set_shape(DisplayServer::CURSOR_MOVE);
+ }
}
if (gui.subwindow_drag == SUB_WINDOW_DRAG_CLOSE) {
gui.subwindow_drag_close_inside = gui.subwindow_drag_close_rect.has_point(mm->get_position());