Use get_cursor_shape for identifying the cursor shape in AnimationTrackEditTypeAudio
get_cursor_shape() is used in cases where a Control displays different cursors in different areas. There is no need to set the default cursor shape on every mouse move event.
This commit is contained in:
@ -1080,12 +1080,7 @@ void AnimationTrackEditTypeAudio::gui_input(const Ref<InputEvent> &p_event) {
|
||||
len_resizing_index = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (use_hsize_cursor) {
|
||||
set_default_cursor_shape(CURSOR_HSIZE);
|
||||
} else {
|
||||
set_default_cursor_shape(CURSOR_ARROW);
|
||||
}
|
||||
over_drag_position = use_hsize_cursor;
|
||||
}
|
||||
|
||||
if (len_resizing && mm.is_valid()) {
|
||||
@ -1097,7 +1092,7 @@ void AnimationTrackEditTypeAudio::gui_input(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
|
||||
Ref<InputEventMouseButton> mb = p_event;
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && get_default_cursor_shape() == CURSOR_HSIZE) {
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && over_drag_position) {
|
||||
len_resizing = true;
|
||||
len_resizing_start = mb->is_shift_pressed();
|
||||
len_resizing_from_px = mb->get_position().x;
|
||||
@ -1134,6 +1129,14 @@ void AnimationTrackEditTypeAudio::gui_input(const Ref<InputEvent> &p_event) {
|
||||
AnimationTrackEdit::gui_input(p_event);
|
||||
}
|
||||
|
||||
Control::CursorShape AnimationTrackEditTypeAudio::get_cursor_shape(const Point2 &p_pos) const {
|
||||
if (over_drag_position || len_resizing) {
|
||||
return Control::CURSOR_HSIZE;
|
||||
} else {
|
||||
return get_default_cursor_shape();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
/// SUB ANIMATION ///
|
||||
|
||||
|
||||
Reference in New Issue
Block a user