Class: Editor

PhotoEditorSDK.UI~ReactUI~ Editor

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

new Editor()

ui/react-ui/lib/editor.js, line 36

Methods

broadcastFlip(direction)

ui/react-ui/lib/editor.js, line 662

Broadcasts a flip to all operations that need to be changed

Name Type Description
direction String

broadcastRotate(degrees)

ui/react-ui/lib/editor.js, line 677

Broadcasts a rotation to all operations that need to be changed

Name Type Description
degrees Number

broadcastTransform(transformOperation, options)

ui/react-ui/lib/editor.js, line 644

Broadcasts a transform to all operations that need to be changed

Name Type Description
transformOperation PhotoEditorSDK.Operations.TransformOperation
options Object

deserialize(data){Promise}

ui/react-ui/lib/editor.js, line 395

Deserializes the given data

Name Type Description
data Object
Returns:
Type Description
Promise

dispose()

ui/react-ui/lib/editor.js, line 561

Cleans this instance up

export(download){Promise}

ui/react-ui/lib/editor.js, line 327

Exports an image

Name Type Default Description
download Boolean false

= false

Returns:
Type Description
Promise

fixOffset()

ui/react-ui/lib/editor.js, line 474

Makes sure the image stays inside the viewport

getCanvasDimensions(subtractPadding){PhotoEditorSDK.Math.Vector2}

ui/react-ui/lib/editor.js, line 291

Returns the canvas dimensions

Name Type Default Description
subtractPadding Boolean true

= true

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getCrossOrigin()

ui/react-ui/lib/editor.js, line 220

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

Returns:
String

getFinalDimensions(incorporateSpriteScale){PhotoEditorSDK.Math.Vector2}

ui/react-ui/lib/editor.js, line 282

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/react-ui/lib/editor.js, line 615

Returns the image

Returns:
Type Description
Image

getInputDimensions(){PhotoEditorSDK.Math.Vector2}

ui/react-ui/lib/editor.js, line 591

Returns the input image dimensions

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getOffset(){PhotoEditorSDK.Math.Vector2}

ui/react-ui/lib/editor.js, line 467

Returns the current offset

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getOptions(){Object}

ui/react-ui/lib/editor.js, line 623

Returns the options

Returns:
Type Description
Object

getOutputDimensions(incorporateSpriteScale){PhotoEditorSDK.Math.Vector2}

ui/react-ui/lib/editor.js, line 263

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/react-ui/lib/editor.js, line 272

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/react-ui/lib/editor.js, line 597

Returns the padding values

Returns:
Type Description
Array.<Number>

getRenderer(){PhotoEditorSDK.Engine.BaseRenderer}

ui/react-ui/lib/editor.js, line 579

Returns the renderer

Returns:
Type Description
PhotoEditorSDK.Engine.BaseRenderer

getRotation(){Number}

ui/react-ui/lib/editor.js, line 186

Returns the current rotation

Returns:
Type Description
Number

getSDK(){PhotoEditorSDK}

ui/react-ui/lib/editor.js, line 585

Returns the SDK

Returns:
Type Description
PhotoEditorSDK

getSpriteScale(){Number}

ui/react-ui/lib/editor.js, line 202

Returns the current sprite scale

Returns:
Type Description
Number

getUI(){ReactUI}

ui/react-ui/lib/editor.js, line 631

Returns the UI

Returns:
Type Description
ReactUI

isReady(){Boolean}

ui/react-ui/lib/editor.js, line 573

Checks if the Editor is ready to render

Returns:
Type Description
Boolean

isToolAllowed(identifier){Boolean}

ui/react-ui/lib/editor.js, line 231

Checks if the given tool is allowed by the license

Name Type Description
identifier String
Returns:
Type Description
Boolean

isToolEnabled(identifier){Boolean}

ui/react-ui/lib/editor.js, line 242

Checks if the control with the tool identifier is enabled

Name Type Description
identifier String
Returns:
Type Description
Boolean

render(callback)

ui/react-ui/lib/editor.js, line 448

Requests a render, adds callback to the render callbacks

Name Type Description
callback function optional

reset()

ui/react-ui/lib/editor.js, line 549

Resets everything

serialize(options, version){Promise}

ui/react-ui/lib/editor.js, line 381

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/react-ui/lib/editor.js, line 82

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

setOffset(offset)

ui/react-ui/lib/editor.js, line 459

Sets the offset to the given one

Name Type Description
offset PhotoEditorSDK.Math.Vector2

setPadding(padding)

ui/react-ui/lib/editor.js, line 603

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

Name Type Description
padding Array.<Number>

setRotation(rotation)

ui/react-ui/lib/editor.js, line 194

Sets the rotation to the given value

Name Type Description
rotation Number

setSpriteScale(spriteScale)

ui/react-ui/lib/editor.js, line 210

Sets the sprite scale to the given value

Name Type Description
spriteScale Number

start()

ui/react-ui/lib/editor.js, line 428

Starts the render loop

stop()

ui/react-ui/lib/editor.js, line 436

Stops the render loop