sfx2/source/view/lokstarmathhelper.cxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit b062c2f3e61fc0b449c07c5ca2f1f6a956dfc41f
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Nov 17 09:54:28 2022 +0300
Commit:     Mike Kaganski <[email protected]>
CommitDate: Thu Nov 17 13:24:04 2022 +0100

    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 <[email protected]>

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);

Reply via email to