From 680aaa1bd55fd4f0162ba31ca47d7e5b3563f2a1 Mon Sep 17 00:00:00 2001 From: Hugues Ross Date: Thu, 16 Jan 2020 13:41:07 -0500 Subject: Make clipping of formspec elements more consistent (#9262) --- src/gui/guiFormSpecMenu.cpp | 11 ++++++++--- src/network/networkprotocol.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index 3c9e55d06..5ddfbc6d5 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -744,7 +744,8 @@ void GUIFormSpecMenu::parseImage(parserData* data, const std::string &element) gui::IGUIImage *e = Environment->addImage(rect, this, spec.fid, 0, true); e->setImage(texture); e->setScaleImage(true); - e->setNotClipped(true); + auto style = getStyleForElement("image", spec.fname); + e->setNotClipped(style.getBool(StyleSpec::NOCLIP, m_formspec_version < 3)); m_fields.push_back(spec); return; @@ -776,7 +777,8 @@ void GUIFormSpecMenu::parseImage(parserData* data, const std::string &element) ); gui::IGUIImage *e = Environment->addImage(texture, pos, true, this, spec.fid, 0); - e->setNotClipped(true); + auto style = getStyleForElement("image", spec.fname); + e->setNotClipped(style.getBool(StyleSpec::NOCLIP, m_formspec_version < 3)); m_fields.push_back(spec); return; @@ -824,6 +826,8 @@ void GUIFormSpecMenu::parseItemImage(parserData* data, const std::string &elemen GUIItemImage *e = new GUIItemImage(Environment, this, spec.fid, core::rect(pos, pos + geom), name, m_font, m_client); + auto style = getStyleForElement("item_image", spec.fname); + e->setNotClipped(style.getBool(StyleSpec::NOCLIP, false)); e->drop(); m_fields.push_back(spec); @@ -2110,7 +2114,8 @@ void GUIFormSpecMenu::parseBox(parserData* data, const std::string &element) GUIBox *e = new GUIBox(Environment, this, spec.fid, rect, tmp_color); - e->setNotClipped(true); + auto style = getStyleForElement("box", spec.fname); + e->setNotClipped(style.getBool(StyleSpec::NOCLIP, m_formspec_version < 3)); e->drop(); diff --git a/src/network/networkprotocol.h b/src/network/networkprotocol.h index a2be181fb..2ade030c4 100644 --- a/src/network/networkprotocol.h +++ b/src/network/networkprotocol.h @@ -232,6 +232,7 @@ with this program; if not, write to the Free Software Foundation, Inc., FORMSPEC VERSION 3: Formspec elements are drawn in the order of definition bgcolor[]: use 3 parameters (bgcolor, formspec (now an enum), fbgcolor) + box[] and image[] elements enable clipping by default */ #define FORMSPEC_API_VERSION 3 -- cgit v1.2.3