/// /// <summary> /// Calculate distance in pixels for each inertial step and start deceleration timer</summary> /// private void InitializeInertialMove( ) { int trackingTime; trackingTime = (int)(m_p2time - m_p1time).TotalMilliseconds; m_timer.Stop(); m_element.ReleaseMouseCapture(); m_timer.Interval = TimeSpan.FromMilliseconds(DECELERATION_INTERVAL); m_timer.Start(); MovingScroll = this; m_incrementX = ((m_p2.X - m_p1.X) / trackingTime) * DECELERATION_INTERVAL; m_incrementY = ((m_p2.Y - m_p1.Y) / trackingTime) * DECELERATION_INTERVAL; }
public void Release( ) { bool sendDragStop; MovingScroll = null; sendDragStop = (m_inertialDragging || m_manualDragging); m_inertialDragging = false; m_manualDragging = false; m_element.ReleaseMouseCapture(); m_timer.Stop(); if (OnDragStop != null && sendDragStop) { OnDragStop(m_p2); } }
public void Release( ) { Moving = false; MovingScroll = null; m_element.ReleaseMouseCapture(); m_timer.Stop(); m_timer.Tick -= OnTick; m_inertialMode = false; m_firstInertialStep = false; m_p1 = m_p2 = new Point(0, 0); if (OnDragStop != null) { OnDragStop(m_p2); } }
private void InertialScrollStep() { if (m_firstInertialStep) { m_timer.Stop(); m_element.ReleaseMouseCapture(); m_timer.Interval = TimeSpan.FromMilliseconds(DECELERATION_INTERVAL); m_timer.Start(); Moving = true; MovingScroll = this; m_incrementX += ((m_p2.X - m_p1.X) / TRACKING_INTERVAL) * DECELERATION_INTERVAL; m_incrementY += ((m_p2.Y - m_p1.Y) / TRACKING_INTERVAL) * DECELERATION_INTERVAL; m_firstInertialStep = false; } m_p2.X += m_incrementX; m_p2.Y += m_incrementY; m_incrementX *= DECELERATION; m_incrementY *= DECELERATION; if (Math.Abs(m_incrementX) < MIN_POINTS && Math.Abs(m_incrementY) < MIN_POINTS) { Release(); } else { if (OnDragMove != null) { OnDragMove(m_p1, m_p2); } m_p1 = m_p2; } }
public void Release( ) { bool sendDragStop; MovingScroll = null; sendDragStop = (m_inertialDragging || m_manualDragging); m_inertialDragging = false; m_manualDragging = false; m_element.ReleaseMouseCapture(); m_timer.Stop(); if (OnDragStop != null && sendDragStop) { OnDragStop(m_p2); } }
/// /// <summary> /// Calculate distance in pixels for each inertial step and start deceleration timer</summary> /// private void InitializeInertialMove( ) { int trackingTime; trackingTime = (int) (m_p2time - m_p1time).TotalMilliseconds; m_timer.Stop(); m_element.ReleaseMouseCapture(); m_timer.Interval = TimeSpan.FromMilliseconds(DECELERATION_INTERVAL); m_timer.Start(); MovingScroll = this; m_incrementX = ((m_p2.X - m_p1.X) / trackingTime) * DECELERATION_INTERVAL; m_incrementY = ((m_p2.Y - m_p1.Y) / trackingTime) * DECELERATION_INTERVAL; }