Scroll horizontally with mouse wheel when horizontal enabled only
(cherry picked from commit 22b76511fb
)
This commit is contained in:
parent
1397019424
commit
d5e4011bc3
1 changed files with 14 additions and 6 deletions
|
@ -88,15 +88,23 @@ void ScrollContainer::_input_event(const InputEvent& p_input_event) {
|
||||||
|
|
||||||
const InputEventMouseButton &mb=p_input_event.mouse_button;
|
const InputEventMouseButton &mb=p_input_event.mouse_button;
|
||||||
|
|
||||||
if (mb.button_index==BUTTON_WHEEL_UP && mb.pressed && v_scroll->is_visible()) {
|
if (mb.button_index==BUTTON_WHEEL_UP && mb.pressed) {
|
||||||
|
if (h_scroll->is_visible() && !v_scroll->is_visible()){
|
||||||
|
// only horizontal is enabled, scroll horizontally
|
||||||
|
h_scroll->set_val( h_scroll->get_val()-h_scroll->get_page()/8 );
|
||||||
|
} else if (v_scroll->is_visible()) {
|
||||||
v_scroll->set_val( v_scroll->get_val()-v_scroll->get_page()/8 );
|
v_scroll->set_val( v_scroll->get_val()-v_scroll->get_page()/8 );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mb.button_index==BUTTON_WHEEL_DOWN && mb.pressed && v_scroll->is_visible()) {
|
if (mb.button_index==BUTTON_WHEEL_DOWN && mb.pressed) {
|
||||||
|
if (h_scroll->is_visible() && !v_scroll->is_visible()){
|
||||||
|
// only horizontal is enabled, scroll horizontally
|
||||||
|
h_scroll->set_val( h_scroll->get_val()+h_scroll->get_page()/8 );
|
||||||
|
} else if (v_scroll->is_visible()) {
|
||||||
v_scroll->set_val( v_scroll->get_val()+v_scroll->get_page()/8 );
|
v_scroll->set_val( v_scroll->get_val()+v_scroll->get_page()/8 );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!OS::get_singleton()->has_touchscreen_ui_hint())
|
if(!OS::get_singleton()->has_touchscreen_ui_hint())
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue