예제 #1
0
        public void IntersectTest()
        {
            var rect1 = new Geo.Rectangle(0, 0, 100, 100);
            var rect2 = new Geo.Rectangle(50, 50, 100, 100);

            Assert.IsTrue(rect1.Intersects(rect2));
            Assert.IsTrue(rect2.Intersects(rect1));

            rect1 = new Geo.Rectangle(0, 0, 100, 100);
            rect2 = new Geo.Rectangle(0, 0, 100, 100);
            Assert.IsTrue(rect1.Intersects(rect2));

            rect1 = new Geo.Rectangle(0, 0, 100, 100);
            rect2 = new Geo.Rectangle(0, 0, 1, 100);
            Assert.IsTrue(rect1.Intersects(rect2));
        }
예제 #2
0
        public override void OnDragStart(Canvas canvas, float startPosX, float startPosY, float dx, float dy, bool isShiftKey,
                                         bool isCtrlKey)
        {
            var hitFigure = canvas.GetBestFigure(startPosX, startPosY, new List <Type> {
                typeof(Selectionbox)
            },
                                                 new List <Type>());

            if (hitFigure != null && hitFigure.IsSelectable)
            {
                base.OnDragStart(canvas, startPosX, startPosY, dx, dy, isShiftKey, isCtrlKey);
                return;
            }

            _x = startPosX;
            _y = startPosY;

            //Console.WriteLine($"Drag start: {_x}, {_y}");
            _selectBox           = new Selectionbox(_x, _y, 10, 10);
            _selectBox.FillColor = Colors.Black.AdjustOpacity(0.2);
            _absoluteBoundingBox = _selectBox.BoundingBox.Clone();

            canvas.AddAdornerFigure(_selectBox);
        }
예제 #3
0
 public Cross(Geo.Rectangle rect) : base(rect)
 {
 }
예제 #4
0
 public Rectangle(Geo.Rectangle rect) : this(rect.X, rect.Y, rect.Width, rect.Height)
 {
 }
예제 #5
0
 public Selectionbox(Geo.Rectangle rect) : base(rect)
 {
 }