diff options
| author | poke1024 | 2018-02-28 18:51:30 +0100 |
|---|---|---|
| committer | Hein-Pieter van Braam | 2018-03-28 21:11:38 +0200 |
| commit | dfb739aff0d46c40c0be2e9c7bbb7d0e4f5c9052 (patch) | |
| tree | 2ad994e9476eebd24f1c092e583c7d1c58ef8c3f /modules | |
| parent | 89bff17cd2e5c199198adfaa09cf6bf08336c67c (diff) | |
| download | godot-dfb739aff0d46c40c0be2e9c7bbb7d0e4f5c9052.tar.gz godot-dfb739aff0d46c40c0be2e9c7bbb7d0e4f5c9052.tar.zst godot-dfb739aff0d46c40c0be2e9c7bbb7d0e4f5c9052.zip | |
Fix grid mesh tile panning bug (issue 16524)
Fix basic function and interference of touch pad pan with mesh tile delete (shift + right click on touch pad) in grid map editor (fix 16524)
(cherry picked from commit b90810ce8eec07b4333074c9217a242b129f8d27)
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/gridmap/grid_map_editor_plugin.cpp | 16 | ||||
| -rw-r--r-- | modules/gridmap/grid_map_editor_plugin.h | 1 |
2 files changed, 14 insertions, 3 deletions
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index a2f48940c..a1951e088 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -641,12 +641,21 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu Ref<InputEventPanGesture> pan_gesture = p_event; if (pan_gesture.is_valid()) { - if (pan_gesture->get_command() || pan_gesture->get_shift()) { - const real_t delta = pan_gesture->get_delta().y; - floor->set_value(floor->get_value() + SGN(delta)); + if (pan_gesture->get_alt() && (pan_gesture->get_command() || pan_gesture->get_shift())) { + const real_t delta = pan_gesture->get_delta().y * 0.5; + accumulated_floor_delta += delta; + int step = 0; + if (ABS(accumulated_floor_delta) > 1.0) { + step = SGN(accumulated_floor_delta); + accumulated_floor_delta -= step; + } + if (step) { + floor->set_value(floor->get_value() + step); + } return true; } } + accumulated_floor_delta = 0.0; return false; } @@ -1247,6 +1256,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { selection.active = false; updating = false; + accumulated_floor_delta = 0.0; } GridMapEditor::~GridMapEditor() { diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h index 965177052..f79d9aefa 100644 --- a/modules/gridmap/grid_map_editor_plugin.h +++ b/modules/gridmap/grid_map_editor_plugin.h @@ -76,6 +76,7 @@ class GridMapEditor : public VBoxContainer { Panel *panel; MenuButton *options; SpinBox *floor; + double accumulated_floor_delta; ToolButton *mode_thumbnail; ToolButton *mode_list; HBoxContainer *spatial_editor_hb; |
