From 04bb404bffa9fe19568655e81bcd5db21f153cbc Mon Sep 17 00:00:00 2001 From: Dennis Francis Date: Thu, 6 Jan 2022 14:52:56 +0530 Subject: 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 --- sc/source/ui/unoobj/docuno.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index f18793734baf..86bd13cb5a16 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1028,7 +1028,11 @@ void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int const Fraction newZoomX(nTilePixelWidth_ * TWIPS_PER_PIXEL, nTileTwipWidth_); const Fraction newZoomY(nTilePixelHeight_ * TWIPS_PER_PIXEL, nTileTwipHeight_); - if (pViewData->GetZoomX() == newZoomX && pViewData->GetZoomY() == newZoomY) + double fDeltaPPTX = std::abs(ScGlobal::nScreenPPTX * static_cast(newZoomX) - pViewData->GetPPTX()); + double fDeltaPPTY = std::abs(ScGlobal::nScreenPPTY * static_cast(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); -- cgit