C

WebGLZoomScalingPolicy

Modifies the label size scaling for certain zoom levels when rendering in WebGL mode.
Inheritance Hierarchy

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

No filters for this type

Constructors

Creates a new policy for scaling labels depending on the current zoom level with the specified parameters.
Instances of this class count toward the global animation limits, each instance requiring one animation slot. Therefore, instances should be shared between WebGLLabelStyle instances.

Parameters

controlPoints: Point[]
The control points of the piecewise linear function that defines the label scale. See controlPoints.
transitionDuration?: TimeSpan
conversion
The duration of the fade transition. Defaults to one second. See transitionDuration.
transitionEasing?: WebGLAnimationEasing
conversion
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.

readonlyfinal

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.
Gets the transition duration when starting or stopping or when a step in label size is encountered.
readonlyfinal
Gets the transition easing when starting or stopping or when a step in label size is encountered.
readonlyfinal

Methods

Restarts the behavior after it has been stopped.
Gradually changes the label size to the size defined by controlPoints. The behavior is initially active.
final

Return Value

Promise<boolean>
A promise that will resolve when the initial transition has finished. Will resolve immediately if no transition is necessary. The promise will resolve to true if the transition successfully finished and false if the transition was interrupted by stop.
Stops the behavior.
Gradually changes the label size to the default size. When invoked before this instance has been assigned to an item, there will be no transition. This allows to assign this behavior to items in an inactive state before turning it on later.
final

Return Value

Promise<boolean>
A promise that will resolve when the initial transition has finished. Will resolve immediately if no transition is necessary. The promise will resolve to true if the transition successfully finished and false if the transition was interrupted by start.