Merge pull request #59016 from Sauermann/fix-cursorshape-animationtimelineedit
This commit is contained in:
commit
1e099afc8a
2 changed files with 11 additions and 7 deletions
|
@ -1814,13 +1814,6 @@ void AnimationTimelineEdit::gui_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseMotion> mm = p_event;
|
Ref<InputEventMouseMotion> mm = p_event;
|
||||||
|
|
||||||
if (mm.is_valid()) {
|
if (mm.is_valid()) {
|
||||||
if (hsize_rect.has_point(mm->get_position())) {
|
|
||||||
// Change the cursor to indicate that the track name column's width can be adjusted
|
|
||||||
set_default_cursor_shape(Control::CURSOR_HSIZE);
|
|
||||||
} else {
|
|
||||||
set_default_cursor_shape(Control::CURSOR_ARROW);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dragging_hsize) {
|
if (dragging_hsize) {
|
||||||
int ofs = mm->get_position().x - dragging_hsize_from;
|
int ofs = mm->get_position().x - dragging_hsize_from;
|
||||||
name_limit = dragging_hsize_at + ofs;
|
name_limit = dragging_hsize_at + ofs;
|
||||||
|
@ -1836,6 +1829,15 @@ void AnimationTimelineEdit::gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Control::CursorShape AnimationTimelineEdit::get_cursor_shape(const Point2 &p_pos) const {
|
||||||
|
if (dragging_hsize || hsize_rect.has_point(p_pos)) {
|
||||||
|
// Indicate that the track name column's width can be adjusted
|
||||||
|
return Control::CURSOR_HSIZE;
|
||||||
|
} else {
|
||||||
|
return get_default_cursor_shape();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AnimationTimelineEdit::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
|
void AnimationTimelineEdit::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
|
||||||
// Timeline has no vertical scroll, so we change it to horizontal.
|
// Timeline has no vertical scroll, so we change it to horizontal.
|
||||||
p_scroll_vec.x += p_scroll_vec.y;
|
p_scroll_vec.x += p_scroll_vec.y;
|
||||||
|
|
|
@ -121,6 +121,8 @@ public:
|
||||||
|
|
||||||
void set_hscroll(HScrollBar *p_hscroll);
|
void set_hscroll(HScrollBar *p_hscroll);
|
||||||
|
|
||||||
|
virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override;
|
||||||
|
|
||||||
AnimationTimelineEdit();
|
AnimationTimelineEdit();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue