Skip to content

Commit 6a55c03

Browse files
authored
Make hypertext and textarea have proper scroll event propagation. (#10860)
1 parent 6417f4d commit 6a55c03

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

games/devtest/mods/testformspec/formspec.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ local scroll_fs =
220220
"tooltip[0,11;3,2;Buz;#f00;#000]"..
221221
"box[0,11;3,2;#00ff00]"..
222222
"hypertext[3,13;3,3;;" .. hypertext_basic .. "]" ..
223+
"hypertext[3,17;3,3;;Hypertext with no scrollbar\\; the scroll container should scroll.]" ..
224+
"textarea[3,21;3,1;textarea;;More scroll within scroll]" ..
223225
"container[0,18]"..
224226
"box[1,2;3,2;#0a0a]"..
225227
"scroll_container[1,2;3,2;scrbar2;horizontal;0.06]"..

src/gui/guiEditBox.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,7 @@ bool GUIEditBox::processMouse(const SEvent &event)
787787
s32 pos = m_vscrollbar->getPos();
788788
s32 step = m_vscrollbar->getSmallStep();
789789
m_vscrollbar->setPos(pos - event.MouseInput.Wheel * step);
790+
return true;
790791
}
791792
break;
792793
default:

src/gui/guiHyperText.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ bool GUIHyperText::OnEvent(const SEvent &event)
10881088
if (event.MouseInput.Event == EMIE_MOUSE_MOVED)
10891089
checkHover(event.MouseInput.X, event.MouseInput.Y);
10901090

1091-
if (event.MouseInput.Event == EMIE_MOUSE_WHEEL) {
1091+
if (event.MouseInput.Event == EMIE_MOUSE_WHEEL && m_vscrollbar->isVisible()) {
10921092
m_vscrollbar->setPos(m_vscrollbar->getPos() -
10931093
event.MouseInput.Wheel * m_vscrollbar->getSmallStep());
10941094
m_text_scrollpos.Y = -m_vscrollbar->getPos();

0 commit comments

Comments
 (0)