scroll thumb safety

avoid divnull
This commit is contained in:
AzaezelX 2025-11-20 20:56:18 -06:00
parent 9ec752b646
commit 75883f74cf

View file

@ -800,7 +800,7 @@ void GuiScrollCtrl::onMouseDragged(const GuiEvent &event)
{ {
S32 newVPos = (newVThumbPos - mVTrackRect.point.y) * S32 newVPos = (newVThumbPos - mVTrackRect.point.y) *
(mChildExt.y - mContentExt.y) / (mChildExt.y - mContentExt.y) /
(mVTrackRect.extent.y - mVThumbSize); getMax(mVTrackRect.extent.y - mVThumbSize,1);
scrollTo(mChildRelPosAnchor.x, newVPos); scrollTo(mChildRelPosAnchor.x, newVPos);
} }
@ -820,7 +820,7 @@ void GuiScrollCtrl::onMouseDragged(const GuiEvent &event)
{ {
S32 newHPos = (newHThumbPos - mHTrackRect.point.x) * S32 newHPos = (newHThumbPos - mHTrackRect.point.x) *
(mChildExt.x - mContentExt.x) / (mChildExt.x - mContentExt.x) /
(mHTrackRect.extent.x - mHThumbSize); getMax(mHTrackRect.extent.x - mHThumbSize,1);
scrollTo(newHPos, mChildRelPosAnchor.y); scrollTo(newHPos, mChildRelPosAnchor.y);
} }