Class: Editor

PhotoEditorSDK.UI~DesktopUI~ Editor

The Editor class is an interface to the SDK, managing operations, rendering, history, zoom etc.

new Editor()

ui/desktop-ui/core/lib/editor.js, line 37

Members

isDraggableBoolean

Checks if the image is draggable

Returns the current offset

offset

Sets the offset to the given vector

Methods

addSticker(categoryIdentifier, stickerObject)

ui/desktop-ui/core/lib/editor.js, line 938

Add a sticker to a given category.

Name Type Description
categoryIdentifier String
stickerObject Object

broadcastFlip(direction)

ui/desktop-ui/core/lib/editor.js, line 818

Broadcasts a flip to all operations that need to be changed

Name Type Description
direction String

broadcastRotate(degrees)

ui/desktop-ui/core/lib/editor.js, line 833

Broadcasts a rotation to all operations that need to be changed

Name Type Description
degrees Number

broadcastScale(scale)

ui/desktop-ui/core/lib/editor.js, line 762

Broadcasts a scaling to all operations that need to be changed. These operations include ones that store absolute values (e.g. sprite operation which holds sticker dimensions in absolute values)

Name Type Description
scale PhotoEditorSDK.Math.Vector2

broadcastTemporaryTransform(transformOperation, options)

ui/desktop-ui/core/lib/editor.js, line 798

Broadcasts a temporary transform to all operations that need to be changed This change should not be applied immediately, but only in case of an export

Name Type Description
transformOperation PhotoEditorSDK.Operations.TransformOperation
options Object

broadcastTransform(transformOperation, options)

ui/desktop-ui/core/lib/editor.js, line 778

Broadcasts a transform to all operations that need to be changed

Name Type Description
transformOperation PhotoEditorSDK.Operations.TransformOperation
options Object

deserialize(data){Promise}

ui/desktop-ui/core/lib/editor.js, line 477

Deserializes the given data

Name Type Description
data Object
Returns:
Type Description
Promise

dispose()

ui/desktop-ui/core/lib/editor.js, line 604

Cleans this instance up

export(download){Promise}

ui/desktop-ui/core/lib/editor.js, line 374

Exports an image

Name Type Default Description
download Boolean false

= false

Returns:
Type Description
Promise

fixOffset()

ui/desktop-ui/core/lib/editor.js, line 209

Makes sure the image stays inside the viewport

getCanvasDimensions(subtractPadding){PhotoEditorSDK.Math.Vector2}

ui/desktop-ui/core/lib/editor.js, line 338

Returns the canvas dimensions

Name Type Default Description
subtractPadding Boolean true

= true

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getCrossOrigin()

ui/desktop-ui/core/lib/editor.js, line 267

Returns the crossOrigin value to be set to image elements, according to the passed crossOrigin option.

Returns:
String

getFinalDimensions(incorporateSpriteScale){PhotoEditorSDK.Math.Vector2}

ui/desktop-ui/core/lib/editor.js, line 329

Returns the final dimensions that the input image would have after all existing operations have been applied

Name Type Default Description
incorporateSpriteScale Boolean false

= false

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getImage(){Image}

ui/desktop-ui/core/lib/editor.js, line 736

Returns the image

Returns:
Type Description
Image

getInputDimensions(){PhotoEditorSDK.Math.Vector2}

ui/desktop-ui/core/lib/editor.js, line 634

Returns the input image dimensions

Returns:
Type Description
PhotoEditorSDK.Math.Vector2 s

getOptions(){Object}

ui/desktop-ui/core/lib/editor.js, line 744

Returns the options

Returns:
Type Description
Object

getOutputDimensions(incorporateSpriteScale){PhotoEditorSDK.Math.Vector2}

ui/desktop-ui/core/lib/editor.js, line 310

Returns the output sprite's current dimensions

Name Type Default Description
incorporateSpriteScale Boolean false

= false

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getOutputTextureDimensions(incorporateSpriteScale){PhotoEditorSDK.Math.Vector2}

ui/desktop-ui/core/lib/editor.js, line 319

Returns the output texture's current dimensions

Name Type Default Description
incorporateSpriteScale Boolean false

= false

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getPadding(){Array.<Number>}

ui/desktop-ui/core/lib/editor.js, line 640

Returns the padding values

Returns:
Type Description
Array.<Number>

getRenderer(){PhotoEditorSDK.Engine.BaseRenderer}

ui/desktop-ui/core/lib/editor.js, line 622

Returns the renderer

Returns:
Type Description
PhotoEditorSDK.Engine.BaseRenderer

getRotation(){Number}

ui/desktop-ui/core/lib/editor.js, line 233

Returns the current rotation

Returns:
Type Description
Number

getSDK(){PhotoEditorSDK}

ui/desktop-ui/core/lib/editor.js, line 628

Returns the SDK

Returns:
Type Description
PhotoEditorSDK

getSnappingOptions(){Object}

ui/desktop-ui/core/lib/editor.js, line 658

Returns the snapping options and guides

Returns:
Type Description
Object

getSnapshot(){Object}

ui/desktop-ui/core/lib/editor.js, line 905

Get a snapshot to the current editor state

Returns:
Type Description
Object

getSpriteScale(){Number}

ui/desktop-ui/core/lib/editor.js, line 249

Returns the current sprite scale

Returns:
Type Description
Number

getUI(){DesktopUI}

ui/desktop-ui/core/lib/editor.js, line 752

Returns the UI

Returns:
Type Description
DesktopUI

isReady(){Boolean}

ui/desktop-ui/core/lib/editor.js, line 616

Checks if the Editor is ready to render

Returns:
Type Description
Boolean

isToolAllowed(identifier){Boolean}

ui/desktop-ui/core/lib/editor.js, line 278

Checks if the given tool is allowed by the license

Name Type Description
identifier String
Returns:
Type Description
Boolean

isToolEnabled(identifier){Boolean}

ui/desktop-ui/core/lib/editor.js, line 289

Checks if the control with the tool identifier is enabled

Name Type Description
identifier String
Returns:
Type Description
Boolean

load(download){Promise}

ui/desktop-ui/core/lib/editor.js, line 426

loads an document

Name Type Description
download Boolean

= false

Returns:
Type Description
Promise

render(callback)

ui/desktop-ui/core/lib/editor.js, line 529

Requests a render, adds callback to the render callbacks

Name Type Description
callback function optional

reset()

ui/desktop-ui/core/lib/editor.js, line 588

Resets everything

restoreSnapshot(snapshot)

ui/desktop-ui/core/lib/editor.js, line 918

Restore the editor state to the given snapshot

Name Type Description
snapshot Object

save(download){Promise}

ui/desktop-ui/core/lib/editor.js, line 406

saves an document

Name Type Default Description
download Boolean false

= false

Returns:
Type Description
Promise

serialize(options, version){Promise}

ui/desktop-ui/core/lib/editor.js, line 463

Serializes the editor state for the given version

Name Type Default Description
options Object

= {}

version String 3.6.0

= '3.5.0'

Returns:
Type Description
Promise

setImage(image, resetEditor)

ui/desktop-ui/core/lib/editor.js, line 93

Sets the given image to be rendered. If the image needs to be resized to fit into a WebGL texture or to match the maxMegaPixels option, resizing is done before setting the image.

Name Type Default Description
image Image
resetEditor Boolean true

[description]

setPadding(padding)

ui/desktop-ui/core/lib/editor.js, line 646

Sets the padding (top, right, bottom, left)

Name Type Description
padding Array.<Number>

setRotation(rotation)

ui/desktop-ui/core/lib/editor.js, line 241

Sets the rotation to the given value

Name Type Description
rotation Number

setSpriteScale(spriteScale)

ui/desktop-ui/core/lib/editor.js, line 257

Sets the sprite scale to the given value

Name Type Description
spriteScale Number

start()

ui/desktop-ui/core/lib/editor.js, line 510

Starts the render loop

stop()

ui/desktop-ui/core/lib/editor.js, line 517

Stops the render loop