Ejemplo n.º 1
0
        public void StartEditing(Data.Anchor anchor, Point pos)
        {
            _anchor = anchor;

            Text        = _anchor.Name;
            Translation = new Vector3(pos.ToVector2(), 0);
            Visibility  = Visibility.Visible;
            Focus(FocusState.Programmatic);
            SelectAll();
        }
Ejemplo n.º 2
0
        void FinishEditing()
        {
            if (_anchor == null)
            {
                throw new InvalidOperationException($"{nameof(_anchor)} is null");
            }

            _anchor.Name = Text;
            ((App)Application.Current).InvalidateData();

            Translation = default;
            Visibility  = Visibility.Collapsed;
            _anchor     = null;
        }
Ejemplo n.º 3
0
        public void Execute(object parameter)
        {
            var(canvas, pos) = (ValueTuple <DesignCanvas, Point>)parameter;
            var layer = canvas.Layer;

            var anchor = new Data.Anchor(
                Outline.RoundToGrid((float)pos.X),
                Outline.RoundToGrid((float)pos.Y),
                "new anchor"
                );

            layer.Anchors.Add(anchor);
            layer.ClearSelection();
            anchor.IsSelected = true;
            ((App)Application.Current).InvalidateData();

            canvas.EditAnchorName(anchor);
        }