Exemplo n.º 1
0
    void ZoomCamera()
    {
        ZoomCommand zoom = inputs.ZoomInputHandler();

        zoom.setSensitivity(ZoomSpeed);
        zoom.Execute(gameObject);
    }
 private void OnSliderValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     ZoomCommand?.Execute(e.NewValue);
 }
Exemplo n.º 3
0
 protected void Zoom(ZoomDirection direction, double amount, Point center)
 {
     ZoomCommand?.Execute(direction, amount, center);
 }
Exemplo n.º 4
0
        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();
                break;

            case DrawTool.RectangleArea:
                drawable           = new Rectangle(MoveStart, 2, 2);
                drawable.FillColor = Color.Copy();
                break;

            case DrawTool.Counter:
                drawable           = new Counter(MoveStart, 3 * LineWidth, 0);
                drawable.FillColor = Color.Copy();
                (drawable as Counter).TextColor = TextColor.Copy();
                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;
                }
                App.Current.DrawingToolkit.MeasureText(text.Value, out width, out heigth,
                                                       App.Current.Style.Font, FontSize, FontWeight.Normal);
                text.Update(new Point(MoveStart.X, 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);
                //FIXME: When Commands accepts more than one arguments it should pass MoveStart
                // to the list of arguments and remove centerZoom
                centerZoom = MoveStart;
                ZoomCommand.Execute(newZoom);
                break;
            }
            }

            if (drawable != null)
            {
                if (copycolor)
                {
                    drawable.StrokeColor = Color.Copy();
                }
                if (!(Tool.Equals(DrawTool.RectangleArea) ||
                      Tool.Equals(DrawTool.CircleArea)))
                {
                    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();
            }
        }