Fixed: HTML list element invalidates content on each frame

--HG--
branch : develop
This commit is contained in:
Nimetu 2018-08-26 22:58:48 +03:00
parent 1d8396bef0
commit ea95d8e091
7 changed files with 35 additions and 11 deletions

View file

@ -182,6 +182,9 @@ namespace NLGUI
void setMarginLeft(sint32 m) { _MarginLeft = m; } void setMarginLeft(sint32 m) { _MarginLeft = m; }
sint32 getMarginLeft() const { return _MarginLeft; } sint32 getMarginLeft() const { return _MarginLeft; }
// Return inner width for child elements
virtual sint32 getInnerWidth() const;
/** /**
* Get the max width used by the window. * Get the max width used by the window.
* *

View file

@ -164,6 +164,7 @@ namespace NLGUI
sint32 getMaxH () const { return _MaxH; } sint32 getMaxH () const { return _MaxH; }
sint32 getMaxWReal () const { return _Active ? _MaxWReal : 0; } sint32 getMaxWReal () const { return _Active ? _MaxWReal : 0; }
sint32 getMaxHReal () const { return _Active ? _MaxHReal : 0; } sint32 getMaxHReal () const { return _Active ? _MaxHReal : 0; }
sint32 getInnerWidth () const;
sint32 getOfsX () const { return _OffsetX; } sint32 getOfsX () const { return _OffsetX; }
sint32 getOfsY () const { return _OffsetY; } sint32 getOfsY () const { return _OffsetY; }
bool getResizeFromChildW() const { return _ResizeFromChildW; } bool getResizeFromChildW() const { return _ResizeFromChildW; }

View file

@ -1410,7 +1410,7 @@ namespace NLGUI
// Get the child width // Get the child width
maxWidth += _Elements[k].Element->getMaxUsedW(); maxWidth += _Elements[k].Element->getMaxUsedW();
} }
return maxWidth; return maxWidth + _MarginLeft;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -1425,7 +1425,7 @@ namespace NLGUI
if (width > minWidth) if (width > minWidth)
minWidth = width; minWidth = width;
} }
return minWidth; return minWidth + _MarginLeft;
} }

View file

@ -703,7 +703,7 @@ namespace NLGUI
{ {
if (ContinuousUpdate) if (ContinuousUpdate)
{ {
sint parentWidth = std::min(_Parent->getMaxWReal(), _Parent->getWReal()); sint parentWidth = _Parent->getInnerWidth();
if (_LastParentW != (sint) parentWidth) if (_LastParentW != (sint) parentWidth)
{ {
_LastParentW = parentWidth; _LastParentW = parentWidth;
@ -1163,7 +1163,7 @@ namespace NLGUI
{ {
if (_Parent != NULL) if (_Parent != NULL)
{ {
sint parentWidth = std::min(_Parent->getMaxWReal(), _Parent->getWReal()); sint parentWidth = _Parent->getInnerWidth();
if (_LastParentW != (sint) parentWidth) if (_LastParentW != (sint) parentWidth)
{ {
if (ContinuousUpdate) if (ContinuousUpdate)
@ -1311,6 +1311,9 @@ namespace NLGUI
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CGroupTable::draw () void CGroupTable::draw ()
{ {
// move X for clip and borders
_XReal += _MarginLeft;
// search a parent container // search a parent container
CInterfaceGroup *gr = getParent(); CInterfaceGroup *gr = getParent();
while (gr) while (gr)
@ -1391,6 +1394,9 @@ namespace NLGUI
} }
CInterfaceGroup::draw (); CInterfaceGroup::draw ();
// restore
_XReal -= _MarginLeft;
} }
std::string CGroupTable::getProperties( const std::string &name ) const std::string CGroupTable::getProperties( const std::string &name ) const

View file

@ -506,10 +506,16 @@ namespace NLGUI
} }
} }
// ------------------------------------------------------------------------------------------------
sint32 CInterfaceElement::getInnerWidth() const
{
return _WReal - _MarginLeft;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceElement::updateCoords() void CInterfaceElement::updateCoords()
{ {
_XReal = _X + _MarginLeft; _XReal = _X;
_YReal = _Y; _YReal = _Y;
_WReal = getW(); _WReal = getW();
_HReal = getH(); _HReal = getH();
@ -526,7 +532,7 @@ namespace NLGUI
if (el == NULL) if (el == NULL)
return; return;
_XReal += el->_XReal - el->_MarginLeft; _XReal += el->_XReal;
_YReal += el->_YReal; _YReal += el->_YReal;
THotSpot hsParent = _ParentPosRef; THotSpot hsParent = _ParentPosRef;

View file

@ -1397,6 +1397,13 @@ namespace NLGUI
restoreClip (oldSciX, oldSciY, oldSciW, oldSciH); restoreClip (oldSciX, oldSciY, oldSciW, oldSciH);
} }
// ------------------------------------------------------------------------------------------------
sint32 CInterfaceGroup::getInnerWidth() const
{
sint width = CInterfaceElement::getInnerWidth();
return std::min(width, _MaxWReal - _MarginLeft);
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceGroup::checkCoords() void CInterfaceGroup::checkCoords()
{ {
@ -1468,7 +1475,7 @@ namespace NLGUI
pIE->updateCoords(); pIE->updateCoords();
} }
_XReal -= _OffsetX - _MarginLeft; _XReal -= (_OffsetX + _MarginLeft);
_YReal -= _OffsetY; _YReal -= _OffsetY;
} }
@ -1958,9 +1965,11 @@ namespace NLGUI
newSciH = newSciH - ((newSciY+newSciH)-(oldSciY+oldSciH)); newSciH = newSciH - ((newSciY+newSciH)-(oldSciY+oldSciH));
} }
newSciXDest = newSciX - _MarginLeft; // Don't apply margins because HTML list marker is drawn outside group paragraph inner content.
// Should not be an issue because horizontal scolling not used.
newSciXDest = newSciX/* + _MarginLeft*/;
newSciYDest = newSciY; newSciYDest = newSciY;
newSciWDest = newSciW + _MarginLeft; newSciWDest = newSciW/* - _MarginLeft*/;
newSciHDest = newSciH; newSciHDest = newSciH;
} }

View file

@ -916,8 +916,7 @@ namespace NLGUI
return _LineMaxW; return _LineMaxW;
else else
{ {
sint parentWidth = std::min(_Parent->getMaxWReal(), _Parent->getWReal() - _Parent->getMarginLeft()); return std::min(_Parent->getInnerWidth(), (sint)_LineMaxW);
return std::min(parentWidth-(sint)(_XReal-(_Parent->getXReal()-_Parent->getMarginLeft())), (sint)_LineMaxW);
} }
} }