sc/source/ui/unoobj/docuno.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 368ae1026db78478b54cb4dc4e06475ce29a3a55
Author:     Dennis Francis <[email protected]>
AuthorDate: Thu Jan 6 14:52:56 2022 +0530
Commit:     Dennis Francis <[email protected]>
CommitDate: Sat Feb 5 08:03:02 2022 +0100

    lok: setClientZoom: check PPTX/Y approx equality too
    
    This is needed because the initial PPTX/Y on document load does not
    match the implied PPTX/Y corresponding to the client requested zoomX/Y.
    
    For instance when document is loaded by LOK client and 100% zoom is
    requested, the correct PPTX/Y should be (1/15 = 0.0666667) but the
    initial PPTX/Y on the ScViewData is 0.0647702
    
    Change-Id: I996e9f003abd269df0994f3d114e42f84bb2bb20
    (cherry picked from commit 04bb404bffa9fe19568655e81bcd5db21f153cbc)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129363
    Tested-by: Jenkins
    Reviewed-by: Dennis Francis <[email protected]>

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 177a38ca07ad..2c739b909fb2 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -997,7 +997,11 @@ void ScModelObj::setClientZoom(int nTilePixelWidth_, int 
nTilePixelHeight_, int
     const Fraction newZoomX(o3tl::toTwips(nTilePixelWidth_, o3tl::Length::px), 
nTileTwipWidth_);
     const Fraction newZoomY(o3tl::toTwips(nTilePixelHeight_, 
o3tl::Length::px), nTileTwipHeight_);
 
-    if (pViewData->GetZoomX() == newZoomX && pViewData->GetZoomY() == newZoomY)
+    double fDeltaPPTX = std::abs(ScGlobal::nScreenPPTX * 
static_cast<double>(newZoomX) - pViewData->GetPPTX());
+    double fDeltaPPTY = std::abs(ScGlobal::nScreenPPTY * 
static_cast<double>(newZoomY) - pViewData->GetPPTY());
+    constexpr double fEps = 1E-08;
+
+    if (pViewData->GetZoomX() == newZoomX && pViewData->GetZoomY() == newZoomY 
&& fDeltaPPTX < fEps && fDeltaPPTY < fEps)
         return;
 
     pViewData->SetZoom(newZoomX, newZoomY, true);

Reply via email to