private void OnTargetPanel_PointerMoved(object sender, PointerRoutedEventArgs e) { if (_painter == null) { return; } if (_targetPanel == null) { return; } if (_renderLoop == null) { return; } // Calculate move distance var currentPoint = e.GetCurrentPoint(_targetPanel); if (_lastDragPoint == null) { _lastDragPoint = currentPoint; } var moveDistance = new Vector2( (float)(currentPoint.Position.X - _lastDragPoint.Position.X), (float)(currentPoint.Position.Y - _lastDragPoint.Position.Y)); var currentLocation = new Vector2( (float)currentPoint.Position.X, (float)currentPoint.Position.Y); // Track mouse/pointer state var pointProperties = currentPoint.Properties; if (pointProperties.IsPrimary) { _stateMouseOrPointer.Internals.NotifyButtonStates( pointProperties.IsLeftButtonPressed, pointProperties.IsMiddleButtonPressed, pointProperties.IsRightButtonPressed, pointProperties.IsXButton1Pressed, pointProperties.IsXButton2Pressed); var actSize = _painter.PixelSize; _stateMouseOrPointer.Internals.NotifyMouseLocation( _renderLoop.TransformVector2FromDipToPixel(currentLocation), _renderLoop.TransformVector2FromDipToPixel(moveDistance), new Vector2(actSize.Width, actSize.Height)); } // Store last drag point _lastDragPoint = currentPoint; }