Example #1
0
            public MoveOperation(OutlineUI parent_, Point p)
            {
                _start = p;
                _ui    = parent_;

                //_originalRect = _ui.Bounds;
                _ui.MouseUp   += HandleMouseUp;
                _ui.MouseMove += HandleMouseMove;
                _ui._adorner.SetActive(true);
                _ui.CaptureMouse();
                _ui.TriggerSnapshot();
                _rotateTransform  = new RotateTransform(90, _ui.Bounds.Width / 2, _ui.Bounds.Height / 2);
                _rotateTransform1 = new RotateTransform(-90, _ui.Bounds.Width / 2, _ui.Bounds.Height / 2);
            }
Example #2
0
        public OutlineAdorner(OutlineUI adorned, ISketchItemDisplay parent)
            : base(adorned)
        {
            _adorned = adorned;

            _parent              = parent;
            _realBody            = _adorned.Model as ConnectableBase;
            _shadowGeometry      = _realBody.Outline.Clone();
            _shadowGeometry.Rect =
                new Rect(0, 0, adorned.Bounds.Width, adorned.Bounds.Height); //_realBody.Outline.Clone();
            _myBrush = _selectedOutlineBrush;
            ComputeSensitiveBorder();
            _myPen            = new Pen(_myBrush, _defaultStroke);
            _defaultDashstile = _myPen.DashStyle;
            this.Visibility   = System.Windows.Visibility.Visible;
        }
            public ChangeSizeOperation(OutlineUI parent_, System.Windows.Input.MouseButtonEventArgs e)
            {
                var p    = e.GetPosition(parent_._parent.Canvas);
                var relP = e.GetPosition(parent_);

                _start = PlacementHelper.RoundToGrid(p);


                _ui            = parent_;
                _origialRect   = _ui.Bounds;
                _originalUiPos = _ui._adorner.Bounds;
                //List<LineGeometry> lgs = new List<LineGeometry>
                //{
                //    new LineGeometry( _origialRect.TopLeft, _origialRect.TopRight ),
                //    new LineGeometry( _origialRect.TopRight, _origialRect.BottomRight),
                //    new LineGeometry( _origialRect.BottomRight, _origialRect.BottomLeft),
                //    new LineGeometry( _origialRect.BottomLeft, _origialRect.TopLeft)
                //};

                //foreach( var l in lgs)
                //{
                //    l.Transform = _ui.DefiningGeometry.Transform;
                //}

                //int direction = 0;
                //for (int i = 0; i < lgs.Count; ++i)
                //{
                //    if (lgs[i].StrokeContains(_pen, p))
                //    {
                //        direction |= (1 << i);
                //    }
                //}

                _ui.TriggerSnapshot();
                _ui._adorner.SetActive(true);
                //_direction = (RelativePosition)direction;// _ui._myShadow.HitShadowBorder(_start);
                _direction = _ui._adorner.HitShadowBorder(relP);

                _ui.MouseUp   += HandleMouseUp;
                _ui.MouseMove += HandleMouseMove;
                _ui.CaptureMouse();

                if (_direction == RelativePosition.Undefined)
                {
                    StopOperation(false);
                }
            }