summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-08-25 12:44:21 +0200
committerGitHub <noreply@github.com>2020-08-25 12:44:21 +0200
commitdd58f4da66dab7b86d5919b6e1dc951dc0ad04c7 (patch)
treee2e586d65040451a1a12ab78c0fc4834b7ebf605
parent9d8f3496e8352d982fed4ffd420f567af7a840cc (diff)
parent603febdbfef2d4553eb22e545d3094142b5eaab3 (diff)
Merge pull request #41085 from SekoiaTree/master
Fixed node scaling arrows being wrong
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index f3508cedbd..3f9f159d7f 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -2599,6 +2599,11 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
void CanvasItemEditor::_update_cursor() {
CursorShape c = CURSOR_ARROW;
+ bool should_switch = false;
+ if (drag_selection.size() != 0) {
+ float angle = drag_selection[0]->_edit_get_rotation();
+ should_switch = abs(Math::cos(angle)) < Math_SQRT12;
+ }
switch (drag_type) {
case DRAG_NONE:
switch (tool) {
@@ -2621,21 +2626,37 @@ void CanvasItemEditor::_update_cursor() {
case DRAG_LEFT:
case DRAG_RIGHT:
case DRAG_V_GUIDE:
- c = CURSOR_HSIZE;
+ if (should_switch) {
+ c = CURSOR_VSIZE;
+ } else {
+ c = CURSOR_HSIZE;
+ }
break;
case DRAG_TOP:
case DRAG_BOTTOM:
case DRAG_H_GUIDE:
- c = CURSOR_VSIZE;
+ if (should_switch) {
+ c = CURSOR_HSIZE;
+ } else {
+ c = CURSOR_VSIZE;
+ }
break;
case DRAG_TOP_LEFT:
case DRAG_BOTTOM_RIGHT:
case DRAG_DOUBLE_GUIDE:
- c = CURSOR_FDIAGSIZE;
+ if (should_switch) {
+ c = CURSOR_BDIAGSIZE;
+ } else {
+ c = CURSOR_FDIAGSIZE;
+ }
break;
case DRAG_TOP_RIGHT:
case DRAG_BOTTOM_LEFT:
- c = CURSOR_BDIAGSIZE;
+ if (should_switch) {
+ c = CURSOR_FDIAGSIZE;
+ } else {
+ c = CURSOR_BDIAGSIZE;
+ }
break;
case DRAG_MOVE:
c = CURSOR_MOVE;