private void MouseMove(object sender, MouseEventArgs e) { if (_isClickExpectation) { var isHandle = RaiseGetIsHandle(); if (!isHandle) { var nextIndex = ActiveTouchManagers.IndexOf(this) + 1; if (nextIndex < ActiveTouchManagers.Count) { if (!_isDirectionsCalc) { AllScrollDirections = GetTotalScrollDirections(nextIndex); _isDirectionsCalc = true; } var absoluteMove = GetMousePosition(e) - MouseDownPosition; if (IsExceededRange(AllScrollDirections, absoluteMove)) { _isClickExpectation = false; if (PassToCaptureMouseAndContent(e, nextIndex, absoluteMove)) // Call CaptureMouse, then MouseLeave { return; } _isClickExpectation = true; } } } e.Handled = true; //? } }
public void MouseMove(object sender, MouseEventArgs e) { if (_isMouseCaptured) { var mousePosition = GetMousePosition(e); if (!_isContentCaptured) { // Init AllScrollDirections if (AllScrollDirections == null) { AllScrollDirections = GetTotalScrollDirections(indexFrom: _currentIndex); var nextIndex = ActiveTouchManagers.IndexOf(this) + 1; // No more controls or single direction or I use both directions if (nextIndex >= ActiveTouchManagers.Count || !AllScrollDirections.IsHorizontal || !AllScrollDirections.IsVertical || (ScrollDirections.IsHorizontal && ScrollDirections.IsVertical)) { CaptureAnyContent(mousePosition); // This content return; } } var absoluteMove = mousePosition - MouseDownPosition; if (IsExceededRange(AllScrollDirections, absoluteMove)) // IsExceededRange needs to AllScrollDirections { CaptureAnyContent(mousePosition); // Any content _isDominanceHorizontal = Math.Abs(absoluteMove.X) >= Math.Abs(absoluteMove.Y); return; } return; } _relativeMove = mousePosition - _lastMousePosition; if (_relativeMove.X == 0 && _relativeMove.Y == 0) { return; // Fix bug } _absoluteMove = mousePosition - _startMousePosition; _lastMousePosition = mousePosition; _lastMoveTime = DateTime.Now; ScrollAll(ActiveTouchManagers.Skip(_currentIndex), _absoluteMove, _relativeMove, _isFirst); _isFirst = false; } }
private void MouseLeave(object sender, MouseEventArgs e) { if (_isClickExpectation) { _isClickExpectation = false; //? Temp var isHandle = RaiseGetIsHandle(); if (!isHandle) { // Lost click expectation var nextIndex = ActiveTouchManagers.IndexOf(this) + 1; if (nextIndex < ActiveTouchManagers.Count) { var absoluteMove = GetMousePosition(e) - MouseDownPosition; _isClickExpectation = false; if (PassToCaptureMouse(e, nextIndex, absoluteMove)) { return; } _isClickExpectation = true; } } } }