Skip to main content

Rotate Mode

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

map.gm.enableGlobalRotateMode();
map.gm.disableGlobalRotateMode();
map.gm.toggleGlobalRotateMode();
map.gm.globalRotateModeEnabled();

// Or like this:
map.gm.enableMode('edit', 'rotate');
map.gm.disableMode('edit', 'rotate');
map.gm.toggleMode('edit', 'rotate');
map.gm.isModeEnabled('edit', 'rotate');

The following methods are available on map.gm:

MethodReturnsDescription
enableGlobalRotateMode()-Enables global Rotate Mode.
disableGlobalRotateMode()-Disables global Rotate Mode.
toggleGlobalRotateMode()-Toggles global Rotate Mode.
globalRotateModeEnabled()BooleanReturns true if global Rotate Mode is enabled. false when disabled.

The following events are available on a map instance:

EventParamsDescriptionOutput
gm:rotatestarteventFired when a layer starts being rotated.map, feature, shape
gm:rotateeventFired when a layer is being rotated.map, feature, shape
gm:rotateendeventFired when a layer stops being rotated.map, feature, shape

The following events are available on a map instance:

EventParamsDescriptionOutput
gm:globalrotatemodetoggledeventFired when Rotate Mode is toggled.enabled, map

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

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

Live Rotate Example