Skip to main content

Scale Mode ⭐

Scale Mode ⭐

You can enable Scale Mode for all layers on a map like this:

map.pm.enableGlobalScaleMode();

With the option centerScaling the scale origin cen be the center of the layer or the opposite corner of the dragged marker. If false Alt-Key can be used. The option uniformScaling the scales the width and the height with the same ratio. If false Shift-Key can be used.

The following methods are available on map.pm:

MethodReturnsDescription
enableGlobalScaleMode()-Enables global Scale Mode.
disableGlobalScaleMode()-Disables global Scale Mode.
toggleGlobalScaleMode()-Toggles global Scale Mode.
globalScaleModeEnabled()BooleanReturns true if global Scale Mode is enabled. false when disabled.

The following methods are available for layers under layer.pm:

MethodReturnsDescription
enableScale()-Enables Scale Mode on the layer.
disableScale()-Disables Scale Mode on the layer.
scaleEnabled()BooleanReturns if Scale Mode is enabled for the layer.
scaleLayer(percent)-Scale the layer by x percent. Also an Object with {w: width, h: height} can be passed. Scale up > 0 , scale down < 0.

The following events are available on a layer instance:

EventParamsDescriptionOutput
pm:scaleenableeFired when scale is enabled for a layer.layer, helpLayer
pm:scaledisableeFired when scale is disabled for a layer.layer
pm:scalestarteFired when scale starts on a layer.layer, helpLayer, originLatLngs, originLatLngs
pm:scaleeFired when a layer is scaled.layer, helpLayer, oldLatLngs, newLatLngs
pm:scaleendeFired when scale ends on a layer.layer, helpLayer, originLatLngs, newLatLngs

The following events are available on a map instance:

EventParamsDescriptionOutput
pm:globalscalemodetoggledeFired when Scale Mode is toggled.enabled, map
pm:scaleenableeFired when scale is enabled for a layer.layer, helpLayer
pm:scaledisableeFired when scale is disabled for a layer.layer
pm:scalestarteFired when scale starts on a layer.layer, helpLayer, originLatLngs, originLatLngs
pm:scaleeFired when a layer is scaled.layer, helpLayer, oldLatLngs, newLatLngs
pm:scaleendeFired when scale ends on a layer.layer, helpLayer, originLatLngs, newLatLngs