예제 #1
0
        /// <summary>
        /// Handler for scaffold mode.
        /// </summary>
        private void _mouseDown(object sender, MouseButtonEventArgs e)
        {
            if (!ScaffoldModeEnabled)
            {
                return;
            }

            if (e.RightButton == MouseButtonState.Pressed)
            {
                _lastScaffold = null;
                e.Handled     = true;
                return;
            }

            if (_lastScaffold == null || !Children.Contains(_lastScaffold))
            {
                _lastScaffold = null;
            }


            if (_lastScaffold == null)
            {
                _lastScaffold = new ScaffoldItem(UnusedVersion(new ReadableIdentifier("scaffold")), new Point2Dmm[0]);
            }
            else
            {
                Children.Remove(_lastScaffold);
            }

            var position = e.GetPosition(this);
            var mmX      = position.X / ActualWidth * RangeX;
            var mmY      = position.Y / ActualHeight * RangeY;

            _lastScaffold = _lastScaffold.ExtendBy(new Point2Dmm(mmX, mmY));

            Children.Add(_lastScaffold);
        }
예제 #2
0
        public ScaffoldItem ExtendBy(Point2Dmm point)
        {
            var item = new ScaffoldItem(Name, ShapePoints.Concat(new[] { point }));

            return(item);
        }