|
@@ -88,13 +88,16 @@ void ScrollContainer::_cancel_drag() {
|
|
|
|
|
|
void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
|
|
|
|
|
+ double prev_v_scroll = v_scroll->get_value();
|
|
|
+ double prev_h_scroll = h_scroll->get_value();
|
|
|
+
|
|
|
Ref<InputEventMouseButton> mb = p_gui_input;
|
|
|
|
|
|
if (mb.is_valid()) {
|
|
|
|
|
|
if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) {
|
|
|
// only horizontal is enabled, scroll horizontally
|
|
|
- if (h_scroll->is_visible() && !v_scroll->is_visible()) {
|
|
|
+ if (h_scroll->is_visible() && (!v_scroll->is_visible() || mb->get_shift())) {
|
|
|
h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() / 8 * mb->get_factor());
|
|
|
} else if (v_scroll->is_visible_in_tree()) {
|
|
|
v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() / 8 * mb->get_factor());
|
|
@@ -103,7 +106,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
|
|
|
|
|
if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) {
|
|
|
// only horizontal is enabled, scroll horizontally
|
|
|
- if (h_scroll->is_visible() && !v_scroll->is_visible()) {
|
|
|
+ if (h_scroll->is_visible() && (!v_scroll->is_visible() || mb->get_shift())) {
|
|
|
h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() / 8 * mb->get_factor());
|
|
|
} else if (v_scroll->is_visible()) {
|
|
|
v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() / 8 * mb->get_factor());
|
|
@@ -122,6 +125,9 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (v_scroll->get_value() != prev_v_scroll || h_scroll->get_value() != prev_h_scroll)
|
|
|
+ accept_event(); //accept event if scroll changed
|
|
|
+
|
|
|
if (!OS::get_singleton()->has_touchscreen_ui_hint())
|
|
|
return;
|
|
|
|
|
@@ -204,6 +210,9 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
|
|
v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * pan_gesture->get_delta().y / 8);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (v_scroll->get_value() != prev_v_scroll || h_scroll->get_value() != prev_h_scroll)
|
|
|
+ accept_event(); //accept event if scroll changed
|
|
|
}
|
|
|
|
|
|
void ScrollContainer::_update_scrollbar_position() {
|