Class: Transform

ol.interaction. Transform


new Transform(options)

Interaction rotate

Parameters:
Name Type Description
options any
Properties
Name Type Description
filter function

A function that takes a Feature and a Layer and returns true if the feature may be transformed or false otherwise.

layers Array.<ol.Layer>

array of layers to transform,

features ol.Collection.<ol.Feature>

collection of feature to transform,

addCondition ol.EventsConditionType | undefined

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. default: ol.events.condition.never.

hitTolerance number | undefined

Tolerance to select feature in pixel, default 0

translateFeature bool

Translate when click on feature

translate bool

Can translate the feature

stretch bool

can stretch the feature

scale bool

can scale the feature

rotate bool

can rotate the feature

noFlip bool

prevent the feature geometry to flip, default false

selection bool

the intraction handle selection/deselection, if not use the select prototype to add features to transform, default true

keepAspectRatio ol.events.ConditionType | undefined

A function that takes an ol.MapBrowserEvent and returns a boolean to keep aspect ratio, default ol.events.condition.shiftKeyOnly.

modifyCenter ol.events.ConditionType | undefined

A function that takes an ol.MapBrowserEvent and returns a boolean to apply scale & strech from the center, default ol.events.condition.metaKey or ol.events.condition.ctrlKey.

style

list of ol.style for handles

Fires:
  • (event:select|rotatestart|rotating|rotateend|translatestart|translating|translateend|scalestart|scaling|scaleend)

Extends

  • ol.interaction.Pointer

Members


Cursors

Cursors for transform


style

Style for handles

Methods


drawSketch_(draw)

Draw transform sketch

Parameters:
Name Type Description
draw boolean

only the center


getCenter()

Get the rotation center

Returns:
Type
ol.coordinates | undefined

getFeatures()

Get features to transform

Returns:
Type
Array.<ol.Feature>

handleDownEvent_(evt)

Parameters:
Name Type Description
evt ol.MapBrowserEvent

Map browser event.

Returns:

true to start the drag sequence.

Type
boolean

handleDragEvent_(evt)

Parameters:
Name Type Description
evt ol.MapBrowserEvent

Map browser event.


handleMoveEvent_(evt)

Parameters:
Name Type Description
evt ol.MapBrowserEvent

Event.


handleUpEvent_(evt)

Parameters:
Name Type Description
evt ol.MapBrowserEvent

Map browser event.

Returns:

false to stop the drag sequence.

Type
boolean

select(feature, add)

Select a feature to transform

Parameters:
Name Type Description
feature ol.Feature

the feature to transform

add boolean

true to add the feature to the selection, default false


setActive(b)

Activate/deactivate interaction

Parameters:
Name Type Description
b bool

setCenter(c)

Set the rotation center

Parameters:
Name Type Description
c ol.coordinates | undefined

the center point, default center on the objet


setDefaultStyle()

Set efault sketch style


setMap(map)

Remove the interaction from its current map, if any, and attach it to a new map, if any. Pass null to just remove the interaction from the current map.

Parameters:
Name Type Description
map ol.Map

Map.


setStyle(map)

Set sketch style.

Parameters:
Name Type Description
map ol.Map

Map.