summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2022-01-06 14:52:56 +0530
committerAndras Timar <andras.timar@collabora.com>2022-01-11 11:18:10 +0100
commit04bb404bffa9fe19568655e81bcd5db21f153cbc (patch)
tree61570d95bd1893c04075d01c4f2adb93db4a58eb
parentlokCalcRTL: fix rendering of charts in edit mode (diff)
downloadcore-04bb404bffa9fe19568655e81bcd5db21f153cbc.tar.gz
core-04bb404bffa9fe19568655e81bcd5db21f153cbc.zip
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
-rw-r--r--sc/source/ui/unoobj/docuno.cxx6
1 files changed, 5 insertions, 1 deletions
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<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);