Skip to main content

Scale Mode

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

map.gm.enableMode('edit', 'scale');
map.gm.disableMode('edit', 'scale');
map.gm.toggleMode('edit', 'scale');
map.gm.isModeEnabled('edit', 'scale');

The following methods are available on map.gm:

MethodReturnsDescription
enableMode('edit', 'scale')-Enables global Scale Mode.
disableMode('edit', 'scale')-Disables global Scale Mode.
toggleMode('edit', 'scale')-Toggles global Scale Mode.
isModeEnabled('edit', 'scale')BooleanReturns true if global Scale Mode is enabled. false when disabled.

The following events are available on a map instance:

EventParamsDescriptionOutput
gm:scalestarteventFired when a layer starts being scaled.map, feature, shape
gm:scaleeventFired when a layer is being scaled.map, feature, shape
gm:scaleendeventFired when a layer stops being scaled.map, feature, shape

The following events are available on a map instance:

EventParamsDescriptionOutput
gm:globalscalemodetoggledeventFired when Scale Mode is toggled.enabled, map

You can also listen to specific Scale Mode events on the map instance like this:

map.on('gm:globalscalemodetoggled', (event) => {
console.log(event);
});

Supported Features

Scale mode supports the following feature types:

  • Polygons
  • Rectangles
  • Lines
  • Circles

When scaling, the feature will maintain its proportions relative to its centroid point. For rectangles, the scaling operation preserves the rectangular shape while adjusting its size.

Live Scale Example

Building something complex? Our team can help with architecture and integration. Get in touch →