summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Lima <rafael.palma.lima@gmail.com>2024-09-08 14:32:32 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2024-09-09 11:58:54 +0200
commit4bbc45eb48f91a552a9583b6aad4d59b2dac96f8 (patch)
tree99383760bdfa930534372a030880cb1f290662c4
parent23e9fe3b8f71f7d47b0e4a132252efb91cac9e6d (diff)
tdf#162852 Fix minimum comment sidebar width
If the mouse is released over the document, the value of nPxWidth can get negative, so we need a signed integer variable here to make std::clamp work as expected. Change-Id: I721b53e9eddee4f02ad31718f8c7187242ba44e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173016 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit 005eaf799a1e5424751d059afc09c92ea9b29566) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173021
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index d68fc77c4940..29697f5742ae 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -2204,7 +2204,7 @@ bool SwPostItMgr::HasNotes() const
void SwPostItMgr::SetSidebarWidth(Point aMousePos)
{
sal_uInt16 nZoom = mpWrtShell->GetViewOptions()->GetZoom();
- sal_uInt16 nPxWidth
+ tools::Long nPxWidth
= aMousePos.X() - mpEditWin->LogicToPixel(GetSidebarRect(aMousePos).TopLeft()).X();
double nFactor = static_cast<double>(nPxWidth) / static_cast<double>(nZoom);
nFactor = std::clamp(nFactor, 1.0, 8.0);