summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-11-17 09:54:28 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-11-17 13:24:04 +0100
commitb062c2f3e61fc0b449c07c5ca2f1f6a956dfc41f (patch)
tree91356984fc18421a80f0f4390fddeffc1e324370 /sfx2
parent4ead38cad91f2d790369d959cc66cb8fc687588e (diff)
Take in-place widget scaling into account
This is relevant when the Math OLE object is scaled in parent document (e.g., using Position and Size dialog, disabling its size protection); then the in-place editing widget uses own map mode reverting the OLE scaling; without taking that into account, mouse clicks get misplaced. Change-Id: I961fa8f3993c1b7992857c9f18d79650d078a684 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142822 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/lokstarmathhelper.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/sfx2/source/view/lokstarmathhelper.cxx b/sfx2/source/view/lokstarmathhelper.cxx
index d9c559746ba2..5586068d88b7 100644
--- a/sfx2/source/view/lokstarmathhelper.cxx
+++ b/sfx2/source/view/lokstarmathhelper.cxx
@@ -170,6 +170,10 @@ bool LokStarMathHelper::postMouseEvent(int nType, int nX, int nY, int nCount, in
// 2. Adjust the position according to the scales
aMousePos
= Point(std::round(aMousePos.X() * fScaleX), std::round(aMousePos.Y() * fScaleY));
+ // 3. Take window own scaling into account (reverses the conversion done in
+ // SmGraphicWidget::MouseButtonDown, albeit incompletely - it does not handle
+ // GetFormulaDrawPos; hopefully, in lok/in-place case, it's always [ 0, 0 ]?)
+ aMousePos = pWindow->LogicToPixel(aMousePos);
LokMouseEventData aMouseEventData(
nType, aMousePos, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);