Don't hit any TrackPanel or Ruler cells when mouse is out of window

This commit is contained in:
Paul Licameli 2018-08-06 21:29:57 -04:00
parent 74efec9d39
commit 2c28af05e8
2 changed files with 8 additions and 7 deletions

View File

@ -2087,15 +2087,13 @@ auto TrackPanel::FindCell(int mouseX, int mouseY) -> FoundCell
{
auto range = Cells();
auto &iter = range.first, &end = range.second;
auto prev = iter;
while
( iter != end &&
!(*iter).second.Contains( mouseX, mouseY ) )
prev = iter++;
if ( iter == end )
// Default to the background cell, which is always last in the sequence,
// even if it does not contain the point
iter = prev;
++iter;
if (iter == end)
return {};
auto found = *iter;
return {
found.first,

View File

@ -3606,7 +3606,10 @@ auto AdornedRulerPanel::FindCell(int mouseX, int mouseY) -> FoundCell
if (mayScrub && mScrubZone.Contains(mouseX, mouseY))
return { mScrubbingCell, mScrubZone };
return { mQPCell, mInner };
if (mInner.Contains(mouseX, mouseY))
return { mQPCell, mInner };
return {};
}
wxRect AdornedRulerPanel::FindRect(const TrackPanelCell &cell)