Skip to content
Permalink
Browse files

Avoid drawing clipped out formspec elements (#10095)

  • Loading branch information
EvidenceBKidscode committed Aug 23, 2020
1 parent 3c28906 commit 287f3fb2e3317bb6bd6d8608f1aa051c601aeca4
Showing with 21 additions and 3 deletions.
  1. +7 −3 src/gui/guiFormSpecMenu.cpp
  2. +12 −0 src/gui/guiScrollContainer.cpp
  3. +2 −0 src/gui/guiScrollContainer.h
@@ -3483,10 +3483,14 @@ void GUIFormSpecMenu::drawMenu()
e->setVisible(true);

/*
Call base class
(This is where all the drawing happens.)
This is where all the drawing happens.
*/
gui::IGUIElement::draw();
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
if ((*it)->isNotClipped() ||
AbsoluteClippingRect.isRectCollided(
(*it)->getAbsolutePosition()))
(*it)->draw();

for (gui::IGUIElement *e : m_clickthrough_elements)
e->setVisible(false);
@@ -56,6 +56,18 @@ bool GUIScrollContainer::OnEvent(const SEvent &event)
return IGUIElement::OnEvent(event);
}

void GUIScrollContainer::draw()
{
if (isVisible()) {
core::list<IGUIElement *>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
if ((*it)->isNotClipped() ||
AbsoluteClippingRect.isRectCollided(
(*it)->getAbsolutePosition()))
(*it)->draw();
}
}

void GUIScrollContainer::updateScrolling()
{
s32 pos = m_scrollbar->getPos();
@@ -32,6 +32,8 @@ class GUIScrollContainer : public gui::IGUIElement

virtual bool OnEvent(const SEvent &event) override;

virtual void draw() override;

inline void onScrollEvent(gui::IGUIElement *caller)
{
if (caller == m_scrollbar)

0 comments on commit 287f3fb

Please sign in to comment.
You can’t perform that action at this time.