This port label model can be used to specify any position and orientation of a label.
Inheritance Hierarchy
FreePortLabelModel
Implemented Interfaces
Remarks
The position of the label is stored relative to the position of the port the label belongs to.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.graph.FreePortLabelModel
See Also
Methods
Creates a parameter that is anchored at the center of the port and has no rotation.
Returns
- ↪ILabelModelParameter
- A parameter that is anchored at the center of the port and has no rotation.
Implements
createParameter
(locationOffset: Point, labelRatio: Point, labelOffset?: Point, angle?: number) : ILabelModelParameterCreates a parameter instance that anchors the label to the port at a given position.
Remarks
The parameter will use the ratio and offset values to determine a point on both the label and the port. It will place the label in such a way that both points coincide.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- locationOffset - Point
- The offset to apply to the port's location.
- labelRatio - Point
- The ratio that describes the point on the label's layout relative to its size.
- labelOffset - Point
- The offset to apply to the point on the label after the ratio has been determined. This defaults to (0,0), representing no further offset.
- angle - number
- The angle by which the label should be rotated around the point described using the ratio and offset, measured in radians. The default is 0.
Returns
- ↪ILabelModelParameter
- A parameter that exactly fits the described location.
Throws
- Exception({ name: 'ArgumentError' })
locationOffset
,labelRatio
orlabelOffset
contains one or more NaN values.
findBestParameter
(label: ILabel, model: ILabelModel, layout: IOrientedRectangle) : ILabelModelParameterTries to find a parameter that best matches the given layout for the provided label instance.
Remarks
This implementation will match the provided layout perfectly.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- label - ILabel
- The label to find a parameter for.
- model - ILabelModel
- The model instance to use. This should be this instance.
- layout - IOrientedRectangle
- The anticipated layout for the label.
Returns
- ↪ILabelModelParameter
- A non-
null
parameter that can be used for the label to approximate the provided layout.
Implements
Returns an empty context.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- label - ILabel
- The label to use in the context.
- layoutParameter - ILabelModelParameter
- The parameter to use for the label in the context.
Returns
- ↪ILookup
- An empty context.
See Also
Implements
Calculates the geometry of the given label using the given model parameter.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- label - ILabel
- The label to calculate the geometry for.
- layoutParameter - ILabelModelParameter
- A parameter that is compatible with this model. Typically, this is a parameter that has been created by this model, and its property model returns this instance.
Returns
- ↪IOrientedRectangle
- An IOrientedRectangle that describes the geometry of the label. This is typically designed as a flyweight, therefore clients should not cache the instance but store the values if they need a snapshot for later use.
Implements
Returns this instance if an instance of ILabelModelParameterFinder is requested and null
otherwise.
Type Parameters
- T: any
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- type - Class<T>
- The type for which an instance is requested.
Returns
- ↪T
- An instance that is assignable to the given type or
null
.
See Also
Implements
Constants
A shared public instance that can be used to obtain parameters.