mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Fix 2D Pan Tool
This commit is contained in:
@@ -81,7 +81,12 @@ bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mb->get_button_index() == MouseButton::MIDDLE || (enable_rmb && mb->get_button_index() == MouseButton::RIGHT) || (!simple_panning_enabled && mb->get_button_index() == MouseButton::LEFT && is_panning())) {
|
||||
bool is_drag_event = mb->get_button_index() == MouseButton::MIDDLE ||
|
||||
(enable_rmb && mb->get_button_index() == MouseButton::RIGHT) ||
|
||||
(!simple_panning_enabled && mb->get_button_index() == MouseButton::LEFT && is_panning()) ||
|
||||
(force_drag && mb->get_button_index() == MouseButton::LEFT);
|
||||
|
||||
if (is_drag_event) {
|
||||
if (mb->is_pressed()) {
|
||||
is_dragging = true;
|
||||
} else {
|
||||
@@ -166,6 +171,10 @@ bool ViewPanner::is_panning() const {
|
||||
return is_dragging || pan_key_pressed;
|
||||
}
|
||||
|
||||
void ViewPanner::set_force_drag(bool p_force) {
|
||||
force_drag = p_force;
|
||||
}
|
||||
|
||||
ViewPanner::ViewPanner() {
|
||||
Array inputs;
|
||||
inputs.append(InputEventKey::create_reference(Key::SPACE));
|
||||
|
||||
Reference in New Issue
Block a user