diff --git a/other/TODO.txt b/other/TODO.txt index 79f8df0..0878795 100644 --- a/other/TODO.txt +++ b/other/TODO.txt @@ -23,6 +23,7 @@ Add theme caching Implement cursors in Stylesheet FIX: Window getting exponentially bigger when Desktop scale changes +FIX: Refreshing scroll when content extent changes diff --git a/other/build.nr b/other/build.nr index 523bd11..9527c05 100644 --- a/other/build.nr +++ b/other/build.nr @@ -1 +1 @@ -2070 +2071 diff --git a/src/ogfx/gui/widgets/Scrollbar.cpp b/src/ogfx/gui/widgets/Scrollbar.cpp index 6083db0..ed77725 100644 --- a/src/ogfx/gui/widgets/Scrollbar.cpp +++ b/src/ogfx/gui/widgets/Scrollbar.cpp @@ -323,7 +323,7 @@ namespace ogfx { if (isVScrollAllowed()) { - bool mouseInsideHScrollbar = m_hScrollbar.isMouseInsideThumb({ event.mouse->position_x, event.mouse->position_y }); + bool mouseInsideHScrollbar = m_hScrollbar.isMouseInsideThumb({ event.mouse->position_x, event.mouse->position_y }) && needsHScroll(); if (std::abs(event.mouse->scrollAmount.y) > 0 && !mouseInsideHScrollbar) { m_scrollVelocity.y += m_scrollSpeed * event.mouse->scrollAmount.y * m_scrollSpeedMultiplier; diff --git a/src/ogfx/gui/widgets/Widget.cpp b/src/ogfx/gui/widgets/Widget.cpp index 12abe69..5f65d94 100644 --- a/src/ogfx/gui/widgets/Widget.cpp +++ b/src/ogfx/gui/widgets/Widget.cpp @@ -110,6 +110,7 @@ namespace ogfx { if (!child || child->isInvalid()) continue; if (child->isIgnoreScrollAllowed()) continue; + if (!child->isVisible()) continue; Vec2 localPos = getPadding().getPosition() + child->getPosition() + child->getMargin().getPosition() + child->getContentBounds().getPosition(); maxX = std::max(maxX, localPos.x + child->getw() + child->getMargin().w); maxY = std::max(maxY, localPos.y + child->geth() + child->getMargin().h); @@ -230,10 +231,13 @@ namespace ogfx onDraw(gfx); // gfx.fillRect(getGlobalPureContentBounds(), { 0, 255, 0, 120 }); - gfx.pushClippingRect(getGlobalPureContentBounds(), true); + const bool needsContentClip = !m_rootChild; + if (needsContentClip) + gfx.pushClippingRect(getGlobalPureContentBounds(), true); if (hasChildren()) m_widgets.draw(gfx); - gfx.popClippingRect(); + if (needsContentClip) + gfx.popClippingRect(); if (m_showBorder) gfx.drawRoundRect({ getGlobalPosition(), getSize() }, m_borderColor, m_borderRadius, m_borderWidth); afterDraw(gfx);