Package | ardisia.components.graphicsEditor |
Class | public class GraphicsEditor |
Inheritance | GraphicsEditor spark.components.supportClasses.SkinnableComponent |
Implements | mx.managers.IFocusManagerComponent |
View the technical documentation on the Ardisia Labs website for more information.
Property | Defined 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 |
Property | Defined By | ||
---|---|---|---|
_editorStates : Vector.<EditorState> | GraphicsEditor | ||
_redoStates : Vector.<EditorState> | GraphicsEditor |
Method | Defined By | ||
---|---|---|---|
addBitmapGraphicObject(bmd:BitmapData, xPosition:Number = 0, yPosition:Number = 0):BitmapGraphicObject
Add the passed bitmap data as a graphicObject. | GraphicsEditor | ||
addGraphicObject(graphicObject:GraphicObjectBase):void
Add the passed graphicObject to the canvas. | GraphicsEditor | ||
addTextGraphicObject(xPosition:Number = 0, yPosition:Number = 0):TextGraphicObject
Add a TextGraphicObject. | GraphicsEditor | ||
applySelection():void
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 | ||
clearSelection():void
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 | ||
getSortedSelectedObjects():Vector.<GraphicObjectBase>
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 | ||
groupSelectedGraphicObjects():void
Group the selected GraphicObjects together without flattening them. | GraphicsEditor | ||
redo():void
Redo the state that was undone. | GraphicsEditor | ||
removeAllGraphicObjects():void
Remove all the graphicObjects from the canvas. | GraphicsEditor | ||
removeGraphicObject(graphicObject:GraphicObjectBase):void
Remove the passed graphicObject
| GraphicsEditor | ||
removeSelectedGraphicObjects():void
Remove all the selected graphicObjects from the canvas. | GraphicsEditor | ||
removeSelectedGrouping():void
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 | ||
updateState():void
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 |
Method | Defined 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 | ||
checkForAutoScroll():void
Checks if the mouse is within the autoscroll threshold during drag
operations. | GraphicsEditor | ||
checkLassoSelection():void
Called continuously when the selection lasso is dragging to detect
the selected graphicObjects. | GraphicsEditor | ||
clearAutoScroll():void
Clears the auto scrolling timer. | GraphicsEditor | ||
clearLassos():void
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 | ||
getHoveredGraphicObject(event:MouseEvent):GraphicObjectBase
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 | ||
positionCursorGroup():void
Position the fake cursor. | GraphicsEditor | ||
removeAllDynamicParts(factory:String):void
Remove all instances of the passed dynamic part factory. | GraphicsEditor | ||
removeCursorGroup():void
Remove the fake cursor. | GraphicsEditor | ||
removeTransparentBorder(graphicObject:BitmapGraphicObject):void
Trim the transparent border for the passed BitmapGraphicObject. | GraphicsEditor | ||
Trim the transparent border for all the BitmapGraphicObject(s). | GraphicsEditor | ||
reorderDepths():void
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 | ||
setupCursorGroup():void
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 | ||
updateCanvasBackgroundPart():void
Update the canvas background skin part. | GraphicsEditor | ||
updateInteractionMode():void
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 |
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 |
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 |
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 |
_editorStates | property |
protected var _editorStates:Vector.<EditorState>
_redoStates | property |
protected var _redoStates:Vector.<EditorState>
autoScrollThreshold | property |
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
.
bitmapLassoShape | property |
public var bitmapLassoShape:String = rectangle
Shape of bitmap lasso.
The default value is rectangle
.
brushAlpha | property |
public var brushAlpha:Number = 0.5
Alpha of the brush stroke (if applicable).
The default value is 0.5
.
brushColor | property |
public var brushColor:uint = 0
The color of the brush (if applicable).
The default value is black
.
brushMode | property |
public var brushMode:String = draw
The brush mode. See the BrushModes class.
The default value is black
.
brushShape | property |
public var brushShape:String = circle
The shape of the brush (if applicable).
The default value is "circle"
.
brushSize | property |
brushSize:Number
The size of the brush in pixels. Minimum value of 1.
The default value is 50
.
public function get brushSize():Number
public function set brushSize(value:Number):void
brushStrength | property |
public var brushStrength:Number = 0.5
Strength of the brush (if applicable).
The default value is 0.5
.
canvasBackgroundColor | property |
canvasBackgroundColor:Number
The background color for the canvas. Set to NaN for a transparent background fill.
The default value is 0xFFFFFF
.
public function get canvasBackgroundColor():Number
public function set canvasBackgroundColor(value:Number):void
cropRectangle | property |
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.
public function get cropRectangle():Rectangle
public function set cropRectangle(value:Rectangle):void
fillColor | property |
public var fillColor:uint = 0xFFFFFF
The color of fills.
The default value is white
.
floodFillAlpha | property |
public var floodFillAlpha:Number = 1
Alpha of the flood fill.
The default value is 1
.
floodFillAntiAlias | property |
public var floodFillAntiAlias:Boolean = false
Smooth the flood fill outline.
The default value is false
.
floodFillColor | property |
public var floodFillColor:uint = 0
Flood fill color.
The default value is 0
.
floodFillTolerance | property |
public var floodFillTolerance:Number = 10
Tolerance for flood fills. Ranges from 0 to 255.
The default value is 10
.
graphicObjects | property |
graphicObjects:Vector.<GraphicObjectBase>
[read-only] Vector of all the graphic objects displayed within the canvas.
The default value is empty vector
.
public function get graphicObjects():Vector.<GraphicObjectBase>
groupedGraphicObjects | property |
groupedGraphicObjects:Array
An array of the grouped graphic objects.
The default value is null
.
public function get groupedGraphicObjects():Array
public function set groupedGraphicObjects(value:Array):void
interactionMode | property |
interactionMode:String
Sets the current interaction mode for the editor.
See the GraphicsEditorInteractionModes class for the possible values.
The default value is "selectFront"
.
public function get interactionMode():String
public function set interactionMode(value:String):void
maxUndo | property |
public var maxUndo:int = 20
Maximum number of undo/redo steps.
The default value is 20
.
selectedGraphicObjects | property |
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.
public function get selectedGraphicObjects():Vector.<GraphicObjectBase>
public function set selectedGraphicObjects(value:Vector.<GraphicObjectBase>):void
shapeType | property |
public var shapeType:String = rectangle
Set the shape to draw during vector drawing.
See the GraphicsEditorVectorTypes class for supported types.
showHoverIndicator | property |
showHoverIndicator:Boolean
True to display the hoverIndicatorPart when mousing over child visual elements.
The default value is true
.
public function get showHoverIndicator():Boolean
public function set showHoverIndicator(value:Boolean):void
strokeColor | property |
public var strokeColor:uint = 0
The color of strokes.
The default value is black
.
transformConstrainProportions | property |
transformConstrainProportions:Boolean
True for object transformations to maintain the object aspect ratios.
The default value is false
.
public function get transformConstrainProportions():Boolean
public function set transformConstrainProportions(value:Boolean):void
wandAntiAlias | property |
public var wandAntiAlias:Boolean = false
Smooth the wand outline.
The default value is false
.
wandFillTolerance | property |
public var wandFillTolerance:Number = 10
Tolerance for wand selection lassos. Ranges from 0 to 255.
The default value is 10
.
zoomFactor | property |
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.
public function get zoomFactor():Number
public function set zoomFactor(value:Number):void
zoomLevels | property |
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
.
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
|
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
|
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 |
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)
|
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.
ReturnsBitmapGraphicObject — 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
|
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
|
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
|
String — CompassQuadrant
|
getSortedSelectedObjects | () | method |
public function getSortedSelectedObjects():Vector.<GraphicObjectBase>
Returns a vector of the selected GraphicObject(s) sorted by depth (lowest to highest).
ReturnsVector.<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
|
Rectangle — Rectangle
|
getVisibleCanvas | () | method |
public function getVisibleCanvas():Rectangle
Return the rectangle for the visible portion of the canvas in canvas coordinate space.
ReturnsRectangle — 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
|
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
|
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
|
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
|
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
bitmapLassoChange | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched when the bitmap lasso data changes.
cropRectangleChanged | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched when the crop rectangle changes.
editorStateChange | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched when the editor states are updated via undo/redo.
elementDragEnd | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched when a visual element drag ends.
elementDragging | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched while a visual element is being dragged.
elementDragStart | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched when a visual element drag begins.
graphicObjectAdded | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched a graphic object is removed from the canvas.
graphicObjectAdded | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched a graphic object is added to the canvas.
selectedGraphicObjectsChanged | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched when the currently selected graphic objects change.
textEditBegin | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched when a text editing session begins.
transformDragEnd | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched when a transform ends.
transformDragging | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched when a transform is in progress.
transformDragStart | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched when a transform begins.
vectorObjectInitialDrag | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched after the initial drag for a vector object is complete.
zoomChanged | Event |
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
ardisia.components.graphicsEditor.events.GraphicsEditorEvent
Dispatched when the zoom factor changes.