Exemple #1
0
        public void MouseMove(object sender, ScaleUserSelectionEventArgs e)
        {
            if (e == null)
            {
                throw new InvalidArgumentException("parameter is null");
            }
            switch (e.Button)
            {
            case MouseButton.Left:
                if (this.state.ScalingStart != null)
                {
                    this.state.ScalingPosition = e.Location;
                    this.rootControlView.RefreshView();
                }
                break;

            case MouseButton.Right:
                if (this.state.MovingStart != null)
                {
                    if (this.state.MovingPosition != null)
                    {
                        Shift(e.Location.X - this.state.MovingPosition.Value.X, e.Location.Y - this.state.MovingPosition.Value.Y);
                    }
                    this.state.MovingPosition = e.Location;
                    this.rootControlView.RefreshView();
                }
                break;
            }
        }
Exemple #2
0
        public void MouseUp(object sender, ScaleUserSelectionEventArgs e)
        {
            if (e == null)
            {
                throw new InvalidArgumentException("parameter is null");
            }
            switch (e.Button)
            {
            case MouseButton.Left:
                if (this.state.ScalingStart != null && this.state.ScalingPosition != null)
                {
                    Scale(this.state.ScalingStart.Value, e.Location, this.state.ZoomIncrease);
                    this.state.ScalingStart    = null;
                    this.state.ScalingPosition = null;
                    this.rootControlView.RefreshView();
                }
                break;

            case MouseButton.Right:
                if (this.state.MovingStart != null && this.state.MovingPosition != null)
                {
                    this.state.MovingStart    = null;
                    this.state.MovingPosition = null;
                    this.rootControlView.RefreshView();
                }
                break;
            }
        }
Exemple #3
0
        public void MouseWheel(object sender, ScaleUserSelectionEventArgs e)
        {
            if (e == null)
            {
                throw new InvalidArgumentException("parameter is null");
            }
            if (e.ShiftPressed)
            {
                Scale(e.Location, e.WheelDelta);
            }
            else
            {
                Scale(e.WheelDelta);
            }

            this.rootControlView.RefreshView();
        }
Exemple #4
0
        public void MouseDown(object sender, ScaleUserSelectionEventArgs e)
        {
            if (e == null)
            {
                throw new InvalidArgumentException("parameter is null");
            }
            if (!this.state.FitByX && !this.state.FitByY)
            {
                switch (e.Button)
                {
                case MouseButton.Left:
                    this.state.ZoomIncrease = !e.ShiftPressed;
                    this.state.ScalingStart = e.Location;
                    break;

                case MouseButton.Right:
                    this.state.MovingStart = e.Location;
                    break;
                }
            }
        }
Exemple #5
0
        private void CtrlView_MouseWheel(object sender, MouseEventArgs e)
        {
            ScaleUserSelectionEventArgs eventArgs = ToScaleUserSelectionEventArgs(e);

            this.MouseWheel?.Invoke(this, eventArgs);
        }