Skip to content

Commit

Permalink
Make hypertext and textarea have proper scroll event propagation. (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
v-rob committed Jan 23, 2021
1 parent 6417f4d commit 6a55c03
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions games/devtest/mods/testformspec/formspec.lua
Expand Up @@ -220,6 +220,8 @@ local scroll_fs =
"tooltip[0,11;3,2;Buz;#f00;#000]"..
"box[0,11;3,2;#00ff00]"..
"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]"..
"box[1,2;3,2;#0a0a]"..
"scroll_container[1,2;3,2;scrbar2;horizontal;0.06]"..
Expand Down
1 change: 1 addition & 0 deletions src/gui/guiEditBox.cpp
Expand Up @@ -787,6 +787,7 @@ bool GUIEditBox::processMouse(const SEvent &event)
s32 pos = m_vscrollbar->getPos();
s32 step = m_vscrollbar->getSmallStep();
m_vscrollbar->setPos(pos - event.MouseInput.Wheel * step);
return true;
}
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/gui/guiHyperText.cpp
Expand Up @@ -1088,7 +1088,7 @@ bool GUIHyperText::OnEvent(const SEvent &event)
if (event.MouseInput.Event == EMIE_MOUSE_MOVED)
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() -
event.MouseInput.Wheel * m_vscrollbar->getSmallStep());
m_text_scrollpos.Y = -m_vscrollbar->getPos();
Expand Down

0 comments on commit 6a55c03

Please sign in to comment.