mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
Avoid drawing clipped out formspec elements (#10095)
This commit is contained in:
@@ -3483,10 +3483,14 @@ void GUIFormSpecMenu::drawMenu()
|
|||||||
e->setVisible(true);
|
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)
|
for (gui::IGUIElement *e : m_clickthrough_elements)
|
||||||
e->setVisible(false);
|
e->setVisible(false);
|
||||||
|
@@ -56,6 +56,18 @@ bool GUIScrollContainer::OnEvent(const SEvent &event)
|
|||||||
return IGUIElement::OnEvent(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()
|
void GUIScrollContainer::updateScrolling()
|
||||||
{
|
{
|
||||||
s32 pos = m_scrollbar->getPos();
|
s32 pos = m_scrollbar->getPos();
|
||||||
|
@@ -32,6 +32,8 @@ public:
|
|||||||
|
|
||||||
virtual bool OnEvent(const SEvent &event) override;
|
virtual bool OnEvent(const SEvent &event) override;
|
||||||
|
|
||||||
|
virtual void draw() override;
|
||||||
|
|
||||||
inline void onScrollEvent(gui::IGUIElement *caller)
|
inline void onScrollEvent(gui::IGUIElement *caller)
|
||||||
{
|
{
|
||||||
if (caller == m_scrollbar)
|
if (caller == m_scrollbar)
|
||||||
|
Reference in New Issue
Block a user