/// <summary> /// Overridden to take the connection lines to the label into account. /// </summary> /// <remarks> /// Otherwise label intersection lines might not be painted if the node is outside /// of the clipping bounds. /// </remarks> protected override bool IsVisible(ICanvasContext context, RectD rectangle, INode node) { if (base.IsVisible(context, rectangle, node)) { return(true); } // check for labels connection lines rectangle = rectangle.GetEnlarged(10); return(node.Labels.Any(label => rectangle.IntersectsLine(node.Layout.GetCenter(), label.GetLayout().GetCenter()))); }
//////////////////////////////////////////////////// //////////////// New in this sample //////////////// //////////////////////////////////////////////////// /// <summary> /// Overridden to take the connection lines to the label into account. /// </summary> /// <remarks> /// Otherwise label intersection lines might not be painted if the node is outside /// of the clipping bounds. /// </remarks> protected override bool IsVisible(ICanvasContext context, RectD rectangle, INode node) { // return base.IsVisible(node, clip, canvasContext); if (base.IsVisible(context, rectangle, node)) { return(true); } // check for labels connection lines rectangle = rectangle.GetEnlarged(10); foreach (var label in node.Labels) { if (rectangle.IntersectsLine(node.Layout.GetCenter(), label.GetLayout().GetCenter())) { return(true); } } return(false); }
protected override bool IsVisible(ICanvasContext context, RectD rectangle, INode node) { // first check if the wrapped style is visible if (wrapped.Renderer.GetVisibilityTestable(node, wrapped).IsVisible(context, rectangle)) { return(true); } // if not, check for labels connection lines rectangle = rectangle.GetEnlarged(10); foreach (var label in node.Labels) { if (rectangle.IntersectsLine(node.Layout.GetCenter(), label.GetLayout().GetCenter())) { return(true); } } return(false); }
/// <summary> /// Overridden to take the connection lines to the label into account. /// </summary> /// <remarks> /// Otherwise label intersection lines might not be painted if the node is outside /// of the clipping bounds. /// </remarks> protected override bool IsVisible(ICanvasContext context, RectD rectangle, INode node) { // uncomment the following line to watch the default behaviour that // doesn't paint the label edge if the node lies completely outside the viewport // return base.IsVisible(context, rectangle, node); if (base.IsVisible(context, rectangle, node)) { return(true); } // check for labels connection lines rectangle = rectangle.GetEnlarged(10); foreach (var label in node.Labels) { if (rectangle.IntersectsLine(node.Layout.GetCenter(), label.GetLayout().GetCenter())) { return(true); } } return(false); }
// Returns the first AdditionalSnapLine found in a close surrounding of the given location // or null if none can be found. private AdditionalSnapLineVisualCreator TryGetAdditionalSnapLineAt(PointD location) { RectD surrounding = new RectD(location - new PointD(3, 3), new SizeD(6, 6)); return(window.AdditionalSnapLineVisualCreators.FirstOrDefault(line => surrounding.IntersectsLine(line.From, line.To))); }