Fix that slow mouse wheel scroll has no zoom effect on 2D editor

* scroll_vec in ViewPanner::gui_input is multiplied by float factors, 
  so it should be a Vector2 rather than Vector2i
* Fixes #57423
This commit is contained in:
C.Even 2022-03-27 18:46:51 +08:00
parent 4263f02f28
commit 2080077c9c

View file

@ -37,7 +37,7 @@
bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect) { bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect) {
Ref<InputEventMouseButton> mb = p_event; Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid()) { if (mb.is_valid()) {
Vector2i scroll_vec = Vector2((mb->get_button_index() == MouseButton::WHEEL_RIGHT) - (mb->get_button_index() == MouseButton::WHEEL_LEFT), (mb->get_button_index() == MouseButton::WHEEL_DOWN) - (mb->get_button_index() == MouseButton::WHEEL_UP)); Vector2 scroll_vec = Vector2((mb->get_button_index() == MouseButton::WHEEL_RIGHT) - (mb->get_button_index() == MouseButton::WHEEL_LEFT), (mb->get_button_index() == MouseButton::WHEEL_DOWN) - (mb->get_button_index() == MouseButton::WHEEL_UP));
if (scroll_vec != Vector2()) { if (scroll_vec != Vector2()) {
if (control_scheme == SCROLL_PANS) { if (control_scheme == SCROLL_PANS) {
if (mb->is_ctrl_pressed()) { if (mb->is_ctrl_pressed()) {