LongoMatch.Drawing.Widgets.Blackboard.StartMove C# (CSharp) Méthode

StartMove() protected méthode

protected StartMove ( Selection sel ) : void
sel LongoMatch.Core.Store.Drawables.Selection
Résultat void
        protected override void StartMove(Selection sel)
        {
            Drawable drawable = null;
            SelectionPosition pos = SelectionPosition.BottomRight;
            bool resize = true, copycolor = true, sele = true;

            if (Tool == DrawTool.Selection) {
                if (Selections.Count == 0 && currentZoom != 1) {
                    widget.SetCursorForTool (DrawTool.Move);
                    inZooming = true;
                }
                return;
            }

            if (sel != null) {
                ClearSelection ();
            }

            switch (Tool) {
            case DrawTool.Line:
                drawable = new Line (MoveStart, new Point (MoveStart.X + 1, MoveStart.Y + 1),
                    LineType, LineStyle);
                drawable.FillColor = Color;
                pos = SelectionPosition.LineStop;
                break;
            case DrawTool.Cross:
                drawable = new Cross (MoveStart, new Point (MoveStart.X + 1, MoveStart.Y + 1),
                    LineStyle);
                break;
            case DrawTool.Ellipse:
                drawable = new Ellipse (MoveStart, 2, 2);
                break;
            case DrawTool.Rectangle:
                drawable = new Rectangle (MoveStart, 2, 2);
                break;
            case DrawTool.CircleArea:
                drawable = new Ellipse (MoveStart, 2, 2);
                drawable.FillColor = Color.Copy ();
                drawable.FillColor.A = byte.MaxValue / 2;
                break;
            case DrawTool.RectangleArea:
                drawable = new Rectangle (MoveStart, 2, 2);
                drawable.FillColor = Color.Copy ();
                drawable.FillColor.A = byte.MaxValue / 2;
                break;
            case DrawTool.Counter:
                drawable = new Counter (MoveStart, 3 * LineWidth, 0);
                drawable.FillColor = Color.Copy ();
                (drawable as Counter).TextColor = Color.Grey2;
                resize = false;
                break;
            case DrawTool.Text:
            case DrawTool.Player:
                {
                    int width, heigth;
                    Text text = new Text (MoveStart, 1, 1, "");
                    if (ConfigureObjectEvent != null) {
                        ConfigureObjectEvent (text, Tool);
                    }
                    if (text.Value == null) {
                        return;
                    }
                    Config.DrawingToolkit.MeasureText (text.Value, out width, out heigth,
                        Config.Style.Font, FontSize, FontWeight.Normal);
                    text.Update (new Point (MoveStart.X - width / 2, MoveStart.Y - heigth / 2),
                        width, heigth);
                    text.TextColor = TextColor.Copy ();
                    text.FillColor = text.StrokeColor = TextBackgroundColor.Copy ();
                    text.TextSize = FontSize;
                    resize = copycolor = sele = false;
                    drawable = text;
                    break;
                }
            case DrawTool.Pen:
            case DrawTool.Eraser:
                handdrawing = true;
                break;
            case DrawTool.Zoom:
                {
                    double newZoom = currentZoom;

                    if (modifier == ButtonModifier.Shift) {
                        newZoom -= 0.1;
                    } else {
                        newZoom += 0.1;
                    }
                    newZoom = Math.Max (newZoom, MinZoom);
                    newZoom = Math.Min (newZoom, MaxZoom);
                    Zoom (newZoom, MoveStart);
                    break;
                }
            }

            if (drawable != null) {
                if (copycolor) {
                    drawable.StrokeColor = Color.Copy ();
                }
                drawable.LineWidth = LineWidth;
                drawable.Style = LineStyle;
                var selo = Add (drawable);
                drawing.Drawables.Add (drawable);
                if (Tool == DrawTool.Counter) {
                    UpdateCounters ();
                }
                if (sele) {
                    if (resize) {
                        UpdateSelection (new Selection (selo, pos, 5));
                    } else {
                        UpdateSelection (new Selection (selo, SelectionPosition.All, 5));
                    }
                    inObjectCreation = true;
                }
                widget.ReDraw ();
            }
        }