예제 #1
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            if (HitStart)
            {
                drawingContext.DrawRectangle(_myFillBrush, _myPen, _model.HotSpotStart);
            }
            if (HitEnd)
            {
                drawingContext.DrawRectangle(_myFillBrush, _myPen, _model.HotSpotEnd);
            }

            foreach (var w in _model.Waypoints)
            {
                var center = ConnectorUtilities.ComputeCenter(w.Bounds);
                drawingContext.DrawEllipse(_myFillBrush, _myPen, center, _waypointRadius, _waypointRadius);
            }
        }
예제 #2
0
        public RewireConnectorOperation(ISketchItemDisplay pad, ConnectorModel model, Point p)
        {
            _connector = model;
            _pad       = pad;

            IBoundedSketchItemModel ending = model.To;

            if (ending == null)
            {
                ending = model.From;
            }
            var start = ConnectorUtilities.ComputeCenter(ending.Bounds);

            _selector = new ConnectablePairSelector(start, p);
            _pad.Canvas.Children.Add(_selector);
            _selector.Visibility = Visibility.Visible;
            foreach (var ch in _pad.Canvas.Children.OfType <ISketchItemUI>())
            {
                ch.Disable();
            }
            _pad.Canvas.MouseMove += HandleMouseMove;
            _pad.Canvas.MouseDown += HandleMouseDown;
            _pad.Canvas.KeyDown   += HandleKeyDown;
        }