diff options
Diffstat (limited to 'wx+/grid.cpp')
-rw-r--r-- | wx+/grid.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/wx+/grid.cpp b/wx+/grid.cpp index 6eb25ac9..f7e9736f 100644 --- a/wx+/grid.cpp +++ b/wx+/grid.cpp @@ -374,17 +374,23 @@ private: !event.IsPageScroll()) { mouseRotateRemainder_ += -event.GetWheelRotation(); - const int rotations = mouseRotateRemainder_ / event.GetWheelDelta(); + int rotations = mouseRotateRemainder_ / event.GetWheelDelta(); mouseRotateRemainder_ -= rotations * event.GetWheelDelta(); + if (rotations == 0) //macOS generates tiny GetWheelRotation()! => don't allow! Always scroll a single row at least! + { + rotations = -numeric::sign(event.GetWheelRotation()); + mouseRotateRemainder_ = 0; + } + const int rowsDelta = rotations * event.GetLinesPerAction(); parent_.scrollDelta(0, rowsDelta); } else parent_.HandleOnMouseWheel(event); - onMouseMovement(event); - event.Skip(false); + onMouseMovement(event); + event.Skip(false); //if (!sendEventToParent(event)) // event.Skip(); @@ -1013,7 +1019,7 @@ private: { if (auto prov = refParent().getDataProvider()) { - onMouseMovement(event); //update highlight in obscure cases (e.g. right-click while context menu is open) + onMouseMovement(event); //update highlight in obscure cases (e.g. right-click while context menu is open) const wxPoint mousePos = GetPosition() + event.GetPosition(); const ptrdiff_t rowCount = refParent().getRowCount(); @@ -1070,7 +1076,7 @@ private: //update mouse highlight (in case it was frozen above) event.SetPosition(ScreenToClient(wxGetMousePosition())); //mouse position may have changed within above callbacks (e.g. context menu was shown)! - onMouseMovement(event); + onMouseMovement(event); } event.Skip(); //allow changing focus } @@ -1134,10 +1140,10 @@ private: sendEventToParent(GridClickEvent(EVENT_GRID_MOUSE_LEFT_UP, row, rowHover, mousePos)); } #endif - + //update mouse highlight and tooltip: macOS no mouse movement event is generated after a mouse button click (unlike on Windows) event.SetPosition(ScreenToClient(wxGetMousePosition())); //mouse position may have changed within above callbacks (e.g. context menu was shown)! - onMouseMovement(event); + onMouseMovement(event); event.Skip(); //allow changing focus } |