diff options
author | Jim Raykowski <raykowj@gmail.com> | 2021-03-27 12:42:06 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2021-03-30 00:37:04 +0200 |
commit | e511a32b70119a1a7ccc762ffbf0d814cf603a2b (patch) | |
tree | a34b125ce765f8326ca32274366ebfa9d8dc96c1 /sw/source/uibase | |
parent | 381b9160aa21b91c7f2501de21d6d16626a972fb (diff) |
Outline folding: only hide the fold button when needed
Current behavior is to always hide the fold button on mouse leave which
is usually followed by a delayed showing of the same button. This patch
prevents this hide show by only hiding the button when the button mouse
leave results in leaving the area of the frame the button controls.
Change-Id: Iecb544bfeffb32ac4ba7183719a193a96162c7c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113243
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx index 3a8284fd4398..e866ac0549be 100644 --- a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx +++ b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx @@ -249,10 +249,18 @@ IMPL_LINK(SwOutlineContentVisibilityWin, MouseMoveHdl, const MouseEvent&, rMEvt, { if (rMEvt.IsLeaveWindow()) { - // MouseMove event may not be seen by edit window - // hide collapse button and grab focus to document if (GetSymbol() != ButtonSymbol::SHOW) - Hide(); + { + // MouseMove event may not be seen by the edit window for example when move is to + // a show button or when move is outside of the edit window. + // Only hide when mouse leave results in leaving the frame. + tools::Rectangle aFrameAreaPxRect + = GetEditWin()->LogicToPixel(GetFrame()->getFrameArea().SVRect()); + auto nY = GetPosPixel().getY() + rMEvt.GetPosPixel().getY(); + if (nY <= 0 || nY <= aFrameAreaPxRect.Top() || nY >= aFrameAreaPxRect.Bottom() + || nY >= GetEditWin()->GetSizePixel().Height()) + Hide(); + } GrabFocusToDocument(); } else if (rMEvt.IsEnterWindow()) |