Make hypertext and textarea have proper scroll event propagation. (#10860)

master
Vincent Robinson 2021-01-23 14:48:57 -08:00 committed by GitHub
parent 6417f4d314
commit 6a55c03dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -220,6 +220,8 @@ local scroll_fs =
"tooltip[0,11;3,2;Buz;#f00;#000]".. "tooltip[0,11;3,2;Buz;#f00;#000]"..
"box[0,11;3,2;#00ff00]".. "box[0,11;3,2;#00ff00]"..
"hypertext[3,13;3,3;;" .. hypertext_basic .. "]" .. "hypertext[3,13;3,3;;" .. hypertext_basic .. "]" ..
"hypertext[3,17;3,3;;Hypertext with no scrollbar\\; the scroll container should scroll.]" ..
"textarea[3,21;3,1;textarea;;More scroll within scroll]" ..
"container[0,18]".. "container[0,18]"..
"box[1,2;3,2;#0a0a]".. "box[1,2;3,2;#0a0a]"..
"scroll_container[1,2;3,2;scrbar2;horizontal;0.06]".. "scroll_container[1,2;3,2;scrbar2;horizontal;0.06]"..

View File

@ -787,6 +787,7 @@ bool GUIEditBox::processMouse(const SEvent &event)
s32 pos = m_vscrollbar->getPos(); s32 pos = m_vscrollbar->getPos();
s32 step = m_vscrollbar->getSmallStep(); s32 step = m_vscrollbar->getSmallStep();
m_vscrollbar->setPos(pos - event.MouseInput.Wheel * step); m_vscrollbar->setPos(pos - event.MouseInput.Wheel * step);
return true;
} }
break; break;
default: default:

View File

@ -1088,7 +1088,7 @@ bool GUIHyperText::OnEvent(const SEvent &event)
if (event.MouseInput.Event == EMIE_MOUSE_MOVED) if (event.MouseInput.Event == EMIE_MOUSE_MOVED)
checkHover(event.MouseInput.X, event.MouseInput.Y); checkHover(event.MouseInput.X, event.MouseInput.Y);
if (event.MouseInput.Event == EMIE_MOUSE_WHEEL) { if (event.MouseInput.Event == EMIE_MOUSE_WHEEL && m_vscrollbar->isVisible()) {
m_vscrollbar->setPos(m_vscrollbar->getPos() - m_vscrollbar->setPos(m_vscrollbar->getPos() -
event.MouseInput.Wheel * m_vscrollbar->getSmallStep()); event.MouseInput.Wheel * m_vscrollbar->getSmallStep());
m_text_scrollpos.Y = -m_vscrollbar->getPos(); m_text_scrollpos.Y = -m_vscrollbar->getPos();