Beispiel #1
0
        /// <summary>
        /// Right mouse button is released
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public override void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
            int al = drawArea.TheLayers.ActiveLayerIndex;

            if (selectMode == SelectionMode.NetSelection)
            {
                // Group selection
                drawArea.TheLayers[al].Graphics.SelectInRectangle(drawArea.NetRectangle);

                selectMode = SelectionMode.None;
                drawArea.DrawNetRectangle = false;
            }

            if (resizedObject != null)
            {
                // after resizing
                resizedObject.Normalize();
                resizedObject = null;
            }

            drawArea.Capture = false;
            drawArea.Refresh();

            if (commandChangeState != null && wasMove)
            {
                // Keep state after moving/resizing and add command to history
                commandChangeState.NewState(drawArea.TheLayers);
                drawArea.AddCommandToHistory(commandChangeState);
                commandChangeState = null;
            }
            lastPoint = drawArea.BackTrackMouse(e.Location);
        }
Beispiel #2
0
        /// <summary>
        /// Right mouse button is released
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public override void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
            if (selectMode == SelectionMode.NetSelection)
            {
                // Remove old selection rectangle
                ControlPaint.DrawReversibleFrame(
                    drawArea.RectangleToScreen(DrawRectangle.GetNormalizedRectangle(startPoint, lastPoint)),
                    Color.Black,
                    FrameStyle.Dashed);

                // Make group selection
                drawArea.GraphicsList.SelectInRectangle(
                    DrawRectangle.GetNormalizedRectangle(startPoint, lastPoint));

                selectMode = SelectionMode.None;
            }

            if (resizedObject != null)
            {
                // after resizing
                resizedObject.Normalize();
                resizedObject = null;
            }

            drawArea.Capture = false;
            drawArea.Refresh();

            if (commandChangeState != null && wasMove)
            {
                // Keep state after moving/resizing and add command to history
                commandChangeState.NewState(drawArea.GraphicsList);
                drawArea.AddCommandToHistory(commandChangeState);
                commandChangeState = null;
            }
        }
Beispiel #3
0
        public override void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
            if (_selectMode == SelectionMode.NetSelection)
            {
                // âûáîð ãðóïïû
                drawArea.GraphicsList.SelectInRectangle(drawArea.NetRectangle);

                _selectMode = SelectionMode.None;
                drawArea.DrawNetRectangle = false;
            }

            if (_resizedObject != null)
            {
                // ïîñëå ðåñàéçà
                _resizedObject.Normalize();
                _resizedObject = null;
                drawArea.ResizeCommand(drawArea.GraphicsList.GetFirstSelected(),
                                       new PointF(_startPoint.X, _startPoint.Y),
                                       new PointF(e.X, e.Y),
                                       _resizedObjectHandle);
            }

            drawArea.Capture = false;
            drawArea.Refresh();

            //ïóøàåì êîìàíäó â undo/redo ëèñò
            if (_selectMode == SelectionMode.Move)
            {
                var movedItemsList = new ArrayList();

                for (int i = 0; i < drawArea.GraphicsList.SelectionCount; i++)
                {
                    movedItemsList.Add(drawArea.GraphicsList.GetSelectedObject(i));
                }

                var delta = new PointF {
                    X = e.X - _startPoint.X, Y = e.Y - _startPoint.Y
                };
                drawArea.MoveCommand(movedItemsList, delta);
            }

            IsComplete = true;
        }
Beispiel #4
0
        /// <summary>
        /// Right mouse button is released
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public override void OnMouseUp(ImageDrawBox drawArea, MouseEventArgs e)
        {
            if (selectMode == SelectionMode.NetSelection)
            {
                // Remove old selection rectangle
                ControlPaint.DrawReversibleFrame(
                    drawArea.RectangleToScreen(DrawRectangle.GetNormalizedRectangle(startPoint, lastPoint)),
                    Color.Black,
                    FrameStyle.Dashed);

                //Point pointscroll = GetEventPointInArea(drawArea, e);
                // Make group selection
                //zhoujin - user zoomfactor
                //drawArea.GraphicsList.SelectInRectangle(
                //    DrawRectangle.GetNormalizedRectangle(new Point(startPoint.X + Math.Abs(drawArea.AutoScrollPosition.X), startPoint.Y + Math.Abs(drawArea.AutoScrollPosition.Y)),
                //                                        new Point(lastPoint.X + Math.Abs(drawArea.AutoScrollPosition.X), lastPoint.Y + Math.Abs(drawArea.AutoScrollPosition.Y))));
                double zoomFactor = drawArea.ZoomFactor;
                drawArea.GraphicsList.SelectInRectangle(
                    DrawRectangle.GetNormalizedRectangle(new Point(ConvertToZoomed(startPoint.X, zoomFactor), ConvertToZoomed(startPoint.Y, zoomFactor)),
                                                         new Point(ConvertToZoomed(lastPoint.X, zoomFactor), ConvertToZoomed(lastPoint.Y, zoomFactor))));

                selectMode = SelectionMode.None;
            }

            if (resizedObject != null)
            {
                // after resizing
                resizedObject.Normalize();
                resizedObject = null;
            }

            drawArea.Capture = false;
            drawArea.Refresh();
            drawArea.GraphicsList.Dirty = true;

            if (commandChangeState != null && wasMove)
            {
                // Keep state after moving/resizing and add command to history
                commandChangeState.NewState(drawArea.GraphicsList);
                drawArea.AddCommandToHistory(commandChangeState);
                commandChangeState = null;
            }
        }
Beispiel #5
0
        /// <summary>
        /// Right mouse button is released
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public override void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
            if (_selectMode == SelectionMode.NetSelection)
            {
                // Group selection
                drawArea.GraphicsList.SelectInRectangle(drawArea.NetRectangle);

                _selectMode = SelectionMode.None;
                drawArea.DrawNetRectangle = false;
            }

            if (_resizedObject != null)
            {
                // after resizing
                _resizedObject.Normalize();
                _resizedObject = null;
                drawArea.ResizeCommand(drawArea.GraphicsList.GetFirstSelected(),
                                       new PointF(_startPoint.X, _startPoint.Y),
                                       new PointF(e.X, e.Y),
                                       _resizedObjectHandle);
            }

            drawArea.Capture = false;
            drawArea.Refresh();

            //push the command to undo/Redo list now
            if (_selectMode == SelectionMode.Move)
            {
                var movedItemsList = new ArrayList();

                for (int i = 0; i < drawArea.GraphicsList.SelectionCount; i++)
                {
                    movedItemsList.Add(drawArea.GraphicsList.GetSelectedObject(i));
                }

                var delta = new PointF {
                    X = e.X - _startPoint.X, Y = e.Y - _startPoint.Y
                };
                drawArea.MoveCommand(movedItemsList, delta);
            }

            IsComplete = true;
        }
Beispiel #6
0
        /// <summary>
        /// Right mouse button is released
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public override void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
            if (selectMode == SelectionMode.NetSelection)
            {
                // Group selection
                drawArea.GraphicsList.SelectInRectangle(drawArea.NetRectangle);

                selectMode = SelectionMode.None;
                drawArea.DrawNetRectangle = false;
            }

            if (resizedObject != null)
            {
                // after resizing
                resizedObject.Normalize();
                resizedObject = null;
            }

            drawArea.Capture = false;
            drawArea.Refresh();
        }