You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Allow overriding 2D editor cursor
This commit is contained in:
@@ -2802,6 +2802,11 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
|
||||
void CanvasItemEditor::_update_cursor() {
|
||||
if (cursor_shape_override != CURSOR_ARROW) {
|
||||
set_default_cursor_shape(cursor_shape_override);
|
||||
return;
|
||||
}
|
||||
|
||||
// Choose the correct default cursor.
|
||||
CursorShape c = CURSOR_ARROW;
|
||||
switch (tool) {
|
||||
@@ -2865,6 +2870,14 @@ void CanvasItemEditor::_update_lock_and_group_button() {
|
||||
ungroup_button->set_disabled(!has_canvas_item);
|
||||
}
|
||||
|
||||
void CanvasItemEditor::set_cursor_shape_override(CursorShape p_shape) {
|
||||
if (cursor_shape_override == p_shape) {
|
||||
return;
|
||||
}
|
||||
cursor_shape_override = p_shape;
|
||||
_update_cursor();
|
||||
}
|
||||
|
||||
Control::CursorShape CanvasItemEditor::get_cursor_shape(const Point2 &p_pos) const {
|
||||
// Compute an eventual rotation of the cursor
|
||||
const CursorShape rotation_array[4] = { CURSOR_HSIZE, CURSOR_BDIAGSIZE, CURSOR_VSIZE, CURSOR_FDIAGSIZE };
|
||||
|
||||
Reference in New Issue
Block a user