Example #1
0
        /// <inheritdoc/>
        protected override bool IsVisible(ICanvasContext context, RectD rectangle, ILabel label)
        {
            // We're computing a (very generous) bounding box here because relying on GetBounds does not work.
            // The visibility test does not call Configure, which means we don't have the dummy edge set up yet.
            var ownerNode = label.Owner as INode;

            if (ownerNode != null)
            {
                return(rectangle.Intersects(boundingBox + ownerNode.Layout.ToRectD()));
            }
            return(rectangle.Intersects(boundingBox));
        }
        protected override bool IsVisible(ICanvasContext context, RectD rectangle, INode node)
        {
            var layout = node.Layout;
            // check if wrapped is visible
            var isWrappedVisible = wrapped.Renderer.GetVisibilityTestable(node, wrapped).IsVisible(context, rectangle);
            // check if the decorator is visible
            var isDecoratorVisible =
                rectangle.Intersects(new RectD(layout.X + layout.Width - (decoratorSize.Width * 0.5),
                                               layout.Y + layout.Height - (decoratorSize.Height * 0.5), decoratorSize.Width, decoratorSize.Height));

            return(isWrappedVisible || isDecoratorVisible);
        }
Example #3
0
        /// <summary>
        /// Returns whether or not the given node is inside the rectangle.
        /// </summary>
        protected override bool IsInBox(IInputModeContext context, RectD rectangle, INode node)
        {
            var nodeOrientedRect = GetRotatedLayout(node);

            // Create an oriented rectangle with the size of the wrapped bounds and the location and rotation of the node
            var wrappedBounds     = Wrapped.Renderer.GetBoundsProvider(node, Wrapped).GetBounds(context);
            var orientedRectangle = new OrientedRectangle(0, 0, wrappedBounds.Width, wrappedBounds.Height,
                                                          nodeOrientedRect.UpX, nodeOrientedRect.UpY);

            orientedRectangle.SetCenter(node.Layout.GetCenter());

            return(rectangle.Intersects(orientedRectangle, 0.01));
        }
Example #4
0
 protected override bool IsInBox(IInputModeContext context, RectD rectangle, INode node)
 {
     return(rectangle.Intersects(node.Layout.ToRectD()));
 }
Example #5
0
 /// <inheritdoc/>
 protected override bool IsInBox(IInputModeContext context, RectD rectangle, ILabel label)
 {
     Configure(label);
     return(rectangle.Intersects(boundingBox.GetEnlarged(context.HitTestRadius)));
 }