Fixed node scaling arrows being wrong
Patch for #21755. Node scaling arrows pointed the wrong way when nodes were rotated. Ammend: made math cleaner.
Simplified expression
Changes suggested by Aaron Franke
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
(cherry picked from commit 603febdbfe
)
This commit is contained in:
parent
d2636cd30f
commit
0d8b2d34e1
1 changed files with 25 additions and 4 deletions
|
@ -2488,6 +2488,11 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
// Change the cursor
|
// Change the cursor
|
||||||
CursorShape c = CURSOR_ARROW;
|
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) {
|
switch (drag_type) {
|
||||||
case DRAG_NONE:
|
case DRAG_NONE:
|
||||||
switch (tool) {
|
switch (tool) {
|
||||||
|
@ -2510,21 +2515,37 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
|
||||||
case DRAG_LEFT:
|
case DRAG_LEFT:
|
||||||
case DRAG_RIGHT:
|
case DRAG_RIGHT:
|
||||||
case DRAG_V_GUIDE:
|
case DRAG_V_GUIDE:
|
||||||
|
if (should_switch) {
|
||||||
|
c = CURSOR_VSIZE;
|
||||||
|
} else {
|
||||||
c = CURSOR_HSIZE;
|
c = CURSOR_HSIZE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DRAG_TOP:
|
case DRAG_TOP:
|
||||||
case DRAG_BOTTOM:
|
case DRAG_BOTTOM:
|
||||||
case DRAG_H_GUIDE:
|
case DRAG_H_GUIDE:
|
||||||
|
if (should_switch) {
|
||||||
|
c = CURSOR_HSIZE;
|
||||||
|
} else {
|
||||||
c = CURSOR_VSIZE;
|
c = CURSOR_VSIZE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DRAG_TOP_LEFT:
|
case DRAG_TOP_LEFT:
|
||||||
case DRAG_BOTTOM_RIGHT:
|
case DRAG_BOTTOM_RIGHT:
|
||||||
case DRAG_DOUBLE_GUIDE:
|
case DRAG_DOUBLE_GUIDE:
|
||||||
|
if (should_switch) {
|
||||||
|
c = CURSOR_BDIAGSIZE;
|
||||||
|
} else {
|
||||||
c = CURSOR_FDIAGSIZE;
|
c = CURSOR_FDIAGSIZE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DRAG_TOP_RIGHT:
|
case DRAG_TOP_RIGHT:
|
||||||
case DRAG_BOTTOM_LEFT:
|
case DRAG_BOTTOM_LEFT:
|
||||||
|
if (should_switch) {
|
||||||
|
c = CURSOR_FDIAGSIZE;
|
||||||
|
} else {
|
||||||
c = CURSOR_BDIAGSIZE;
|
c = CURSOR_BDIAGSIZE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DRAG_MOVE:
|
case DRAG_MOVE:
|
||||||
c = CURSOR_MOVE;
|
c = CURSOR_MOVE;
|
||||||
|
|
Loading…
Reference in a new issue