An ILabelStyleRenderer implementation that can handle DefaultLabelStyle instances.
Remarks
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.styles.DefaultLabelStyleRenderer
See Also
Properties
Gets or sets the currently configured label.
Gets or sets the current layout.
Gets or sets the currently configured style.
Methods
addTextElements
(textContainer: SVGElement, font: Font, text: string, maxSize: Size, wrapping: TextWrapping, rightToLeft: boolean) : stringAdd the text content to the provided SVG text element.
Parameters
A map of options to pass to the method.
- textContainer - SVGElement
- An SVG element to add the provided text to. It is a
SVGGElement
when using rightToLeft, otherwise aSVGTextElement
. - font - Font
- The Font that defines the font properties to apply to the added text.
- text - string
- The text content to add to the provided text element (may contain newline characters).
- maxSize - Size
- The bounds that shouldn't be exceeded when placing the text;
null
or not provided means unbound. - wrapping - TextWrapping
- The TextWrapping policy to apply when the text exceeds the provided
maxSize
. - rightToLeft - boolean
- Whether to use right-to-left text direction.
Prepares this instance for subsequent calls after the style and label have been initialized.
Remarks
Upon invocation the style and label properties have been populated by the getVisualCreator, getBoundsProvider, getHitTestable, or getMarqueeTestable methods.
Stores the layout into layout. Subclasses which to override this method should call the base implementation.
This method is called by the framework to create a Visual that will be included into the IRenderContext.
Remarks
Parameters
A map of options to pass to the method.
- context - IRenderContext
- The context that describes where the visual will be used.
Returns
- ↪Visual
- The visual to include in the canvas object visual tree. This may be
null
.
See Also
Implements
Returns a tight rectangular area where the whole rendering would fit into.
Remarks
Parameters
A map of options to pass to the method.
- context - ICanvasContext
- the context to calculate the bounds for
Returns
Implements
Configures the style
and label
parameters, calls configure and returns this
.
Parameters
A map of options to pass to the method.
- label - ILabel
- The label to retrieve the bounds provider for. The value will be stored in the label property.
- style - ILabelStyle
- The style to associate with the label. The value will be stored in the style property.
Returns
- ↪IBoundsProvider
this
See Also
Implements
Configures the style
and label
parameters, does not call configure and returns this
.
Remarks
this
or an instance that depends on a correctly configured this
.Parameters
A map of options to pass to the method.
- label - ILabel
- The label to query the context for. The value will be stored in the label property.
- style - ILabelStyle
- The style to associate with the label. The value will be stored in the style property.
Returns
- ↪ILookup
this
See Also
Implements
Configures the style
and label
parameters, calls configure and returns this
.
Parameters
A map of options to pass to the method.
- label - ILabel
- The label to query hit test with. The value will be stored in the label property.
- style - ILabelStyle
- The style to associate with the label. The value will be stored in the style property.
Returns
- ↪IHitTestable
this
See Also
Implements
Determines how the text should be aligned within the assigned label bounds.
Returns
- ↪HorizontalTextAlignment
- This value as obtained from the style.
Configures the style
and label
parameters, calls configure and returns this
.
Parameters
A map of options to pass to the method.
- label - ILabel
- The label to query marquee intersection tests. The value will be stored in the label property.
- style - ILabelStyle
- The style to associate with the label. The value will be stored in the style property.
Returns
- ↪IMarqueeTestable
this
See Also
Implements
Calculates the preferred size of a given label using the associated style.
Parameters
A map of options to pass to the method.
- label - ILabel
- The label to determine the preferred size for
- style - ILabelStyle
- The style instance that uses this instance as its renderer
Returns
- ↪Size
- A size that can be used as the preferredSize if this renderer renders the label using the associated style.
See Also
Implements
Calculates the preferred size given the current state of the renderer.
Remarks
The size that is needed by the text is enlarged by a relative and an absolute value.
Only when there is no wrapping or the textWrappingShape is set to RECTANGLE, this implementation will also take into account the shape and reserve space for the ends of a PILL and HEXAGON.
In order to ensure that text does never intersect with the rounded corners of a ROUND_RECTANGLE, specify insets, manually.
The implementation then adds the insets and adjusts the size to respect the minimum and maximum allowed size.
At the end of the calculation, the size is quantized to avoid unnecessary floating point precision.
Returns
- ↪Size
- The size as suggested by this renderer.
Returns a convex GeneralPath describing the area of the textWrappingShape for the current label or null
if the label's rectangular bounds should be used.
Remarks
x = max(left inset, text wrapping padding)
and y = max(top inset, text wrapping padding)
in the coordinate system of the label's layout.Returns
Determines how the text should be aligned vertically within the assigned label bounds.
Returns
- ↪VerticalTextAlignment
- This value as obtained from the style.
Configures the style
and label
parameters, does not call configure and returns this
.
Remarks
Configure
in isVisible.Parameters
A map of options to pass to the method.
- label - ILabel
- The label to query visibility tests. The value will be stored in the label property.
- style - ILabelStyle
- The style to associate with the label. The value will be stored in the style property.
Returns
- ↪IVisibilityTestable
this
See Also
Implements
Configures the style
and label
parameters, calls configure and returns this
.
Parameters
A map of options to pass to the method.
- label - ILabel
- The label to retrieve the IVisualCreator for. The value will be stored in the label property.
- style - ILabelStyle
- The style to associate with the label. The value will be stored in the style property.
Returns
- ↪IVisualCreator
this
See Also
Implements
Determines how the text should be trimmed to fit the assigned label bounds.
Returns
- ↪TextWrapping
- This value as obtained from the style.
Delegates to autoFlip
Returns
- ↪boolean
- Whether to flip the drawing if it is upside down.
Determines if something has been hit at the given coordinates in the world coordinate system.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- the context the hit test is performed in
- location - Point
- the coordinates in world coordinate system
Returns
- ↪boolean
- whether something has been hit
Implements
Returns true
if the corresponding item is considered to intersect the given rectangular box.
Remarks
This method may return false
if the item cannot be selected using a selection marquee or optionally if the item is only partially contained within the box.
Implementations should respect the hitTestRadius if marquee selections should behave differently on different zoom levels.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- the current input mode context
- rectangle - Rect
- the box describing the marquee's bounds
Returns
- ↪boolean
true
if the item is considered to be captured by the marquee
Implements
Uses the layout to determine whether the clip intersects.
Parameters
A map of options to pass to the method.
- context - ICanvasContext
- The context to determine the visibility for.
- rectangle - Rect
- The visible region clip.
Returns
- ↪boolean
false
if and only if it is safe not to paint the element because it would not affect the given clipping region.
Implements
Implements the ILookup interface.
Remarks
GetContext
. Subclass implementations should make sure to configure this instance before they return this
as a result of a successful lookup. This implementation will check if type.IsInstanceOfType(this)
and will call configure on success and return this
.Type Parameters
- T: any
Parameters
A map of options to pass to the method.
- type - Class<T>
- The type to query for.
Returns
- ↪T
- An implementation or
null
.
See Also
Implements
Calculate the width and height required to render the provided text using the provided Font.
Quantizes the result of the preferred size calculation.
Remarks
The benefit of quantization is that coordinates are easier to recognize in a debugger, labels end up with sizes that are easier to read, GraphML files become smaller because less space is wasted on unnecessary floating point precision, and numerical instability in certain cases is eliminated.
The current implementation just rounds up width and height to integral values.
Parameters
A map of options to pass to the method.
- size - Size
- The preferred size
Returns
- ↪Size
- The quantized preferred size.
This method updates or replaces a previously created Visual for inclusion in the IRenderContext.
Remarks
The CanvasComponent uses this method to give implementations a chance to update an existing Visual that has previously been created by the same instance during a call to createVisual. Implementation may update the oldVisual
and return that same reference, or create a new visual and return the new instance or null
.
I most cases oldVisual
is a visual instance that has been returned by the createVisual method of this instance. This is, however, not guaranteed. Implementations have to be aware of this.
Parameters
A map of options to pass to the method.
- context - IRenderContext
- The context that describes where the visual will be used in.
- oldVisual - Visual
- The visual instance to be updated.
Returns
- ↪Visual
oldVisual
, if this instance modified the visual, or a new visual that should replace the existing one in the canvas object visual tree.