Exemple #1
0
#pragma warning restore CS0618

        private void MainImage_PointerMoved(object sender, PointerEventArgs e)
        {
            // allow to move cursor out leaving selection/hignlighting unchanged
            if (IgnorePointerMove(e))
            {
                return;
            }

            PointerPoint p = e.GetCurrentPoint(_mainImageControl);

            _pointerPos = p.Position;
            //
            if (p.Properties.IsMiddleButtonPressed)
            {
                TD.Point delta = ToPoint(_pointerPosDrag - _pointerPos);
                _pointerPosDrag = _pointerPos;
                _viewport.MoveOrigin(delta);
                UpdateDrawerBounds();
                MarkPresetChanged();
                InvalidateView(false); // viewport moved only
            }
            else
            {
                TD.Point u = _viewport.ToUser(ToPoint(_pointerPos));
                _gridDrawer.SetCursor(u.X, u.Y);
                var mode = e.KeyModifiers.HasFlag(KeyModifiers.Alt)
                    ? GridDrawer.CursorHighlightMode.Cents
                    : GridDrawer.CursorHighlightMode.NearestRational;
                _gridDrawer.SetCursorHighlightMode(mode);
                InvalidateView();
            }
        }