Ejemplo n.º 1
0
        public void ProcessMouseMove(MouseEventArgs e)
        {
            var cursor           = Cursors.Default;
            var location         = e.Location;
            var underCursorGlyph = FindGlyphIn(location);

            if (RedactorState == RedactorStates.Default && underCursorGlyph != ActiveGlyph)
            {
                cursor = Cursors.Hand;
            }

            if (ActiveGlyph is PathGlyph || (Mode != RedactorModes.Move && underCursorGlyph == ActiveGlyph))
            {
                cursor = Cursors.Cross;
            }

            if (RedactorState == RedactorStates.Dragging)
            {
                cursor = Cursors.NoMove2D;
            }

            ActiveGlyph.ProcessMove(new Point(location.X - LastCursorLocation.X, location.Y - LastCursorLocation.Y));

            _redactor.Cursor   = cursor;
            LastCursorLocation = location;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Обрабатывает левый клик
        /// </summary>
        /// <param name="location"></param>
        private void ProcessLeftClick(Point location)
        {
            if (RedactorState == RedactorStates.Dragging)
            {
                RedactorState = RedactorStates.Default;
                return;
            }

            if (RedactorState == RedactorStates.Default)
            {
                var newActiveGlyph = FindGlyphIn(location);
                if (newActiveGlyph == ActiveGlyph)
                {
                    switch (Mode)
                    {
                    case RedactorModes.Create:
                        StartCreatingNewGlyphIn(location);
                        return;

                    case RedactorModes.Move:
                        StartMoving();
                        return;

                    case RedactorModes.AddPolygon:
                        throw new NotImplementedException();
                    }
                }

                else
                {
                    Focus(newActiveGlyph);
                    if (ActiveGlyph is LineGlyph || ActiveGlyph is WordGlyph)
                    {
                        ActiveGlyph.ProcessSelection();
                    }
                    _redactor.Invalidate();
                }
            }

            if (ActiveGlyph is PathGlyph)
            {
                (ActiveGlyph as PathGlyph).ProcessLeftClick(location);
            }
        }