summaryrefslogtreecommitdiff
path: root/scene/gui/view_panner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/view_panner.cpp')
-rw-r--r--scene/gui/view_panner.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/scene/gui/view_panner.cpp b/scene/gui/view_panner.cpp
index 7476887877..71865b4864 100644
--- a/scene/gui/view_panner.cpp
+++ b/scene/gui/view_panner.cpp
@@ -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));