Packageardisia.components.graphicsEditor
Classpublic class GraphicsEditor
InheritanceGraphicsEditor Inheritance spark.components.supportClasses.SkinnableComponent
Implements mx.managers.IFocusManagerComponent

Component that can be used to manipulate bitmap data, vector shapes, and text objects.

View the technical documentation on the Ardisia Labs website for more information.



Public Properties
 PropertyDefined By
  autoScrollThreshold : Number = 50
Defines the threshold from the boundaries of the viewport in which to trigger automatic scrolling during a dragging operation.
GraphicsEditor
  bitmapLassoShape : String = rectangle
Shape of bitmap lasso.
GraphicsEditor
  brushAlpha : Number = 0.5
Alpha of the brush stroke (if applicable).
GraphicsEditor
  brushColor : uint = 0
The color of the brush (if applicable).
GraphicsEditor
  brushMode : String = draw
The brush mode.
GraphicsEditor
  brushShape : String = circle
The shape of the brush (if applicable).
GraphicsEditor
  brushSize : Number
The size of the brush in pixels.
GraphicsEditor
  brushStrength : Number = 0.5
Strength of the brush (if applicable).
GraphicsEditor
  canvasBackgroundColor : Number
The background color for the canvas.
GraphicsEditor
  cropRectangle : Rectangle
The current dimensions and position of the crop rectangle relative to the canvasPart.
GraphicsEditor
  fillColor : uint = 0xFFFFFF
The color of fills.
GraphicsEditor
  floodFillAlpha : Number = 1
Alpha of the flood fill.
GraphicsEditor
  floodFillAntiAlias : Boolean = false
Smooth the flood fill outline.
GraphicsEditor
  floodFillColor : uint = 0
Flood fill color.
GraphicsEditor
  floodFillTolerance : Number = 10
Tolerance for flood fills.
GraphicsEditor
  graphicObjects : Vector.<GraphicObjectBase>
[read-only] Vector of all the graphic objects displayed within the canvas.
GraphicsEditor
  groupedGraphicObjects : Array
An array of the grouped graphic objects.
GraphicsEditor
  interactionMode : String
Sets the current interaction mode for the editor.
GraphicsEditor
  maxUndo : int = 20
Maximum number of undo/redo steps.
GraphicsEditor
  selectedGraphicObjects : Vector.<GraphicObjectBase>
A vector of the selected visual graphic objects.
GraphicsEditor
  shapeType : String = rectangle
Set the shape to draw during vector drawing.
GraphicsEditor
  showHoverIndicator : Boolean
True to display the hoverIndicatorPart when mousing over child visual elements.
GraphicsEditor
  strokeColor : uint = 0
The color of strokes.
GraphicsEditor
  transformConstrainProportions : Boolean
True for object transformations to maintain the object aspect ratios.
GraphicsEditor
  wandAntiAlias : Boolean = false
Smooth the wand outline.
GraphicsEditor
  wandFillTolerance : Number = 10
Tolerance for wand selection lassos.
GraphicsEditor
  zoomFactor : Number
The zoom applied to the canvas.
GraphicsEditor
  zoomLevels : Array
The zoom levels used by the zoom pointer mode to zoom.
GraphicsEditor
Protected Properties
 PropertyDefined By
  _editorStates : Vector.<EditorState>
GraphicsEditor
  _redoStates : Vector.<EditorState>
GraphicsEditor
Public Methods
 MethodDefined By
  
addBitmapGraphicObject(bmd:BitmapData, xPosition:Number = 0, yPosition:Number = 0):BitmapGraphicObject
Add the passed bitmap data as a graphicObject.
GraphicsEditor
  
Add the passed graphicObject to the canvas.
GraphicsEditor
  
addTextGraphicObject(xPosition:Number = 0, yPosition:Number = 0):TextGraphicObject
Add a TextGraphicObject.
GraphicsEditor
  
Adds the selection indicators and transform pips to the selected graphicObjects.
GraphicsEditor
  
changeSelectedObjectsDepths(forward:Boolean = true, max:Boolean = false):void
Change the depth for the selected graphic objects (z index).
GraphicsEditor
  
Clear selection.
GraphicsEditor
  
copyBitmapLasso(cut:Boolean = false):void
Copy or cut the bitmap data selected via a lasso.
GraphicsEditor
  
crop():void
Crops the canvas to the region contained within the crop lasso.
GraphicsEditor
  
exportBitmapData(allowTransparency:Boolean = true):BitmapData
Get the bitmapData for the canvas.
GraphicsEditor
  
fitCanvasToContent(includeFilters:Boolean = false):void
Size the canvas to just fit the content.
GraphicsEditor
  
Flattens the selected graphic object(s) into a single BitmapGraphicObject.
GraphicsEditor
  
flipSelectedGraphicObjects(horizontal:Boolean = true):void
Flip the selected graphic objects horizontally or vertically.
GraphicsEditor
  
Returns a vector of the selected GraphicObject(s) sorted by depth (lowest to highest).
GraphicsEditor
  
getTransformRectangle2(targetSpace:IVisualElement, contextGraphicObjects:Vector.<GraphicObjectBase> = null, includeFilters:Boolean = false):Rectangle
Return the transform lasso rectangle that bounds all the selected or passed GraphicsObject(s).
GraphicsEditor
  
getVisibleCanvas():Rectangle
Return the rectangle for the visible portion of the canvas in canvas coordinate space.
GraphicsEditor
  
Group the selected GraphicObjects together without flattening them.
GraphicsEditor
  
redo():void
Redo the state that was undone.
GraphicsEditor
  
Remove all the graphicObjects from the canvas.
GraphicsEditor
  
Remove the passed graphicObject
GraphicsEditor
  
Remove all the selected graphicObjects from the canvas.
GraphicsEditor
  
Remove any grouping on the selected graphicObjects.
GraphicsEditor
  
rotateSelectedGraphicObjects(angle:Number):void
Rotate the selected graphicObjects by the passed angle.
GraphicsEditor
  
selectAll():void
Select all graphic objects.
GraphicsEditor
  
setCanvasColor(color:Number = 0xFFFFFF):void
Set the background color of the canvas.
GraphicsEditor
  
setCanvasSize(canvasWidth:Number = 500, canvasHeight:Number = 500):void
Set the dimensions of the canvas.
GraphicsEditor
  
setCropRectangle(rect:Rectangle):void
Set the crop rectangle position.
GraphicsEditor
  
undo():void
Restore the last state.
GraphicsEditor
  
Update the editor state that can be undone.
GraphicsEditor
  
zoomIn():void
Zoom in to the next zoom level.
GraphicsEditor
  
zoomOut():void
Zoom out to the next zoom level.
GraphicsEditor
  
zoomToFit():void
Set the zoom factor to fit the content in the viewport without any scrolling
GraphicsEditor
Protected Methods
 MethodDefined By
  
bitmapLassoModeHandler(event:Event):void
Handles events related to the bitmap lasso interaction modes.
GraphicsEditor
  
brushModeHandler(event:Event):void
Handles events related to the "brush" interactionMode.
GraphicsEditor
  
captureLasso(object:BitmapGraphicObject, lassoBitmap:BitmapData):BitmapData
Capture the bitmapData stored inside the bitmap lasso.
GraphicsEditor
  
Checks if the mouse is within the autoscroll threshold during drag operations.
GraphicsEditor
  
Called continuously when the selection lasso is dragging to detect the selected graphicObjects.
GraphicsEditor
  
Clears the auto scrolling timer.
GraphicsEditor
  
Clears all lassos.
GraphicsEditor
  
commitBrush(xPosition:Number, yPosition:Number):void
Commit the brush.
GraphicsEditor
  
cropLassoPartHandler(event:Event):void
Handles events for the crop lasso part.
GraphicsEditor
  
cropModeHandler(event:Event):void
Handles events related to the "crop" interactionMode.
GraphicsEditor
  
drawBrush():void
Create a shape used to work with bitmap data and commit the brush to bitmap data.
GraphicsEditor
  
eventHandler(event:Event):void
Handles events on the control.
GraphicsEditor
  
floodFillModeHandler(event:Event):void
Handles events related to the "floodFill" interactionMode.
GraphicsEditor
  
getFloodFillBitmapData(bmd:BitmapData, x:Number, y:Number, fillColor:uint = 0, tolerance:Number = 10, antiAlias:Boolean = true):BitmapData
Returns the flood fill bitmap data.
GraphicsEditor
  
Return the currently hovered graphicObject (if any).
GraphicsEditor
  
getPipName(pip:IVisualElement):String
Return the English description of which pip is passed.
GraphicsEditor
  
grabberModeHandler(event:Event):void
Handles events related to the "grabber" interactionMode.
GraphicsEditor
  
handleSelection(element:GraphicObjectBase, event:MouseEvent = null):void
Takes the passed GraphicObject and the mouse event that occurred contextually in relation to the passed GraphicObject and figures out how to adjust the selected GraphicObject(s).
GraphicsEditor
  
isElementSelected(element:IVisualElement):Boolean
Checks whether the passed element is in the selectedGraphicObjects vector.
GraphicsEditor
  
Position the fake cursor.
GraphicsEditor
  
removeAllDynamicParts(factory:String):void
Remove all instances of the passed dynamic part factory.
GraphicsEditor
  
Remove the fake cursor.
GraphicsEditor
  
Trim the transparent border for the passed BitmapGraphicObject.
GraphicsEditor
  
Trim the transparent border for all the BitmapGraphicObject(s).
GraphicsEditor
  
Reorder the depths of the GraphicObject(s) from 0 to max.
GraphicsEditor
  
restoreState(redo:Boolean = false):void
Update the editor state.
GraphicsEditor
  
selectionModeHandler(event:Event):void
Handles events related to the selection interaction modes.
GraphicsEditor
  
setCursorFromCSS(bitmapStyle:String, hotspotStyle:String, groupName:String, priority:Number):Boolean
Set the cursor based on a CSS style.
GraphicsEditor
  
setHover(currentHover:GraphicObjectBase):void
Sets the hover indicator.
GraphicsEditor
  
setResizeCursor(name:String, priority:Number, groupName:String):void
Set the current cursor to the resize cursor.
GraphicsEditor
  
setSelection(selection:Vector.<GraphicObjectBase>):void
Update the selected objects and determine if a selection "change" event should be dispatched.
GraphicsEditor
  
Create and draw the fake cursor.
GraphicsEditor
  
sortGraphicObjectsByDepth(a:Object, b:Object):int
Sorting function to sort the depth of GraphicObject(s).
GraphicsEditor
  
textModeHandler(event:Event):void
Handles events related to the "text" interactionMode.
GraphicsEditor
  
transformPipHandler(event:Event):void
Handles all transform events and transform dragging.
GraphicsEditor
  
trimTransparentBorder(bmd:BitmapData):Array
Trim any transparent border from the passed bitmap data.
GraphicsEditor
  
Update the canvas background skin part.
GraphicsEditor
  
Update the current interaction mode.
GraphicsEditor
  
updateZoom(scaleFactor:Number, zoomOnCursor:Boolean = false):void
Update the canvas zoom and zoom in/out centered on the middle of visible region of the viewport.
GraphicsEditor
  
vectorModeHandler(event:Event):void
Handles events related to the "vector" interactionMode.
GraphicsEditor
  
wandModeHandler(event:Event):void
Handles events related to the "wand" interactionMode.
GraphicsEditor
  
zoomModeHandler(event:Event):void
Handles events related to the "zoom" interactionMode.
GraphicsEditor
Events
 Event Summary Defined By
  Dispatched when the bitmap lasso data changes.GraphicsEditor
  Dispatched when the crop rectangle changes.GraphicsEditor
  Dispatched when the editor states are updated via undo/redo.GraphicsEditor
  Dispatched when a visual element drag ends.GraphicsEditor
  Dispatched while a visual element is being dragged.GraphicsEditor
  Dispatched when a visual element drag begins.GraphicsEditor
  Dispatched a graphic object is removed from the canvas.GraphicsEditor
  Dispatched a graphic object is added to the canvas.GraphicsEditor
  Dispatched when the currently selected graphic objects change.GraphicsEditor
  Dispatched when a text editing session begins.GraphicsEditor
  Dispatched when a transform ends.GraphicsEditor
  Dispatched when a transform is in progress.GraphicsEditor
  Dispatched when a transform begins.GraphicsEditor
  Dispatched after the initial drag for a vector object is complete.GraphicsEditor
  Dispatched when the zoom factor changes.GraphicsEditor
Styles
 Style Description Defined By
  
borderAlpha
Type: Number CSS Inheritance: no
Border Alpha.
GraphicsEditor
  
borderColor
Type: uint Format: Color CSS Inheritance: no
Border color.
GraphicsEditor
  
borderVisible
Type: Boolean CSS Inheritance: no
True to display a border. The default value is true.
GraphicsEditor
  
cropCursor
Type: Class CSS Inheritance: no
Embedded graphics class for the cursor used to start crop operations.
GraphicsEditor
  
cropCursorHotSpot
Type: Array CSS Inheritance: no
The hot spot for the crop cursor.
GraphicsEditor
  
floodFillCursor
Type: Class CSS Inheritance: no
Embedded graphics class for the cursor used for flood fill.
GraphicsEditor
  
floodFillHotSpot
Type: Array CSS Inheritance: no
The hot spot for the flood fill cursor.
GraphicsEditor
  
moveCursor
Type: Class CSS Inheritance: no
Embedded graphics class for the cursor used to move elements.
GraphicsEditor
  
moveCursorHotSpot
Type: Array CSS Inheritance: no
The hot spot for the move cursor.
GraphicsEditor
  
rotateCursor
Type: Class CSS Inheritance: no
Embedded graphics class for the cursor used to rotate graphic objects. If not set, will use the DefaultCursor.
GraphicsEditor
  
rotateCursorHotspot
Type: Array CSS Inheritance: no
The hot spot for the rotate cursor.
GraphicsEditor
  
wandCursor
Type: Class CSS Inheritance: no
Embedded graphics class for the cursor used for the magic wand tool.
GraphicsEditor
  
wandHotSpot
Type: Array CSS Inheritance: no
The hot spot for the magic wand cursor.
GraphicsEditor
  
zoomInCursor
Type: Class CSS Inheritance: no
Embedded graphics class for the cursor used to zoom in on the canvas at the position of the mouse cursor.
GraphicsEditor
  
zoomInCursorHotSpot
Type: Array CSS Inheritance: no
The hot spot for the zoom in cursor.
GraphicsEditor
  
zoomOutCursor
Type: Class CSS Inheritance: no
Embedded graphics class for the cursor used to zoom out on the canvas at the position of the mouse cursor.
GraphicsEditor
  
zoomOutCursorHotSpot
Type: Array CSS Inheritance: no
The hot spot for the zoom out cursor.
GraphicsEditor
Skin Parts

This component uses skins made up of skin parts. Do not set the skin parts directly. The component's skin sets the skin parts.


 Skin Part Description Defined By
  
canvasBackgroundPart:CanvasBackground
Required: false Part Type: Static
Draws the background for the canvas. Can display a transparent pattern. Will not be captured when graphic object bitmapData is extracted.
GraphicsEditor
  
canvasPart:spark.components.Group
Required: true Part Type: Static
Container for the graphic objects. Will be used to extract the canvas bitmapData. Can be zoomed.
GraphicsEditor
  
cropLassoFactoryPart:mx.core.IFactory
Required: false Part Type: Dynamic
Factory that creates the crop lasso.

The IFactory must return an object of type CropLasso
GraphicsEditor
  
hoverIndicatorFactoryPart:mx.core.IFactory
Required: false Part Type: Dynamic
Indicator to display over hovered elements if the "showHoverIndicator" property is true.

The IFactory must return an object of type IVisualElement
GraphicsEditor
  
resizeCursorFactoryPart:mx.core.IFactory
Required: false Part Type: Dynamic
Cursor to use for resize operations. Skin part to facilitate vector drawing for a better rotated appearance over a bitmap cursor. The hotspot is assumed to be in the center of the skin part. Will be displayed by the Ardisia CursorManager class.

The IFactory must return an object of type IVisualElement
GraphicsEditor
  
scrollerPart:spark.components.Scroller
Required: true Part Type: Static
Scroller to wrap the contents.
GraphicsEditor
  
selectionIndicatorFactoryPart:mx.core.IFactory
Required: false Part Type: Dynamic
Indicator to display over selected graphic objects if the "showSelectionIndicators" property is true.

The IFactory must return an object of type IVisualElement
GraphicsEditor
  
selectionLassoFactoryPart:mx.core.IFactory
Required: false Part Type: Static
Factory to create a single instance of a selection rectangle that selects graphic objects fully contained within this component's bounds.
GraphicsEditor
  
transformPipFactoryPart:mx.core.IFactory
Required: true Part Type: Dynamic
Pip used to transform selected graphic objects. Must be able to dispatch mouse events so a GraphicElement will not work. E.G. to use a Rect it must be wrapped in a EventDispatcher like a spark Group.

The IFactory must return an object of type InteractiveObject
GraphicsEditor
  
viewportPart:MouseEnabledGroup
Required: true Part Type: Static
Viewport for the scrollerPart.
GraphicsEditor
Skin States

To skin the component, implement a skin that defines the following states. Although you must implement all skin states, a skin state can be empty. An empty skin state specifies no changes to the default skin state.


 Skin State Description Defined By
  
disabled
GraphicsEditor
  
normal
GraphicsEditor
Property Detail
_editorStatesproperty
protected var _editorStates:Vector.<EditorState>

_redoStatesproperty 
protected var _redoStates:Vector.<EditorState>

autoScrollThresholdproperty 
public var autoScrollThreshold:Number = 50

Defines the threshold from the boundaries of the viewport in which to trigger automatic scrolling during a dragging operation.

The default value is 50.

bitmapLassoShapeproperty 
public var bitmapLassoShape:String = rectangle

Shape of bitmap lasso.

The default value is rectangle.

brushAlphaproperty 
public var brushAlpha:Number = 0.5

Alpha of the brush stroke (if applicable).

The default value is 0.5.

brushColorproperty 
public var brushColor:uint = 0

The color of the brush (if applicable).

The default value is black.

brushModeproperty 
public var brushMode:String = draw

The brush mode. See the BrushModes class.

The default value is black.

brushShapeproperty 
public var brushShape:String = circle

The shape of the brush (if applicable).

The default value is "circle".

brushSizeproperty 
brushSize:Number

The size of the brush in pixels. Minimum value of 1.

The default value is 50.


Implementation
    public function get brushSize():Number
    public function set brushSize(value:Number):void
brushStrengthproperty 
public var brushStrength:Number = 0.5

Strength of the brush (if applicable).

The default value is 0.5.

canvasBackgroundColorproperty 
canvasBackgroundColor:Number

The background color for the canvas. Set to NaN for a transparent background fill.

The default value is 0xFFFFFF.


Implementation
    public function get canvasBackgroundColor():Number
    public function set canvasBackgroundColor(value:Number):void
cropRectangleproperty 
cropRectangle:Rectangle

The current dimensions and position of the crop rectangle relative to the canvasPart.

Can also use this property to programmatically set the crop rectangle.

The default value is null.

This property can be used as the source for data binding.


Implementation
    public function get cropRectangle():Rectangle
    public function set cropRectangle(value:Rectangle):void
fillColorproperty 
public var fillColor:uint = 0xFFFFFF

The color of fills.

The default value is white.

floodFillAlphaproperty 
public var floodFillAlpha:Number = 1

Alpha of the flood fill.

The default value is 1.

floodFillAntiAliasproperty 
public var floodFillAntiAlias:Boolean = false

Smooth the flood fill outline.

The default value is false.

floodFillColorproperty 
public var floodFillColor:uint = 0

Flood fill color.

The default value is 0.

floodFillToleranceproperty 
public var floodFillTolerance:Number = 10

Tolerance for flood fills. Ranges from 0 to 255.

The default value is 10.

graphicObjectsproperty 
graphicObjects:Vector.<GraphicObjectBase>  [read-only]

Vector of all the graphic objects displayed within the canvas.

The default value is empty vector.


Implementation
    public function get graphicObjects():Vector.<GraphicObjectBase>
groupedGraphicObjectsproperty 
groupedGraphicObjects:Array

An array of the grouped graphic objects.

The default value is null.


Implementation
    public function get groupedGraphicObjects():Array
    public function set groupedGraphicObjects(value:Array):void
interactionModeproperty 
interactionMode:String

Sets the current interaction mode for the editor.

See the GraphicsEditorInteractionModes class for the possible values.

The default value is "selectFront".


Implementation
    public function get interactionMode():String
    public function set interactionMode(value:String):void
maxUndoproperty 
public var maxUndo:int = 20

Maximum number of undo/redo steps.

The default value is 20.

selectedGraphicObjectsproperty 
selectedGraphicObjects:Vector.<GraphicObjectBase>

A vector of the selected visual graphic objects.

This property is bindable. Bound to the "selectedGraphicObjectsChanged" event.

The default value is null.

This property can be used as the source for data binding.


Implementation
    public function get selectedGraphicObjects():Vector.<GraphicObjectBase>
    public function set selectedGraphicObjects(value:Vector.<GraphicObjectBase>):void
shapeTypeproperty 
public var shapeType:String = rectangle

Set the shape to draw during vector drawing.

See the GraphicsEditorVectorTypes class for supported types.

showHoverIndicatorproperty 
showHoverIndicator:Boolean

True to display the hoverIndicatorPart when mousing over child visual elements.

The default value is true.


Implementation
    public function get showHoverIndicator():Boolean
    public function set showHoverIndicator(value:Boolean):void
strokeColorproperty 
public var strokeColor:uint = 0

The color of strokes.

The default value is black.

transformConstrainProportionsproperty 
transformConstrainProportions:Boolean

True for object transformations to maintain the object aspect ratios.

The default value is false.


Implementation
    public function get transformConstrainProportions():Boolean
    public function set transformConstrainProportions(value:Boolean):void
wandAntiAliasproperty 
public var wandAntiAlias:Boolean = false

Smooth the wand outline.

The default value is false.

wandFillToleranceproperty 
public var wandFillTolerance:Number = 10

Tolerance for wand selection lassos. Ranges from 0 to 255.

The default value is 10.

zoomFactorproperty 
zoomFactor:Number

The zoom applied to the canvas. A zoomFactor of 1 is no zooming.

Property is bindable.

The default value is 1.

This property can be used as the source for data binding.


Implementation
    public function get zoomFactor():Number
    public function set zoomFactor(value:Number):void
zoomLevelsproperty 
public var zoomLevels:Array

The zoom levels used by the zoom pointer mode to zoom. Each zoom will use the next largest zoomFactor.

The default value is .05, .1, .25, .50, .66, .75, 1, 1.5, 2, 3, 4, 5, 8, 16, 32, 64.

Method Detail
addBitmapGraphicObject()method
public function addBitmapGraphicObject(bmd:BitmapData, xPosition:Number = 0, yPosition:Number = 0):BitmapGraphicObject

Add the passed bitmap data as a graphicObject.

Parameters

bmd:BitmapData — the BitmapData to add to the canvas
 
xPosition:Number (default = 0) — the x coordinate to add the new graphicObject
 
yPosition:Number (default = 0) — the y coordinate to add the new graphicObject

Returns
BitmapGraphicObject
addGraphicObject()method 
public function addGraphicObject(graphicObject:GraphicObjectBase):void

Add the passed graphicObject to the canvas.

Parameters

graphicObject:GraphicObjectBase

addTextGraphicObject()method 
public function addTextGraphicObject(xPosition:Number = 0, yPosition:Number = 0):TextGraphicObject

Add a TextGraphicObject.

Parameters

xPosition:Number (default = 0) — String to add to the object
 
yPosition:Number (default = 0) — the x coordinate to add the new graphicObject

Returns
TextGraphicObject — TextGraphicObject
applySelection()method 
public function applySelection():void

Adds the selection indicators and transform pips to the selected graphicObjects.

bitmapLassoModeHandler()method 
protected function bitmapLassoModeHandler(event:Event):void

Handles events related to the bitmap lasso interaction modes.

Parameters

event:Event — the Event that triggered the handler

brushModeHandler()method 
protected function brushModeHandler(event:Event):void

Handles events related to the "brush" interactionMode.

Parameters

event:Event — the Event that triggered the handler

captureLasso()method 
protected function captureLasso(object:BitmapGraphicObject, lassoBitmap:BitmapData):BitmapData

Capture the bitmapData stored inside the bitmap lasso.

Parameters

object:BitmapGraphicObject
 
lassoBitmap:BitmapData

Returns
BitmapData — BitmapData
changeSelectedObjectsDepths()method 
public function changeSelectedObjectsDepths(forward:Boolean = true, max:Boolean = false):void

Change the depth for the selected graphic objects (z index). Groups can be moved and all grouped objects with retain relative positioning.

Parameters

forward:Boolean (default = true) — true to move forward, false to move backwards
 
max:Boolean (default = false) — true to move to front or back, false to move 1 depth level

checkForAutoScroll()method 
protected function checkForAutoScroll():void

Checks if the mouse is within the autoscroll threshold during drag operations.

checkLassoSelection()method 
protected function checkLassoSelection():void

Called continuously when the selection lasso is dragging to detect the selected graphicObjects.

clearAutoScroll()method 
protected function clearAutoScroll():void

Clears the auto scrolling timer.

clearLassos()method 
protected function clearLassos():void

Clears all lassos.

clearSelection()method 
public function clearSelection():void

Clear selection.

commitBrush()method 
protected function commitBrush(xPosition:Number, yPosition:Number):void

Commit the brush.

Parameters

xPosition:Number — Number
 
yPosition:Number — Number

copyBitmapLasso()method 
public function copyBitmapLasso(cut:Boolean = false):void

Copy or cut the bitmap data selected via a lasso.

Parameters

cut:Boolean (default = false) — Boolean

crop()method 
public function crop():void

Crops the canvas to the region contained within the crop lasso.

Will clip bit objects but not vector or text objects.

cropLassoPartHandler()method 
protected function cropLassoPartHandler(event:Event):void

Handles events for the crop lasso part.

Parameters

event:Event — the Event that triggered the handler

cropModeHandler()method 
protected function cropModeHandler(event:Event):void

Handles events related to the "crop" interactionMode.

Parameters

event:Event — the Event that triggered the handler

drawBrush()method 
protected function drawBrush():void

Create a shape used to work with bitmap data and commit the brush to bitmap data.

eventHandler()method 
protected function eventHandler(event:Event):void

Handles events on the control.

Parameters

event:Event — the Event that triggered the handler

exportBitmapData()method 
public function exportBitmapData(allowTransparency:Boolean = true):BitmapData

Get the bitmapData for the canvas. Includes the background color.

Parameters

allowTransparency:Boolean (default = true) — false to convert transparent pixels to white (useful for JPEG exports that do not support an alpha channel)

Returns
BitmapData — BitmapData
fitCanvasToContent()method 
public function fitCanvasToContent(includeFilters:Boolean = false):void

Size the canvas to just fit the content. Can include filters in the fit.

Parameters

includeFilters:Boolean (default = false)

flattenSelectedGraphicObjects()method 
public function flattenSelectedGraphicObjects():BitmapGraphicObject

Flattens the selected graphic object(s) into a single BitmapGraphicObject.

Returns
BitmapGraphicObject — BitmapGraphicObject
flipSelectedGraphicObjects()method 
public function flipSelectedGraphicObjects(horizontal:Boolean = true):void

Flip the selected graphic objects horizontally or vertically.

Parameters

horizontal:Boolean (default = true) — true to flip horizontally, false vertically

floodFillModeHandler()method 
protected function floodFillModeHandler(event:Event):void

Handles events related to the "floodFill" interactionMode.

Parameters

event:Event — the Event that triggered the handler

getFloodFillBitmapData()method 
protected function getFloodFillBitmapData(bmd:BitmapData, x:Number, y:Number, fillColor:uint = 0, tolerance:Number = 10, antiAlias:Boolean = true):BitmapData

Returns the flood fill bitmap data.

Parameters

bmd:BitmapData — BitmapData
 
x:Number — Number
 
y:Number — Number
 
fillColor:uint (default = 0) — uint
 
tolerance:Number (default = 10) — Number
 
antiAlias:Boolean (default = true) — Boolean

Returns
BitmapData — BitmapData
getHoveredGraphicObject()method 
protected function getHoveredGraphicObject(event:MouseEvent):GraphicObjectBase

Return the currently hovered graphicObject (if any). Will not trigger over transparent bitmap data.

Parameters

event:MouseEvent — MouseEvent

Returns
GraphicObjectBase — the hovered graphicObject
getPipName()method 
protected function getPipName(pip:IVisualElement):String

Return the English description of which pip is passed.

Parameters

pip:IVisualElement — the Pip

Returns
String — CompassQuadrant
getSortedSelectedObjects()method 
public function getSortedSelectedObjects():Vector.<GraphicObjectBase>

Returns a vector of the selected GraphicObject(s) sorted by depth (lowest to highest).

Returns
Vector.<GraphicObjectBase>
getTransformRectangle2()method 
public function getTransformRectangle2(targetSpace:IVisualElement, contextGraphicObjects:Vector.<GraphicObjectBase> = null, includeFilters:Boolean = false):Rectangle

Return the transform lasso rectangle that bounds all the selected or passed GraphicsObject(s).

Improved version of getTransformRectangle2(). Does not use getBounds().

Parameters

targetSpace:IVisualElement — the coordinate space to use
 
contextGraphicObjects:Vector.<GraphicObjectBase> (default = null) — elements to find rectangle instead of the selected objects
 
includeFilters:Boolean (default = false) — true to include the filters in the rectangle

Returns
Rectangle — Rectangle
getVisibleCanvas()method 
public function getVisibleCanvas():Rectangle

Return the rectangle for the visible portion of the canvas in canvas coordinate space.

Returns
Rectangle — Rectangle
grabberModeHandler()method 
protected function grabberModeHandler(event:Event):void

Handles events related to the "grabber" interactionMode.

Parameters

event:Event — the Event that triggered the handler

groupSelectedGraphicObjects()method 
public function groupSelectedGraphicObjects():void

Group the selected GraphicObjects together without flattening them.

handleSelection()method 
protected function handleSelection(element:GraphicObjectBase, event:MouseEvent = null):void

Takes the passed GraphicObject and the mouse event that occurred contextually in relation to the passed GraphicObject and figures out how to adjust the selected GraphicObject(s).

Parameters

element:GraphicObjectBase — GraphicObjectBase
 
event:MouseEvent (default = null) — MouseEvent

isElementSelected()method 
protected function isElementSelected(element:IVisualElement):Boolean

Checks whether the passed element is in the selectedGraphicObjects vector.

Parameters

element:IVisualElement — the IVisualElement to check

Returns
Boolean — a Boolean
positionCursorGroup()method 
protected function positionCursorGroup():void

Position the fake cursor.

redo()method 
public function redo():void

Redo the state that was undone.

removeAllDynamicParts()method 
protected function removeAllDynamicParts(factory:String):void

Remove all instances of the passed dynamic part factory.

Parameters

factory:String — the name of the factory

removeAllGraphicObjects()method 
public function removeAllGraphicObjects():void

Remove all the graphicObjects from the canvas.

removeCursorGroup()method 
protected function removeCursorGroup():void

Remove the fake cursor.

removeGraphicObject()method 
public function removeGraphicObject(graphicObject:GraphicObjectBase):void

Remove the passed graphicObject

Parameters

graphicObject:GraphicObjectBase

removeSelectedGraphicObjects()method 
public function removeSelectedGraphicObjects():void

Remove all the selected graphicObjects from the canvas.

removeSelectedGrouping()method 
public function removeSelectedGrouping():void

Remove any grouping on the selected graphicObjects.

removeTransparentBorder()method 
protected function removeTransparentBorder(graphicObject:BitmapGraphicObject):void

Trim the transparent border for the passed BitmapGraphicObject.

Parameters

graphicObject:BitmapGraphicObject — BitmapGraphicObject

removeTransparentBorderForAllBitmapGraphicObjectGraphicObjects()method 
protected function removeTransparentBorderForAllBitmapGraphicObjectGraphicObjects():void

Trim the transparent border for all the BitmapGraphicObject(s).

reorderDepths()method 
protected function reorderDepths():void

Reorder the depths of the GraphicObject(s) from 0 to max.

restoreState()method 
protected function restoreState(redo:Boolean = false):void

Update the editor state.

Parameters

redo:Boolean (default = false) — true to redo state, false to undo state

rotateSelectedGraphicObjects()method 
public function rotateSelectedGraphicObjects(angle:Number):void

Rotate the selected graphicObjects by the passed angle.

Parameters

angle:Number — rotation in degrees

selectAll()method 
public function selectAll():void

Select all graphic objects.

selectionModeHandler()method 
protected function selectionModeHandler(event:Event):void

Handles events related to the selection interaction modes.

Parameters

event:Event — the Event that triggered the handler

setCanvasColor()method 
public function setCanvasColor(color:Number = 0xFFFFFF):void

Set the background color of the canvas. NaN for transparent.

Parameters

color:Number (default = 0xFFFFFF) — color

setCanvasSize()method 
public function setCanvasSize(canvasWidth:Number = 500, canvasHeight:Number = 500):void

Set the dimensions of the canvas.

Parameters

canvasWidth:Number (default = 500) — the width of the canvas
 
canvasHeight:Number (default = 500) — the height of the canvas

setCropRectangle()method 
public function setCropRectangle(rect:Rectangle):void

Set the crop rectangle position. Passed rectangle is assumed to be within the canvas coordinate space.

Parameters

rect:Rectangle — Rectangle

setCursorFromCSS()method 
protected function setCursorFromCSS(bitmapStyle:String, hotspotStyle:String, groupName:String, priority:Number):Boolean

Set the cursor based on a CSS style.

Parameters

bitmapStyle:String — String css style to retrieve the bitmap asset
 
hotspotStyle:String — String css style hotspot for the bitmap asset
 
groupName:String — String
 
priority:Number — Number

Returns
Boolean — Boolean true if the cursor successfully changed
setHover()method 
protected function setHover(currentHover:GraphicObjectBase):void

Sets the hover indicator.

Parameters

currentHover:GraphicObjectBase — GraphicObjectBase

setResizeCursor()method 
protected function setResizeCursor(name:String, priority:Number, groupName:String):void

Set the current cursor to the resize cursor. Will change the angle to reflect the moused pip.

Parameters

name:String
 
priority:Number
 
groupName:String

setSelection()method 
protected function setSelection(selection:Vector.<GraphicObjectBase>):void

Update the selected objects and determine if a selection "change" event should be dispatched.

Also, update state for text objects if they are deselected and changed.

Parameters

selection:Vector.<GraphicObjectBase> — Vector.GraphicObjectBase

setupCursorGroup()method 
protected function setupCursorGroup():void

Create and draw the fake cursor.

sortGraphicObjectsByDepth()method 
protected function sortGraphicObjectsByDepth(a:Object, b:Object):int

Sorting function to sort the depth of GraphicObject(s).

Parameters

a:Object — Object 1 to sort
 
b:Object — Object 2 to sort

Returns
int — int of sort order
textModeHandler()method 
protected function textModeHandler(event:Event):void

Handles events related to the "text" interactionMode.

Parameters

event:Event — the Event that triggered the handler

transformPipHandler()method 
protected function transformPipHandler(event:Event):void

Handles all transform events and transform dragging.

Parameters

event:Event — the Event that triggered the handler

trimTransparentBorder()method 
protected function trimTransparentBorder(bmd:BitmapData):Array

Trim any transparent border from the passed bitmap data.

Parameters

bmd:BitmapData — the BitmapData to trim

Returns
Array — Array [nonTransparentRectangle, clippedBmd]
undo()method 
public function undo():void

Restore the last state.

updateCanvasBackgroundPart()method 
protected function updateCanvasBackgroundPart():void

Update the canvas background skin part.

updateInteractionMode()method 
protected function updateInteractionMode():void

Update the current interaction mode.

updateState()method 
public function updateState():void

Update the editor state that can be undone.

updateZoom()method 
protected function updateZoom(scaleFactor:Number, zoomOnCursor:Boolean = false):void

Update the canvas zoom and zoom in/out centered on the middle of visible region of the viewport.

If the provided "zoomOnCursor" parameter is true zoom in on the mouse position rather than the center of the visible region.

Parameters

scaleFactor:Number — Number
 
zoomOnCursor:Boolean (default = false) — Boolean true to zoom on the location of the cursor

vectorModeHandler()method 
protected function vectorModeHandler(event:Event):void

Handles events related to the "vector" interactionMode.

Parameters

event:Event — the Event that triggered the handler

wandModeHandler()method 
protected function wandModeHandler(event:Event):void

Handles events related to the "wand" interactionMode.

Parameters

event:Event — the Event that triggered the handler

zoomIn()method 
public function zoomIn():void

Zoom in to the next zoom level.

zoomModeHandler()method 
protected function zoomModeHandler(event:Event):void

Handles events related to the "zoom" interactionMode.

Parameters

event:Event — the Event that triggered the handler

zoomOut()method 
public function zoomOut():void

Zoom out to the next zoom level.

zoomToFit()method 
public function zoomToFit():void

Set the zoom factor to fit the content in the viewport without any scrolling

Event Detail
bitmapLassoChange Event
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched when the bitmap lasso data changes.

cropRectangleChanged Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched when the crop rectangle changes.

editorStateChange Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched when the editor states are updated via undo/redo.

elementDragEnd Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched when a visual element drag ends.

elementDragging Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched while a visual element is being dragged.

elementDragStart Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched when a visual element drag begins.

graphicObjectAdded Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched a graphic object is removed from the canvas.

graphicObjectAdded Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched a graphic object is added to the canvas.

selectedGraphicObjectsChanged Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched when the currently selected graphic objects change.

textEditBegin Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched when a text editing session begins.

transformDragEnd Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched when a transform ends.

transformDragging Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched when a transform is in progress.

transformDragStart Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched when a transform begins.

vectorObjectInitialDrag Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched after the initial drag for a vector object is complete.

zoomChanged Event  
Event Object Type: ardisia.components.graphicsEditor.events.GraphicsEditorEvent
GraphicsEditorEvent.type property = ardisia.components.graphicsEditor.events.GraphicsEditorEvent

Dispatched when the zoom factor changes.