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 b90810ce8e
)
This commit is contained in:
parent
89bff17cd2
commit
dfb739aff0
|
@ -641,12 +641,21 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
|
||||||
Ref<InputEventPanGesture> pan_gesture = p_event;
|
Ref<InputEventPanGesture> pan_gesture = p_event;
|
||||||
if (pan_gesture.is_valid()) {
|
if (pan_gesture.is_valid()) {
|
||||||
|
|
||||||
if (pan_gesture->get_command() || pan_gesture->get_shift()) {
|
if (pan_gesture->get_alt() && (pan_gesture->get_command() || pan_gesture->get_shift())) {
|
||||||
const real_t delta = pan_gesture->get_delta().y;
|
const real_t delta = pan_gesture->get_delta().y * 0.5;
|
||||||
floor->set_value(floor->get_value() + SGN(delta));
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
accumulated_floor_delta = 0.0;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1247,6 +1256,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
||||||
|
|
||||||
selection.active = false;
|
selection.active = false;
|
||||||
updating = false;
|
updating = false;
|
||||||
|
accumulated_floor_delta = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GridMapEditor::~GridMapEditor() {
|
GridMapEditor::~GridMapEditor() {
|
||||||
|
|
|
@ -76,6 +76,7 @@ class GridMapEditor : public VBoxContainer {
|
||||||
Panel *panel;
|
Panel *panel;
|
||||||
MenuButton *options;
|
MenuButton *options;
|
||||||
SpinBox *floor;
|
SpinBox *floor;
|
||||||
|
double accumulated_floor_delta;
|
||||||
ToolButton *mode_thumbnail;
|
ToolButton *mode_thumbnail;
|
||||||
ToolButton *mode_list;
|
ToolButton *mode_list;
|
||||||
HBoxContainer *spatial_editor_hb;
|
HBoxContainer *spatial_editor_hb;
|
||||||
|
|
Loading…
Reference in New Issue