Remarks
When set on a WebGL style, instances of this class change the way labels are scaled with the zoom level. Per default, the size of a label in view coordinates scales uniformly with the zoom level. The controlPoints property describes a piecewise linear function that changes the way the label size is scaled with the zoom level. A typical use case is to keep the size of labels constant for all zoom levels or for certain zoom ranges.
The behavior can be turned on and off with start and stop. The behavior is initially enabled.
Instances of this class count toward the global animation limits, each instance requiring one animation slot. Therefore, instances should be shared between items and styles.
This class also scales selection, highlight, and focus indicators. Note that in combination with this feature, for the WebGLLabelIndicatorStyle.zoomPolicy property, only the StyleIndicatorZoomPolicy.WORLD_COORDINATES value is supported.
See Also
API
- zoomScalingPolicy, zoomScalingPolicy
Demos
- Shows label styles that are independent of the zoom level.
Members
Constructors
Parameters
- controlPoints: Point[]
- The control points of the piecewise linear function that defines the label scale. See controlPoints.
- transitionDuration?: TimeSpanconversion
- The duration of the fade transition. Defaults to one second. See transitionDuration.
- transitionEasing?: WebGLAnimationEasingconversion
- The easing of the fade transition. Defaults to no easing. See transitionEasing.
Properties
Gets the control points of the piecewise linear function that defines the label scale.
Defines a piecewise linear function that maps the zoom value to a scale factor for the label size. More precisely, it defines a function s(zoom) that is used to calculate the label size in view coordinates from the size in world coordinates: size_view(zoom) = s(zoom) * size_world. For example, the function for the default zoom behavior would be s(zoom) = zoom. The function for a constant label size would be s(zoom) = 1.
The control points define the piecewise linear function by specifying a set of ordered points that are connected by linear segments. The x-value of each control point is the zoom value, the y-value the corresponding s(zoom) value. The control points must be ordered ascending by their x-values. All x- and y-values must be zero or positive. Positive infinity is allowed for the last x-value. Steps in the function are allowed by specifying two consecutive points with the same x-value but different y-values. If the x-value of the first control point is not 0, a (0,0) control point is automatically prepended. If the x-value of the last control point is not positive infinity, a segment with slope 1 (default scaling) is automatically appended to the end.
This is a read-only array on an immutable instance. Create a new instance if you want to change the values.
Related Programming Samples
- Zoom-invariant Label Style
- Shows label styles that are independent of the zoom level.
See Also
Demos
- Shows label styles that are independent of the zoom level.