Merge pull request #58142 from jmb462/fix-animation-track-zoom-3.x
This commit is contained in:
commit
2f14ec6954
@ -1658,40 +1658,44 @@ void AnimationTimelineEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||
|
||||
const Ref<InputEventMouseButton> mb = p_event;
|
||||
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == BUTTON_WHEEL_UP) {
|
||||
get_zoom()->set_value(get_zoom()->get_value() * 1.05);
|
||||
if (mb.is_valid()) {
|
||||
if (mb->is_pressed() && mb->get_command() && (mb->get_button_index() == BUTTON_WHEEL_UP || mb->get_button_index() == BUTTON_WHEEL_DOWN)) {
|
||||
double new_zoom_value;
|
||||
double current_zoom_value = get_zoom()->get_value();
|
||||
int direction = mb->get_button_index() == BUTTON_WHEEL_UP ? 1 : -1;
|
||||
if (current_zoom_value <= 0.1) {
|
||||
new_zoom_value = MAX(0.01, current_zoom_value + 0.01 * direction);
|
||||
} else {
|
||||
new_zoom_value = direction < 0 ? MAX(0.01, current_zoom_value / 1.05) : current_zoom_value * 1.05;
|
||||
}
|
||||
get_zoom()->set_value(new_zoom_value);
|
||||
accept_event();
|
||||
}
|
||||
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
||||
get_zoom()->set_value(get_zoom()->get_value() / 1.05);
|
||||
accept_event();
|
||||
}
|
||||
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_alt() && mb->get_button_index() == BUTTON_WHEEL_UP) {
|
||||
if (mb->is_pressed() && mb->get_alt() && mb->get_button_index() == BUTTON_WHEEL_UP) {
|
||||
if (track_edit) {
|
||||
track_edit->get_editor()->goto_prev_step(true);
|
||||
}
|
||||
accept_event();
|
||||
}
|
||||
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_alt() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
||||
if (mb->is_pressed() && mb->get_alt() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
||||
if (track_edit) {
|
||||
track_edit->get_editor()->goto_next_step(true);
|
||||
}
|
||||
accept_event();
|
||||
}
|
||||
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && hsize_rect.has_point(mb->get_position())) {
|
||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && hsize_rect.has_point(mb->get_position())) {
|
||||
dragging_hsize = true;
|
||||
dragging_hsize_from = mb->get_position().x;
|
||||
dragging_hsize_at = name_limit;
|
||||
}
|
||||
|
||||
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && dragging_hsize) {
|
||||
if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && dragging_hsize) {
|
||||
dragging_hsize = false;
|
||||
}
|
||||
if (mb.is_valid() && mb->get_position().x > get_name_limit() && mb->get_position().x < (get_size().width - get_buttons_width())) {
|
||||
if (mb->get_position().x > get_name_limit() && mb->get_position().x < (get_size().width - get_buttons_width())) {
|
||||
if (!panning_timeline && mb->get_button_index() == BUTTON_LEFT) {
|
||||
int x = mb->get_position().x - get_name_limit();
|
||||
|
||||
@ -1707,14 +1711,14 @@ void AnimationTimelineEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
}
|
||||
|
||||
if (dragging_timeline && mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && !mb->is_pressed()) {
|
||||
if (dragging_timeline && mb->get_button_index() == BUTTON_LEFT && !mb->is_pressed()) {
|
||||
dragging_timeline = false;
|
||||
}
|
||||
|
||||
if (panning_timeline && mb.is_valid() && mb->get_button_index() == BUTTON_MIDDLE && !mb->is_pressed()) {
|
||||
if (panning_timeline && mb->get_button_index() == BUTTON_MIDDLE && !mb->is_pressed()) {
|
||||
panning_timeline = false;
|
||||
}
|
||||
|
||||
}
|
||||
Ref<InputEventMouseMotion> mm = p_event;
|
||||
|
||||
if (mm.is_valid()) {
|
||||
@ -5004,27 +5008,31 @@ void AnimationTrackEditor::_box_selection_draw() {
|
||||
void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
|
||||
Ref<InputEventMouseButton> mb = p_event;
|
||||
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == BUTTON_WHEEL_UP) {
|
||||
timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05);
|
||||
scroll->accept_event();
|
||||
if (mb.is_valid()) {
|
||||
if (mb->is_pressed() && mb->get_command() && (mb->get_button_index() == BUTTON_WHEEL_UP || mb->get_button_index() == BUTTON_WHEEL_DOWN)) {
|
||||
double new_zoom_value;
|
||||
double current_zoom_value = timeline->get_zoom()->get_value();
|
||||
int direction = mb->get_button_index() == BUTTON_WHEEL_UP ? 1 : -1;
|
||||
if (current_zoom_value <= 0.1) {
|
||||
new_zoom_value = MAX(0.01, current_zoom_value + 0.01 * direction);
|
||||
} else {
|
||||
new_zoom_value = direction < 0 ? MAX(0.01, current_zoom_value / 1.05) : current_zoom_value * 1.05;
|
||||
}
|
||||
timeline->get_zoom()->set_value(new_zoom_value);
|
||||
accept_event();
|
||||
}
|
||||
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
||||
timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05);
|
||||
scroll->accept_event();
|
||||
}
|
||||
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_alt() && mb->get_button_index() == BUTTON_WHEEL_UP) {
|
||||
if (mb->is_pressed() && mb->get_alt() && mb->get_button_index() == BUTTON_WHEEL_UP) {
|
||||
goto_prev_step(true);
|
||||
scroll->accept_event();
|
||||
}
|
||||
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_alt() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
||||
if (mb->is_pressed() && mb->get_alt() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
||||
goto_next_step(true);
|
||||
scroll->accept_event();
|
||||
}
|
||||
|
||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
|
||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
||||
if (mb->is_pressed()) {
|
||||
box_selecting = true;
|
||||
box_selecting_from = scroll->get_global_transform().xform(mb->get_position());
|
||||
@ -5049,6 +5057,7 @@ void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
|
||||
box_selecting = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ref<InputEventMouseMotion> mm = p_event;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user