Example #1
0
        public OverlayManager(Canvas canvas, RectangleManager rectangleManager)
        {
            _canvas           = canvas;
            _rectangleManager = rectangleManager;

            _pathOverlay = new Path
            {
                Fill    = Brushes.Black,
                Opacity = 0.5
            };

            _canvas.Children.Add(_pathOverlay);
        }
 public DisplayTextManager(Canvas canvas, RectangleManager rectangleManager)
 {
     _rectangleManager = rectangleManager;
     _sizeTextBlock    = new TextBlock
     {
         Text       = "Size counter",
         FontSize   = 14,
         Foreground = Brushes.White,
         Background = Brushes.Black,
         Visibility = Visibility.Hidden
     };
     canvas.Children.Add(_sizeTextBlock);
 }
Example #3
0
        public ThumbManager(Canvas canvas, RectangleManager rectangleManager)
        {
            //  initizalize
            _canvas           = canvas;
            _rectangleManager = rectangleManager;
            _thumbSize        = 8;

            //  create thumbs with factory
            _bottomMiddle = ThumbFactory.CreateThumb(ThumbFactory.ThumbPosition.BottomMiddle, _canvas, _thumbSize);
            _leftMiddle   = ThumbFactory.CreateThumb(ThumbFactory.ThumbPosition.LeftMiddle, _canvas, _thumbSize);
            _topMiddle    = ThumbFactory.CreateThumb(ThumbFactory.ThumbPosition.TopMiddle, _canvas, _thumbSize);
            _rightMiddle  = ThumbFactory.CreateThumb(ThumbFactory.ThumbPosition.RightMiddle, _canvas, _thumbSize);
            _topLeft      = ThumbFactory.CreateThumb(ThumbFactory.ThumbPosition.TopLeft, _canvas, _thumbSize);
            _topRight     = ThumbFactory.CreateThumb(ThumbFactory.ThumbPosition.TopRight, _canvas, _thumbSize);
            _bottomLeft   = ThumbFactory.CreateThumb(ThumbFactory.ThumbPosition.BottomLeft, _canvas, _thumbSize);
            _bottomRight  = ThumbFactory.CreateThumb(ThumbFactory.ThumbPosition.BottomRight, _canvas, _thumbSize);

            //  subsctibe to mouse events
            _bottomMiddle.DragDelta += new DragDeltaEventHandler(BottomMiddleDragDeltaEventHandler);
            _bottomMiddle.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(PreviewMouseLeftButtonDownGenericHandler);
            _bottomMiddle.PreviewMouseLeftButtonUp   += new MouseButtonEventHandler(PreviewMouseLeftButtonUpGenericHandler);

            _leftMiddle.DragDelta += new DragDeltaEventHandler(LeftMiddleDragDeltaEventHandler);
            _leftMiddle.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(PreviewMouseLeftButtonDownGenericHandler);
            _leftMiddle.PreviewMouseLeftButtonUp   += new MouseButtonEventHandler(PreviewMouseLeftButtonUpGenericHandler);

            _topMiddle.DragDelta += new DragDeltaEventHandler(TopMiddleDragDeltaEventHandler);
            _topMiddle.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(PreviewMouseLeftButtonDownGenericHandler);
            _topMiddle.PreviewMouseLeftButtonUp   += new MouseButtonEventHandler(PreviewMouseLeftButtonUpGenericHandler);

            _rightMiddle.DragDelta += new DragDeltaEventHandler(RightMiddleDragDeltaEventHandler);
            _rightMiddle.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(PreviewMouseLeftButtonDownGenericHandler);
            _rightMiddle.PreviewMouseLeftButtonUp   += new MouseButtonEventHandler(PreviewMouseLeftButtonUpGenericHandler);

            _topLeft.DragDelta += new DragDeltaEventHandler(TopLeftDragDeltaEventHandler);
            _topLeft.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(PreviewMouseLeftButtonDownGenericHandler);
            _topLeft.PreviewMouseLeftButtonUp   += new MouseButtonEventHandler(PreviewMouseLeftButtonUpGenericHandler);

            _topRight.DragDelta += new DragDeltaEventHandler(TopRighttDragDeltaEventHandler);
            _topRight.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(PreviewMouseLeftButtonDownGenericHandler);
            _topRight.PreviewMouseLeftButtonUp   += new MouseButtonEventHandler(PreviewMouseLeftButtonUpGenericHandler);

            _bottomLeft.DragDelta += new DragDeltaEventHandler(BottomLeftDragDeltaEventHandler);
            _bottomLeft.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(PreviewMouseLeftButtonDownGenericHandler);
            _bottomLeft.PreviewMouseLeftButtonUp   += new MouseButtonEventHandler(PreviewMouseLeftButtonUpGenericHandler);

            _bottomRight.DragDelta += new DragDeltaEventHandler(BottomRightDragDeltaEventHandler);
            _bottomRight.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(PreviewMouseLeftButtonDownGenericHandler);
            _bottomRight.PreviewMouseLeftButtonUp   += new MouseButtonEventHandler(PreviewMouseLeftButtonUpGenericHandler);
        }