コード例 #1
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);
            }
        }