Class: Editor

PhotoEditorSDK.UI.ReactUI. Editor

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

new PhotoEditorSDK.UI.ReactUI.Editor()

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

Methods

broadcastCrop(cropOperation, options)

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

Broadcasts a crop to all operations that need to be changed

Name Type Description
cropOperation PhotoEditorSDK.Operations.CropOperation
options Object

broadcastFlip(direction)

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

Broadcasts a flip to all operations that need to be changed

Name Type Description
direction String

broadcastRotate(degrees)

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

Broadcasts a rotation to all operations that need to be changed

Name Type Description
degrees Number

deserialize(data){Promise}

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

Deserializes the given data

Name Type Description
data Object
Returns:
Type Description
Promise

dispose()

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

Cleans this instance up

export(download){Promise}

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

Exports an image

Name Type Default Description
download Boolean false

= false

Returns:
Type Description
Promise

fixOffset()

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

Makes sure the image stays inside the viewport

getCanvasDimensions(subtractPadding){PhotoEditorSDK.Math.Vector2}

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

Returns the canvas dimensions

Name Type Default Description
subtractPadding Boolean true

= true

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getFinalDimensions(incorporateSpriteScale){PhotoEditorSDK.Math.Vector2}

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

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}

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

Returns the image

Returns:
Type Description
Image

getInputDimensions(){PhotoEditorSDK.Math.Vector2}

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

Returns the input image dimensions

Returns:
Type Description
PhotoEditorSDK.Math.Vector2 s

getOffset(){PhotoEditorSDK.Math.Vector2}

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

Returns the current offset

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getOptions(){Object}

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

Returns the options

Returns:
Type Description
Object

getOutputDimensions(incorporateSpriteScale){PhotoEditorSDK.Math.Vector2}

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

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}

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

Returns the output texture's current dimensions

Name Type Default Description
incorporateSpriteScale Boolean false

= false

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

getPadding(){Array.<Number>}

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

Returns the padding values

Returns:
Type Description
Array.<Number>

getRenderer(){PhotoEditorSDK.Engine.BaseRenderer}

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

Returns the renderer

Returns:
Type Description
PhotoEditorSDK.Engine.BaseRenderer

getRotation(){Number}

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

Returns the current rotation

Returns:
Type Description
Number

getSDK(){PhotoEditorSDK}

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

Returns the SDK

Returns:
Type Description
PhotoEditorSDK

getSpriteScale(){Number}

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

Returns the current sprite scale

Returns:
Type Description
Number

getUI(){PhotoEditorSDK.UI.ReactUI}

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

Returns the UI

Returns:
Type Description
PhotoEditorSDK.UI.ReactUI

isReady(){Boolean}

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

Checks if the Editor is ready to render

Returns:
Type Description
Boolean

isToolEnabled(identifier){Boolean}

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

Checks if the control with the tool identifier is enabled

Name Type Description
identifier String
Returns:
Type Description
Boolean

render(callback)

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

Requests a render, adds callback to the render callbacks

Name Type Description
callback function optional

reset()

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

Resets everything

serialize(options, version){Promise}

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

Serializes the editor state for the given version

Name Type Default Description
options Object

= {}

version String 1.0.1

= '1.0.1'

Returns:
Type Description
Promise

setImage(image, resetEditor)

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

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]

setOffset(offset)

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

Sets the offset to the given one

Name Type Description
offset PhotoEditorSDK.Math.Vector2

setPadding(padding)

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

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

Name Type Description
padding Array.<Number>

setRotation(rotation)

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

Sets the rotation to the given value

Name Type Description
rotation Number

setSpriteScale(spriteScale)

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

Sets the sprite scale to the given value

Name Type Description
spriteScale Number

start()

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

Starts the render loop

stop()

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

Stops the render loop