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 38

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 946

Add a sticker to a given category.

Name Type Description
categoryIdentifier String
stickerObject Object

broadcastFlip(direction)

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

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 837

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 766

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 802

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 782

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 481

Deserializes the given data

Name Type Description
data Object
Returns:
Type Description
Promise

dispose()

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

Cleans this instance up

export(download){Promise}

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

Exports an image

Name Type Default Description
download Boolean false

= false

Returns:
Type Description
Promise

fixOffset()

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

Makes sure the image stays inside the viewport

getCanvasDimensions(subtractPadding){PhotoEditorSDK.Math.Vector2}

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

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 270

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 332

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 740

Returns the image

Returns:
Type Description
Image

getInputDimensions(){PhotoEditorSDK.Math.Vector2}

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

Returns the input image dimensions

Returns:
Type Description
PhotoEditorSDK.Math.Vector2 s

getOptions(){Object}

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

Returns the options

Returns:
Type Description
Object

getOutputDimensions(incorporateSpriteScale){PhotoEditorSDK.Math.Vector2}

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

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 322

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 644

Returns the padding values

Returns:
Type Description
Array.<Number>

getRenderer(){PhotoEditorSDK.Engine.BaseRenderer}

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

Returns the renderer

Returns:
Type Description
PhotoEditorSDK.Engine.BaseRenderer

getRotation(){Number}

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

Returns the current rotation

Returns:
Type Description
Number

getSDK(){PhotoEditorSDK}

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

Returns the SDK

Returns:
Type Description
PhotoEditorSDK

getSnappingOptions(){Object}

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

Returns the snapping options and guides

Returns:
Type Description
Object

getSnapshot(){Object}

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

Get a snapshot to the current editor state

Returns:
Type Description
Object

getSpriteScale(){Number}

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

Returns the current sprite scale

Returns:
Type Description
Number

getUI(){DesktopUI}

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

Returns the UI

Returns:
Type Description
DesktopUI

isReady(){Boolean}

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

Checks if the Editor is ready to render

Returns:
Type Description
Boolean

isToolAllowed(identifier){Boolean}

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

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 292

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 429

loads an document

Name Type Description
download Boolean

= false

Returns:
Type Description
Promise

render(callback)

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

Requests a render, adds callback to the render callbacks

Name Type Description
callback function optional

reset()

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

Resets everything

restoreSnapshot(snapshot)

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

Restore the editor state to the given snapshot

Name Type Description
snapshot Object

save(download){Promise}

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

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 467

Serializes the editor state for the given version

Name Type Default Description
options Object

= {}

version String 3.7.0

= '3.5.0'

Returns:
Type Description
Promise

setImage(image, resetEditor)

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

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 650

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

Name Type Description
padding Array.<Number>

setRotation(rotation)

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

Sets the rotation to the given value

Name Type Description
rotation Number

setSpriteScale(spriteScale)

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

Sets the sprite scale to the given value

Name Type Description
spriteScale Number

start()

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

Starts the render loop

stop()

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

Stops the render loop