Remove SashHitTest() "tolerance" parameter

Mouse events (LeftDown in particular) will only occur if the mouse is over the
sash, so it does not make sense to have a fudge factor


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73111 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett 2012-12-03 18:14:55 +00:00
parent bea20f8d7a
commit f3ddefc1ad
2 changed files with 6 additions and 7 deletions

View File

@ -212,7 +212,7 @@ public:
virtual void DrawSashTracker(int x, int y); virtual void DrawSashTracker(int x, int y);
// Tests for x, y over sash // Tests for x, y over sash
virtual bool SashHitTest(int x, int y, int tolerance = 5); virtual bool SashHitTest(int x, int y);
// Resizes subwindows // Resizes subwindows
virtual void SizeWindows(); virtual void SizeWindows();

View File

@ -323,7 +323,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
} // left up && dragging } // left up && dragging
else if ((event.Moving() || event.Leaving() || event.Entering()) && (m_dragMode == wxSPLIT_DRAG_NONE)) else if ((event.Moving() || event.Leaving() || event.Entering()) && (m_dragMode == wxSPLIT_DRAG_NONE))
{ {
if ( event.Leaving() || !SashHitTest(x, y, 0) ) if ( event.Leaving() || !SashHitTest(x, y) )
OnLeaveSash(); OnLeaveSash();
else else
OnEnterSash(); OnEnterSash();
@ -484,16 +484,15 @@ void wxSplitterWindow::SetSashGravity(double gravity)
m_sashGravity = gravity; m_sashGravity = gravity;
} }
bool wxSplitterWindow::SashHitTest(int x, int y, int tolerance) bool wxSplitterWindow::SashHitTest(int x, int y)
{ {
if ( m_windowTwo == NULL || m_sashPosition == 0) if ( m_windowTwo == NULL || m_sashPosition == 0)
return false; // No sash return false; // No sash
int z = m_splitMode == wxSPLIT_VERTICAL ? x : y; int z = m_splitMode == wxSPLIT_VERTICAL ? x : y;
int hitMin = m_sashPosition - tolerance; int hitMax = m_sashPosition + GetSashSize() - 1;
int hitMax = m_sashPosition + GetSashSize() - 1 + tolerance;
return z >= hitMin && z <= hitMax; return z >= m_sashPosition && z <= hitMax;
} }
void wxSplitterWindow::SetSashInvisible(bool invisible) void wxSplitterWindow::SetSashInvisible(bool invisible)
@ -1047,7 +1046,7 @@ void wxSplitterWindow::OnSetCursor(wxSetCursorEvent& event)
// and like this we explicitly say that our cursor should not be used for // and like this we explicitly say that our cursor should not be used for
// children windows which overlap us // children windows which overlap us
if ( SashHitTest(event.GetX(), event.GetY(), 0) ) if ( SashHitTest(event.GetX(), event.GetY()) )
{ {
// default processing is ok // default processing is ok
event.Skip(); event.Skip();