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 37

Methods

broadcastFlip(direction)

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

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 685

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 652

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 399

Deserializes the given data

Name Type Description
data Object
Returns:
Type Description
Promise

dispose()

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

Cleans this instance up

export(download){Promise}

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

Exports an image

Name Type Default Description
download Boolean false

= false

Returns:
Type Description
Promise

fixOffset()

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

Makes sure the image stays inside the viewport

getCanvasDimensions(subtractPadding){PhotoEditorSDK.Math.Vector2}

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

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 223

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 285

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 619

Returns the image

Returns:
Type Description
Image

getInputDimensions(){PhotoEditorSDK.Math.Vector2}

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

Returns the input image dimensions

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getOffset(){PhotoEditorSDK.Math.Vector2}

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

Returns the current offset

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getOptions(){Object}

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

Returns the options

Returns:
Type Description
Object

getOutputDimensions(incorporateSpriteScale){PhotoEditorSDK.Math.Vector2}

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

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 275

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 601

Returns the padding values

Returns:
Type Description
Array.<Number>

getRenderer(){PhotoEditorSDK.Engine.BaseRenderer}

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

Returns the renderer

Returns:
Type Description
PhotoEditorSDK.Engine.BaseRenderer

getRotation(){Number}

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

Returns the current rotation

Returns:
Type Description
Number

getSDK(){PhotoEditorSDK}

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

Returns the SDK

Returns:
Type Description
PhotoEditorSDK

getSpriteScale(){Number}

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

Returns the current sprite scale

Returns:
Type Description
Number

getUI(){ReactUI}

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

Returns the UI

Returns:
Type Description
ReactUI

isReady(){Boolean}

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

Checks if the Editor is ready to render

Returns:
Type Description
Boolean

isToolAllowed(identifier){Boolean}

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

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 245

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 452

Requests a render, adds callback to the render callbacks

Name Type Description
callback function optional

reset()

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

Resets everything

serialize(options, version){Promise}

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

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

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 463

Sets the offset to the given one

Name Type Description
offset PhotoEditorSDK.Math.Vector2

setPadding(padding)

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

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

Name Type Description
padding Array.<Number>

setRotation(rotation)

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

Sets the rotation to the given value

Name Type Description
rotation Number

setSpriteScale(spriteScale)

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

Sets the sprite scale to the given value

Name Type Description
spriteScale Number

start()

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

Starts the render loop

stop()

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

Stops the render loop