Package | com.yworks.canvas |
Class | public class CanvasComponent |
Inheritance | CanvasComponent mx.core.UIComponent |
Implements | ILookup |
Subclasses | GraphCanvasComponent, GraphOverviewComponent |
Property | Defined By | ||
---|---|---|---|
autoDrag : Boolean
Gets or sets a property that causes the canvas to automatically pan the view
when the mouse gets dragged within the autoDragInsets of the canvas. | CanvasComponent | ||
autoDragInsets : ImmutableRectangle
Gets or sets the auto drag insets. | CanvasComponent | ||
autoMouseWheelZoom : Boolean
Determines whether the mouse wheel should be used for zooming. | CanvasComponent | ||
backgroundAlpha : Number [write-only]
Sets the alpha value of the canvas background color. | CanvasComponent | ||
backgroundColor : uint [write-only]
Sets the background color of the canvas. | CanvasComponent | ||
bridgeManager : BridgeManager | CanvasComponent | ||
center : Point
The world coordinate at the center of the canvas component. | CanvasComponent | ||
contentRect : Rectangle
Gets and sets the Rectangle in world coordinates that holds the contents. | CanvasComponent | ||
context : ICanvasContext [read-only]
Returns an implementation of ICanvasContext
that describes the state of this canvas control. | CanvasComponent | ||
cursor : Cursor
Get or set the cursor instance that will be displayed for this canvas. | CanvasComponent | ||
doubleClickSize : ISize
The size of the area within which the user must click twice
for the two clicks to be considered a double-click. | CanvasComponent | ||
doubleClickTime : int
The time that may elapse between two consecutive mouse clicks
so the last click is still considered a double click. | CanvasComponent | ||
dragSize : ISize
The area in view coordinates the mouse may stay in before a
movement is considered a drag. | CanvasComponent | ||
dragTime : int
The value of the drag time. | CanvasComponent | ||
editable : Boolean
Property that sets the editable state of this canvas. | CanvasComponent | ||
enableMouseChildren : int
Determines whether to propagate mouse events to the children in the display list. | CanvasComponent | ||
hasHorizontalScrollBar : Boolean [read-only] | CanvasComponent | ||
hasVerticalScrollBar : Boolean [read-only] | CanvasComponent | ||
hitTestRadius : Number
Specifies the radius of the area around the mouse in view coordinates in which an
IHitTestable may lie to be considered a valid hit. | CanvasComponent | ||
horizontalLineScrollSize : Number
The amount to scroll when an arrow button of the horizontal scrollbar is pressed, in pixels. | CanvasComponent | ||
horizontalPageScrollSize : Number
Specifies the amount to scroll when the horizontal scroll bar track is pressed, in pixels. | CanvasComponent | ||
horizontalScrollPolicy : String
Specifies the visibility policy for the horizontal scrollbar. | CanvasComponent | ||
horizontalScrollPosition : Number
The current position of the horizontal scroll bar. | CanvasComponent | ||
inputMode : IInputMode
Specifies the single IInputMode instance that shall
be installed for this canvas. | CanvasComponent | ||
inputModeContext : IInputModeContext
The InputModeContext property. | CanvasComponent | ||
inputModeContextLookupChain : LookupChain [read-only]
Retrieves the LookupChain that can be used
to decorate the lookup call in the inputModeContext. | CanvasComponent | ||
inputModes : List [read-only]
Returns the internal list of currently installed IInputModes. | CanvasComponent | ||
lastCanvasMouseEvent : CanvasMouseEvent [read-only]
Gets the last CanvasMouseEvent
that was dispatched by this instance. | CanvasComponent | ||
limitedMinZoom : Number [read-only]
Returns the minimum zoom value for the current canvas size and
viewport limits
| CanvasComponent | ||
maxHorizontalScrollPosition : Number [read-only]
If the canvas component currently has a horizontal scroll bar,
returns the maxScrollPosition of the horizontal scroll bar. | CanvasComponent | ||
maxVerticalScrollPosition : Number [read-only]
If the canvas component currently has a vertical scroll bar,
returns the maxScrollPosition of the vertical scroll bar. | CanvasComponent | ||
maxZoom : Number
The maxZoom property. | CanvasComponent | ||
minHorizontalScrollPosition : Number [read-only]
If the canvas component currently has a horizontal scroll bar,
returns the minScrollPosition of the horizontal scroll bar. | CanvasComponent | ||
minVerticalScrollPosition : Number [read-only]
If the canvas component currently has a vertical scroll bar,
returns the minScrollPosition of the vertical scroll bar. | CanvasComponent | ||
minZoom : Number
The minZoom property. | CanvasComponent | ||
mouseInterval : Number
Time interval in milliseconds after which a mouse move (MouseEvent.MOUSE_MOVE) is processed. | CanvasComponent | ||
mouseWheelZoomCenteredRecognizer : Function
The recognizer used to determine if the mouse event passed to the mouseWheelZoom method should trigger
a zoom action that uses the center of the view port as fixed coordinate during zooming. | CanvasComponent | ||
mouseWheelZoomFactor : Number
The factor by which the zoom level changes when the mouse wheel is turned. | CanvasComponent | ||
mouseWheelZoomMouseLocationRecognizer : Function
The recognizer used to determine if the mouse event passed to the mouseWheelZoom method should trigger
a zoom action that uses the current mouse location as fixed coordinate during zooming. | CanvasComponent | ||
treeDirty : Boolean
Property that determines whether the whole canvasObjectTree is
redrawn upon the next invocation of updateDisplayList(). | CanvasComponent | ||
treePartiallyDirty : Boolean
Property that determines whether the canvasObjectTree is
redrawn partially upon the next invocation of updateDisplayList(). | CanvasComponent | ||
verticalLineScrollSize : Number
The amount to scroll when an arrow button of the vertical scrollbar is pressed, in pixels. | CanvasComponent | ||
verticalPageScrollSize : Number
Specifies the amount to scroll when the vertical scroll bar track is pressed, in pixels. | CanvasComponent | ||
verticalScrollPolicy : String
Specifies the visibility policy for the vertical scrollbar. | CanvasComponent | ||
verticalScrollPosition : Number
The current position of the vertical scroll bar. | CanvasComponent | ||
viewPoint : Point
The current view point. | CanvasComponent | ||
viewPort : IRectangle [read-only]
Returns the currently visible viewing region in world coordinates. | CanvasComponent | ||
viewportLimiter : ViewportLimiter
Gets or sets the viewport limiter instance that can be used to limit the explorable region. | CanvasComponent | ||
zoom : Number
The zoom factor for this canvas control. | CanvasComponent | ||
zoomIfCanvasHit : Boolean
Whether the mouse wheel triggers zooming whenever the mouse
is over the canvas area (true) or whether the
canvas needs focus to trigger zooming (false). | CanvasComponent |
Property | Defined By | ||
---|---|---|---|
_viewPoint : Point | CanvasComponent |
Method | Defined By | ||
---|---|---|---|
Constructor. | CanvasComponent | ||
addCanvasObject(userObject:Object, descriptor:ICanvasObjectDescriptor = null, group:ICanvasObjectGroup = null):ICanvasObject
Adds an element to the internal canvas object tree to the specified group. | CanvasComponent | ||
addDisplayObjectCreator(creator:IDisplayObjectCreator, group:ICanvasObjectGroup = null):ICanvasObject
Adds an IDisplayObjectCreator instance to the scene graph using
CanvasObjectDescriptor.Instance as the ICanvasObjectDescriptor. | CanvasComponent | ||
Adds a new ICanvasObjectGroup to the root of the canvas object tree. | CanvasComponent | ||
Adds a new ICanvasObjectGroup to the specified group in the current canvas object tree. | CanvasComponent | ||
Deprecated Since 1.7: Please Use addDisplayObjectCreator
Adds an IPaintable instance to the scene graph using
CanvasObjectDescriptor.Instance as the ICanvasObjectDescriptor. | CanvasComponent | ||
collectCanvasObjects(x:Number, y:Number, elementFoundCallback:Function):void
Collects all canvas object instances that are hit at the given coordinate set. | CanvasComponent | ||
Creates a sprite containing a complete copy of the current canvas object tree. | CanvasComponent | ||
decreaseZoom(factor:Number = 1.2):void
Descrease the current zoom level using the provided factor. | CanvasComponent | ||
fitContent():void
Adjusts the view port to fully encompass the current content rectangle. | CanvasComponent | ||
fitGraphBounds(margins:IRectangle = null):void
Updates the content rectangle and adjusts the viewport to encompass the contents. | CanvasComponent | ||
forceRepaint():void
Invalidates this canvas component and causes a repaint of all display objects
that are visible in this canvas component. | CanvasComponent | ||
getCanvasObject(worldX:Number, worldY:Number):ICanvasObject
Returns the top most canvas object instance that is hit at the given coordinate set. | CanvasComponent | ||
getCanvasObjects(worldX:Number, worldY:Number):Iterable
Returns a list of all canvas objects in hit order at the given world coordinate location. | CanvasComponent | ||
getCanvasRect():Rectangle
Returns a rectangle defined by the available space for displaying the
CanvasObjectTree within this Component, in stage coordinates. | CanvasComponent | ||
getHits(stageX:Number, stageY:Number, useShape:Boolean = true):Array
Returns an array of ICanvasObjects that are hit by the given coords. | CanvasComponent | ||
increaseZoom(factor:Number = 1.2):void
Increase the current zoom level using the provided factor. | CanvasComponent | ||
invalidateAllObjects():void
Forces a repaint of all canvas objects. | CanvasComponent | ||
invalidateDirtyObjects():void
Forces a repaint of the dirty canvas objects. | CanvasComponent | ||
invalidateDisplayList():void [override]
Marks a component so that its updateDisplayList() method gets
called during a later screen update. | CanvasComponent | ||
isCanvasHit(target:DisplayObject, stageX:Number, stageY:Number):Boolean
Checks whether the point at stageX,stageY is within the
canvas bounds and target is a child of the canvas. | CanvasComponent | ||
Iterates all hit elements in the canvas below the given group that are accepted by a given filter. | CanvasComponent | ||
lookup(type:Class):Object | CanvasComponent | ||
print(bitmap:Boolean = true, borderSize:uint = 5, backgroundFill:* = 0xFFFFFF, printRect:Rectangle = null, canvasSprite:Sprite = null):void
Prints the current canvas object tree or a pre-calculated copy of it. | CanvasComponent | ||
setLimitedCenter(center:Point):void
Sets the provided center unless this would cause the viewport to exceed
the limits of the viewportLimiter. | CanvasComponent | ||
setLimitedViewpoint(vp:Point):void
Sets the provided viewpoint unless this would cause the viewport to exceed
the limits of the viewportLimiter. | CanvasComponent | ||
setLimitedViewport(target:IRectangle):void
Sets the provided viewport unless this would cause the viewport to exceed
the limits of the viewportLimiter. | CanvasComponent | ||
setLimitedZoom(newZoom:Number):void
Sets the provided zoom value unless this would cause the viewport to exceed
the limits of the viewportLimiter. | CanvasComponent | ||
toViewCoordinates(p:IMutablePoint):void
Converts a point in world coordinates to view coordinates. | CanvasComponent | ||
toWorldCoordinates(p:IMutablePoint):void
Converts a point in view coordinates to world coordinates. | CanvasComponent | ||
updateContentRect(margins:IRectangle = null):void
Updates the contentRect to encompass the bounds by all elements in the
current scene graph upon the next invocation of updateDisplayList. | CanvasComponent | ||
zoomTo(px:Number, py:Number, theZoom:Number):void
Sets the zoom level and view port center to the given values. | CanvasComponent | ||
zoomToRect(rect:Rectangle, maxZoom:Number):void
Adjusts the view port to fit in the given rectangle. | CanvasComponent |
Method | Defined By | ||
---|---|---|---|
adjustCursor(evt:CanvasMouseEvent):void
Adjusts the mouse cursor based on the given mouse event and
the cursor property. | CanvasComponent | ||
createChildren():void [override]
| CanvasComponent | ||
Factory method for the InputModeContext property. | CanvasComponent | ||
disposeListeners(eventDispatcher:IEventDispatcher):void
Unregister all event listeners that were registered with the stage. | CanvasComponent | ||
doEvent(e:Event = null):void
Delayed processing of a MouseEvent.MOUSE_MOVE. | CanvasComponent | ||
fitContentCore():void
When fitContent() is called, this method
is invoked in the next updateDisplayList() execution
to actually fit the content rectangle into the viewport. | CanvasComponent | ||
initListeners(eventDispatcher:IEventDispatcher):void
Initialize all event listeners that should be registered with the stage. | CanvasComponent | ||
inputModeContextLookup(type:Class):Object
Callback that is used by the default implementation of inputModeContext
to resolve lookup calls. | CanvasComponent | ||
measure():void [override]
Calculates the default size and the default minimum size
of the component. | CanvasComponent | ||
mouseWheelZoom(evt:CanvasMouseEvent):void
If the autoMouseWheelZoom property is set to true,
this method will adjust the current zoom level. | CanvasComponent | ||
onAdd(event:FlexEvent):void
Called when the component is added to the display list. | CanvasComponent | ||
onAutoDragChanged(oldValue:Boolean, newValue:Boolean):void
Called when the autoDrag property changes. | CanvasComponent | ||
Called when the autoDragInsets property changes. | CanvasComponent | ||
onCanvasMouseClicked(evt:CanvasMouseEvent):void
Callback method that is called when the mouse has been clicked. | CanvasComponent | ||
onCanvasMouseDown(evt:CanvasMouseEvent):void
Callback method that is called when a mouse button has been pressed. | CanvasComponent | ||
onCanvasMouseDragged(evt:CanvasMouseEvent):void
Callback method that is called when the mouse gets dragged. | CanvasComponent | ||
onCanvasMouseMoved(evt:CanvasMouseEvent):void
Callback method that is called when the mouse has been moved and
the mouse button has not been pressed. | CanvasComponent | ||
onCanvasMouseUp(evt:CanvasMouseEvent):void
Callback method that is called when a mouse button has been released. | CanvasComponent | ||
onCanvasMouseWheel(evt:CanvasMouseEvent):void
Callback method that is called when the mouse wheel has been turned. | CanvasComponent | ||
onContentRectChanged():void
Callback that is invoked when the ContentRect property changes. | CanvasComponent | ||
onEditableChanged():void
Callback that is called when the editable property changes. | CanvasComponent | ||
onHitTestRadiusChanged(oldValue:Number, newValue:Number):void
Callback that is invoked when the hitTestRadius property changed. | CanvasComponent | ||
Callback that is invoked when the inputMode property changes. | CanvasComponent | ||
onInputModeContextChanged(oldInputModeContext:IInputModeContext, newInputModeContext:IInputModeContext):void
Called when the inputModeContext property value changes
and after initialization of the field. | CanvasComponent | ||
onMouseDown(evt:MouseEvent):void
Tries to gain the focus, if the canvas area was hit. | CanvasComponent | ||
onMouseEvent(evt:MouseEvent):void Deprecated: Use the various onCanvasMouseXXX hooks or event listeners for CanvasMouseEvents instead.
Called when this component receives a MouseEvent. | CanvasComponent | ||
onMouseMove(evt:MouseEvent):void
Calls onCanvasMouseDragged or
onCanvasMouseMoved with the corresponding
CanvasMouseEvent. | CanvasComponent | ||
onMouseUp(evt:MouseEvent):void
Calls onCanvasMouseUp and possibly
onCanvasMouseClicked with the corresponding
CanvasMouseEvent. | CanvasComponent | ||
onMouseWheel(evt:MouseEvent):void
Calls onCanvasMouseWheel
with the corresponding
CanvasMouseEvent. | CanvasComponent | ||
onRemove(event:FlexEvent):void
Called when the component is removed from the display list. | CanvasComponent | ||
onViewPortChanged():void
Callback that is invoked when the view port property changes. | CanvasComponent | ||
processEvent(event:Event):void
Processes a mouse event. | CanvasComponent | ||
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void [override]
| CanvasComponent | ||
updateTree(partially:Boolean = false):void
Repaints the display list
| CanvasComponent | ||
updateViewport():void
update the viewport bounds upon the next invocation of updateDisplayList. | CanvasComponent |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when the autoDrag property changes. | CanvasComponent | |||
Dispatched when the autoDragInsets property changes. | CanvasComponent | |||
Dispatched when the mouse is clicked. | CanvasComponent | |||
Dispatched when the mouse is double clicked. | CanvasComponent | |||
Dispatched when the mouse is pressed. | CanvasComponent | |||
Dispatched when the mouse is dragged. | CanvasComponent | |||
Dispatched when the mouse is moved. | CanvasComponent | |||
Dispatched when the mouse is released. | CanvasComponent | |||
Dispatched when the mousewheel moves. | CanvasComponent | |||
Dispatched when the contentRect property changes. | CanvasComponent | |||
Dispatched when the editable property changes. | CanvasComponent | |||
Dispatched when the inputMode property changes. | CanvasComponent | |||
Dispatched when the inputModeContext property changes. | CanvasComponent | |||
Dispatched when the canvas has been invalidated. | CanvasComponent | |||
Dispatched when one of the scrollbars changes its scroll position. | CanvasComponent | |||
Dispatched when the canvas object tree is repainted. | CanvasComponent | |||
Dispatched when the viewPoint property changes. | CanvasComponent | |||
Dispatched when the viewPort property changes. | CanvasComponent | |||
Dispatched when the zoom property changes. | CanvasComponent |
Constant | Defined By | ||
---|---|---|---|
AUTO_DRAG_CHANGED : String = autoDragChanged [static]
Dispatched when the autoDrag property changes. | CanvasComponent | ||
AUTO_DRAG_INSETS_CHANGED : String = autoDragInsetsChanged [static]
Dispatched when the autoDragInsets property changes. | CanvasComponent | ||
CONTENT_RECT_CHANGED : String = contentRectChanged [static]
Dispatched when the contentRect property changes. | CanvasComponent | ||
EDITABLE_CHANGED : String = editableChanged [static]
Dispatched when the editable property changes. | CanvasComponent | ||
INPUT_MODE_CHANGED : String = inputModeChanged [static]
Dispatched when the inputMode property changes. | CanvasComponent | ||
INPUT_MODE_CONTEXT_CHANGED : String = inputModeContextChanged [static]
Dispatched when the inputModeContext property changes. | CanvasComponent | ||
INVALIDATED : String = invalidated [static]
Dispatched when the canvas has been invalidated. | CanvasComponent | ||
MOUSE_CHILDREN_ALWAYS : int = 1 [static]
Mouse events will always be propagated to child DisplayObjects. | CanvasComponent | ||
MOUSE_CHILDREN_AUTO : int = -1 [static]
Mouse events will only be propagated to child DisplayObjects
if they may need interactivity. | CanvasComponent | ||
MOUSE_CHILDREN_NEVER : int = 0 [static]
Mouse events will never be propagated to child DisplayObjects. | CanvasComponent | ||
VIEWPORT_CHANGED : String = viewPortChanged [static]
Kept for backward compatibility. | CanvasComponent |
_viewPoint | property |
protected var _viewPoint:Point
autoDrag | property |
autoDrag:Boolean
Gets or sets a property that causes the canvas to automatically pan the view
when the mouse gets dragged within the autoDragInsets
of the canvas.
public function get autoDrag():Boolean
public function set autoDrag(value:Boolean):void
See also
autoDragInsets | property |
autoDragInsets:ImmutableRectangle
Gets or sets the auto drag insets.
If the mouse is being dragged within the insets of the canvas specified using this field, the control will automatically scroll.
This property can be used as the source for data binding.
public function get autoDragInsets():ImmutableRectangle
public function set autoDragInsets(value:ImmutableRectangle):void
See also
autoMouseWheelZoom | property |
autoMouseWheelZoom:Boolean
Determines whether the mouse wheel should be used for zooming.
If set to false
this task can be performed by custom
IInputMode implementations using the CanvasMouseEvent
of
type CanvasMouseEvent.CANVAS_MOUSE_WHEEL
.
The default value is true
.
This property can be used as the source for data binding.
public function get autoMouseWheelZoom():Boolean
public function set autoMouseWheelZoom(value:Boolean):void
backgroundAlpha | property |
backgroundAlpha:Number
[write-only] Sets the alpha value of the canvas background color.
The default value is 1.0
.
public function set backgroundAlpha(value:Number):void
backgroundColor | property |
backgroundColor:uint
[write-only] Sets the background color of the canvas.
public function set backgroundColor(value:uint):void
bridgeManager | property |
bridgeManager:BridgeManager
public function get bridgeManager():BridgeManager
public function set bridgeManager(value:BridgeManager):void
center | property |
center:Point
The world coordinate at the center of the canvas component.
Can be used to move the view port.
This property can be used as the source for data binding.
public function get center():Point
public function set center(value:Point):void
contentHeight | property |
contentHeight:Number
[read-only] yworks_internal function get contentHeight():Number
contentRect | property |
contentRect:Rectangle
Gets and sets the Rectangle in world coordinates that holds the contents.
This influences the display of the scroll bars. If the content rectangle is not currently visible in the viewport, scroll bars will be displayed, unless they are turned off completely.
This property can be used as the source for data binding.
public function get contentRect():Rectangle
public function set contentRect(value:Rectangle):void
contentWidth | property |
contentWidth:Number
[read-only] yworks_internal function get contentWidth():Number
context | property |
context:ICanvasContext
[read-only]
Returns an implementation of ICanvasContext
that describes the state of this canvas control.
public function get context():ICanvasContext
cursor | property |
cursor:Cursor
Get or set the cursor instance that will be displayed for this canvas.
The cursor is shown if the mouse pointer is currently located in the canvas area or if the user started a dragging gesture over the canvas.
If an input mode is active it will set this property to the input mode's preferred
cursor, overwriting any previous settings. In that case, the canvas's cursor
has to be set via the defaultCursor
property of the input mode.
Note that when this property is set, cursorManager.removeAllCursors()
will
be called to ensure that the new cursor is actually displayed.
This property can be used as the source for data binding.
public function get cursor():Cursor
public function set cursor(value:Cursor):void
See also
doubleClickSize | property |
doubleClickSize:ISize
The size of the area within which the user must click twice for the two clicks to be considered a double-click. This property also determines whether a "small drag" is considered a click.
The default value is (10,10)
.
This property can be used as the source for data binding.
public function get doubleClickSize():ISize
public function set doubleClickSize(value:ISize):void
See also
doubleClickTime | property |
doubleClickTime:int
The time that may elapse between two consecutive mouse clicks so the last click is still considered a double click.
This property can be used as the source for data binding.
public function get doubleClickTime():int
public function set doubleClickTime(value:int):void
See also
dragSize | property |
dragSize:ISize
The area in view coordinates the mouse may stay in before a
movement is considered a drag. If the mouse is moved within this area longer than
dragTime
milliseconds, the movement will be considered a drag, nevertheless
The larger the area the later a mouse movement will be recognized as a drag.
This influences the click-sensitivity, since a mouse button release is only
considered a click if there was no drag since the last mouse button press.
The default value is (5,5)
.
This property can be used as the source for data binding.
public function get dragSize():ISize
public function set dragSize(value:ISize):void
See also
dragTime | property |
dragTime:int
The value of the drag time. This value indicates the amount of
time in milliseconds that may pass before a mouse movement is considered a
drag when the mouse stays within its dragSize
area.
The higher the value the later a mouse movement will be recognized as a drag.
This influences the click-sensitivity, since a mouse button release is only
considered a click if there was no drag since the last mouse button press.
The default value is 300
.
This property can be used as the source for data binding.
public function get dragTime():int
public function set dragTime(value:int):void
See also
editable | property |
editable:Boolean
Property that sets the editable state of this canvas.
IInputMode implementations should honor this property. Events will still be delivered to the IInputModes, however they should not modify the model.
This property can be used as the source for data binding.
public function get editable():Boolean
public function set editable(value:Boolean):void
enableMouseChildren | property |
enableMouseChildren:int
Determines whether to propagate mouse events to the children in the display list.
Propagating the mouse events to the children may increase the CPU usage of a complex display list dramatically.
The input modes are not affected by this setting.
Use one of the MOUSE_CHILDREN
constants to determine the policy:
MOUSE_CHILDREN_AUTO
: Only propagate events to the child objects if there are
objects which may require interactivity.MOUSE_CHILDREN_NEVER
: never propagate events to the child objects.MOUSE_CHILDREN_ALWAYS
: always propagate events to the child objects. The default value is MOUSE_CHILDREN_AUTO
.
This property can be used as the source for data binding.
public function get enableMouseChildren():int
public function set enableMouseChildren(value:int):void
See also
hasHorizontalScrollBar | property |
hasHorizontalScrollBar:Boolean
[read-only] public function get hasHorizontalScrollBar():Boolean
hasVerticalScrollBar | property |
hasVerticalScrollBar:Boolean
[read-only] public function get hasVerticalScrollBar():Boolean
hitTestRadius | property |
hitTestRadius:Number
Specifies the radius of the area around the mouse in view coordinates in which an
IHitTestable
may lie to be considered a valid hit.
This value
can be queried from within the IHitTestable implementation from the ICanvasContext.hitTestRadius
The default value is 4.0
.
public function get hitTestRadius():Number
public function set hitTestRadius(value:Number):void
horizontalLineScrollSize | property |
horizontalLineScrollSize:Number
The amount to scroll when an arrow button of the horizontal scrollbar is pressed, in pixels.
This property can be used as the source for data binding.
public function get horizontalLineScrollSize():Number
public function set horizontalLineScrollSize(value:Number):void
horizontalPageScrollSize | property |
horizontalPageScrollSize:Number
Specifies the amount to scroll when the horizontal scroll bar track is pressed, in pixels.
This property can be used as the source for data binding.
public function get horizontalPageScrollSize():Number
public function set horizontalPageScrollSize(value:Number):void
horizontalScrollPolicy | property |
horizontalScrollPolicy:String
Specifies the visibility policy for the horizontal scrollbar.
This property can be used as the source for data binding.
public function get horizontalScrollPolicy():String
public function set horizontalScrollPolicy(value:String):void
See also
horizontalScrollPosition | property |
horizontalScrollPosition:Number
The current position of the horizontal scroll bar. This is equal to the distance in pixels between the left edge of the scrollable surface and the leftmost piece of the surface that is currently visible.
The default value is 0
.
This property can be used as the source for data binding.
public function get horizontalScrollPosition():Number
public function set horizontalScrollPosition(value:Number):void
inputMode | property |
inputMode:IInputMode
Specifies the single IInputMode
instance that shall
be installed for this canvas.
This property can be used as the source for data binding.
public function get inputMode():IInputMode
public function set inputMode(value:IInputMode):void
inputModeContext | property |
inputModeContext:IInputModeContext
The InputModeContext property.
This context object is passed to IInputMode
instances during
installation and removal.
If the field has not yet been initialized upon first access, the
factory method createInputModeContext
will be called.
Upon change the onInputModeContextChanged
method will be called.
public function get inputModeContext():IInputModeContext
public function set inputModeContext(value:IInputModeContext):void
See also
inputModeContextLookupChain | property |
inputModeContextLookupChain:LookupChain
[read-only]
Retrieves the LookupChain
that can be used
to decorate the lookup
call in the inputModeContext
.
public function get inputModeContextLookupChain():LookupChain
inputModes | property |
inputModes:List
[read-only]
Returns the internal list of currently installed IInputMode
s.
This is a mutable list. To install new instances simply add them to the list and remove them to uninstall them.
public function get inputModes():List
See also
lastCanvasMouseEvent | property |
lastCanvasMouseEvent:CanvasMouseEvent
[read-only]
Gets the last CanvasMouseEvent
that was dispatched by this instance.
public function get lastCanvasMouseEvent():CanvasMouseEvent
limitedMinZoom | property |
limitedMinZoom:Number
[read-only] Returns the minimum zoom value for the current canvas size and viewport limits
This property can be used as the source for data binding.
public function get limitedMinZoom():Number
See also
maxHorizontalScrollPosition | property |
maxHorizontalScrollPosition:Number
[read-only]
If the canvas component currently has a horizontal scroll bar,
returns the maxScrollPosition
of the horizontal scroll bar.
Else, returns 0
.
public function get maxHorizontalScrollPosition():Number
See also
maxVerticalScrollPosition | property |
maxVerticalScrollPosition:Number
[read-only]
If the canvas component currently has a vertical scroll bar,
returns the maxScrollPosition
of the vertical scroll bar.
Else, returns 0
.
public function get maxVerticalScrollPosition():Number
See also
maxZoom | property |
maxZoom:Number
The maxZoom
property.
The zoom
property cannot be set to a value greater than maxZoom
.
The default value is 200
.
This property can be used as the source for data binding.
public function get maxZoom():Number
public function set maxZoom(value:Number):void
minHorizontalScrollPosition | property |
minHorizontalScrollPosition:Number
[read-only]
If the canvas component currently has a horizontal scroll bar,
returns the minScrollPosition
of the horizontal scroll bar.
Else, returns 0
.
public function get minHorizontalScrollPosition():Number
See also
minVerticalScrollPosition | property |
minVerticalScrollPosition:Number
[read-only]
If the canvas component currently has a vertical scroll bar,
returns the minScrollPosition
of the vertical scroll bar.
Else, returns 0
.
public function get minVerticalScrollPosition():Number
See also
minZoom | property |
minZoom:Number
The minZoom
property.
The zoom
property cannot be set to a value less than minZoom
.
The default value is 0.01
.
This property can be used as the source for data binding.
public function get minZoom():Number
public function set minZoom(value:Number):void
mouseInterval | property |
mouseInterval:Number
Time interval in milliseconds after which a mouse move (MouseEvent.MOUSE_MOVE
) is processed.
The CanvasComponent
translates MouseEvent.MOUSE_MOVE
into
CanvasMouseEvents
. This does not happen immediately but after a time interval which is
determined by this property. After the time interval only the last event will be processed and re-dispatched.
This improves performance by omitting all mouse events which will not have any visible effect anyway.
Setting this property to 0 will cause all mouse events to be processed immediately.
Setting this property to larger intervals than 100 ms will result in a visible lag and thus is not recommended.
Automated GUI testing may require to set this property to 0.
The default value is 0
.
public function get mouseInterval():Number
public function set mouseInterval(value:Number):void
See also
mouseWheelZoomCenteredRecognizer | property |
mouseWheelZoomCenteredRecognizer:Function
The recognizer used to determine if the mouse event passed to the mouseWheelZoom method should trigger a zoom action that uses the center of the view port as fixed coordinate during zooming.
The default value is EventRecognizers.NO_MODIFIER_PRESSED
.
This property can be used as the source for data binding.
public function get mouseWheelZoomCenteredRecognizer():Function
public function set mouseWheelZoomCenteredRecognizer(value:Function):void
See also
mouseWheelZoomFactor | property |
mouseWheelZoomFactor:Number
The factor by which the zoom level changes when the mouse wheel is turned.
The default value is 1.02
.
This property can be used as the source for data binding.
public function get mouseWheelZoomFactor():Number
public function set mouseWheelZoomFactor(value:Number):void
mouseWheelZoomMouseLocationRecognizer | property |
mouseWheelZoomMouseLocationRecognizer:Function
The recognizer used to determine if the mouse event passed to the mouseWheelZoom method should trigger a zoom action that uses the current mouse location as fixed coordinate during zooming.
The default value is EventRecognizers.MODIFIER_CTRL
.
This property can be used as the source for data binding.
public function get mouseWheelZoomMouseLocationRecognizer():Function
public function set mouseWheelZoomMouseLocationRecognizer(value:Function):void
See also
treeDirty | property |
treeDirty:Boolean
Property that determines whether the whole canvasObjectTree
is
redrawn upon the next invocation of updateDisplayList()
.
public function get treeDirty():Boolean
public function set treeDirty(value:Boolean):void
treePartiallyDirty | property |
treePartiallyDirty:Boolean
Property that determines whether the canvasObjectTree
is
redrawn partially upon the next invocation of updateDisplayList()
.
public function get treePartiallyDirty():Boolean
public function set treePartiallyDirty(value:Boolean):void
verticalLineScrollSize | property |
verticalLineScrollSize:Number
The amount to scroll when an arrow button of the vertical scrollbar is pressed, in pixels.
This property can be used as the source for data binding.
public function get verticalLineScrollSize():Number
public function set verticalLineScrollSize(value:Number):void
verticalPageScrollSize | property |
verticalPageScrollSize:Number
Specifies the amount to scroll when the vertical scroll bar track is pressed, in pixels.
This property can be used as the source for data binding.
public function get verticalPageScrollSize():Number
public function set verticalPageScrollSize(value:Number):void
verticalScrollPolicy | property |
verticalScrollPolicy:String
Specifies the visibility policy for the vertical scrollbar.
This property can be used as the source for data binding.
public function get verticalScrollPolicy():String
public function set verticalScrollPolicy(value:String):void
See also
verticalScrollPosition | property |
verticalScrollPosition:Number
The current position of the vertical scroll bar. This is equal to the distance in pixels between the top edge of the scrollable surface and the topmost piece of the surface that is currently visible.
The default value is 0
.
This property can be used as the source for data binding.
public function get verticalScrollPosition():Number
public function set verticalScrollPosition(value:Number):void
viewPoint | property |
viewPoint:Point
The current view point. The view point is the point in world coordinates that is mapped to the top left corner point in the current viewport.
This property can be used as the source for data binding.
public function get viewPoint():Point
public function set viewPoint(value:Point):void
viewPort | property |
viewPort:IRectangle
[read-only] Returns the currently visible viewing region in world coordinates.
public function get viewPort():IRectangle
viewportLimiter | property |
viewportLimiter:ViewportLimiter
Gets or sets the viewport limiter instance that can be used to limit the explorable region.
By default there are no limits set on the explorable region.
This property can be used as the source for data binding.
public function get viewportLimiter():ViewportLimiter
public function set viewportLimiter(value:ViewportLimiter):void
zoom | property |
zoom:Number
The zoom factor for this canvas control.
A zoom level of 1.0
will make each unit in world-coordinate space appear exactly one unit in screen coordinates
wide.
If this property is written, the canvas will zoom to the new value while keeping the center of view at the same world coordinates.
The default value is 1.0
.
This property can be used as the source for data binding.
public function get zoom():Number
public function set zoom(value:Number):void
zoomIfCanvasHit | property |
zoomIfCanvasHit:Boolean
Whether the mouse wheel triggers zooming whenever the mouse
is over the canvas area (true
) or whether the
canvas needs focus to trigger zooming (false
).
When the canvas component has focus, the mouse wheel will always trigger zooming.
The default value is true
.
public function get zoomIfCanvasHit():Boolean
public function set zoomIfCanvasHit(value:Boolean):void
CanvasComponent | () | Constructor |
public function CanvasComponent()
Constructor.
addCanvasObject | () | method |
public function addCanvasObject(userObject:Object, descriptor:ICanvasObjectDescriptor = null, group:ICanvasObjectGroup = null):ICanvasObject
Adds an element to the internal canvas object tree to the specified group.
The descriptor will be queried for the various implementations for the given userObject at rendering time.
Parameters
userObject:Object — The object to be added
| |
descriptor:ICanvasObjectDescriptor (default = null ) — the descriptor related to the object
| |
group:ICanvasObjectGroup (default = null ) — The canvas object group that should contain the added element
|
ICanvasObject — An ICanvasObject that can be used to control the rendering order and to later remove
the element from the tree.
|
addDisplayObjectCreator | () | method |
public function addDisplayObjectCreator(creator:IDisplayObjectCreator, group:ICanvasObjectGroup = null):ICanvasObject
Adds an IDisplayObjectCreator
instance to the scene graph using
CanvasObjectDescriptor.Instance
as the ICanvasObjectDescriptor
.
This method is equivalent to calling addCanvasObject(object,ICanvasObjectDescriptor)
with
CanvasObjectDescriptor.instance
as the second argument and a non-null first argument.
Parameters
creator:IDisplayObjectCreator — The display object creator instance to use.
| |
group:ICanvasObjectGroup (default = null ) — The canvas object group that should contain the added element
|
ICanvasObject — The handle for the newly created scene graph element
|
addGroup | () | method |
public function addGroup():ICanvasObjectGroup
Adds a new ICanvasObjectGroup
to the root of the canvas object tree.
ICanvasObjectGroup — The newly created group.
|
addGroupToGroup | () | method |
public function addGroupToGroup(toGroup:ICanvasObjectGroup):ICanvasObjectGroup
Adds a new ICanvasObjectGroup
to the specified group in the current canvas object tree.
Can be used to build groups of ICanvasObject
's that can be moved within the canvas object
tree.
Parameters
toGroup:ICanvasObjectGroup — the group to add the new group to.
|
ICanvasObjectGroup — the newly created group.
|
addInputMode | () | method |
addPaintable | () | method |
public function addPaintable(paintable:IPaintable, group:ICanvasObjectGroup = null):ICanvasObject
Adds an IPaintable
instance to the scene graph using
CanvasObjectDescriptor.Instance
as the ICanvasObjectDescriptor
.
This method is equivalent to calling addCanvasObject(object,ICanvasObjectDescriptor)
with
CanvasObjectDescriptor.instance
as the second argument and a non-null first argument.
Kept for compatibility. This implementation wraps the paintable into a PaintableDisplayObjectCreator
.
It is recommended to (re-)implement the IPaintable
as IDisplayObjectCreator
and add it using addDisplayObjectCreator
.
Parameters
paintable:IPaintable — The paintable instance to use.
| |
group:ICanvasObjectGroup (default = null ) — The canvas object group that should contain the added element
|
ICanvasObject — The handle for the newly created scene graph element
|
See also
adjustCursor | () | method |
protected function adjustCursor(evt:CanvasMouseEvent):void
Adjusts the mouse cursor based on the given mouse event and
the cursor
property.
Parameters
evt:CanvasMouseEvent |
collectCanvasObjects | () | method |
public function collectCanvasObjects(x:Number, y:Number, elementFoundCallback:Function):void
Collects all canvas object instances that are hit at the given coordinate set.
Parameters
x:Number — the x coordinate of the query in the world coordinate system
| |
y:Number — the y coordinate of the query in the world coordinate system
| |
elementFoundCallback:Function — A callback that is called when a canvas object is considered a hit.
the callback takes an ICanvasObject as a parameter.
|
createChildren | () | method |
override protected function createChildren():void
createInputModeContext | () | method |
protected function createInputModeContext():IInputModeContext
Factory method for the InputModeContext property. This method will be called
upon first access to the inputModeContext
property.
IInputModeContext — A new instance of IInputModeContext that has this instance set as it's
canvasComponent and uses this instance's inputModeContextLookup for
lookup queries.
|
createSprite | () | method |
public function createSprite():PrintSprite
Creates a sprite containing a complete copy of the current canvas object tree.
This method is useful for custom printing. The created sprite can be transformed
and added to a flash.printing.PrintJob
.
PrintSprite — A sprite that contains a copy of the canvas visualization.
|
See also
paintComplete
property should be queried to determine if painting has finished:
var printSprite:PrintSprite = canvasComponent.createSprite(); if(!printSprite.paintComplete) { var onPaintComplete:Function = function(evt:Event):void { printSprite.removeEventListener(Event.COMPLETE,onPaintComplete); myPrint(printSprite); }; printSprite.addEventListener(Event.COMPLETE,onPaintComplete); } else { myPrint(printSprite); }
decreaseZoom | () | method |
public function decreaseZoom(factor:Number = 1.2):void
Descrease the current zoom level using the provided factor.
This implementation uses the viewportLimiter
to limit the viewport.
Parameters
factor:Number (default = 1.2 ) — The factor to divide the current zoom value by
|
See also
disposeListeners | () | method |
protected function disposeListeners(eventDispatcher:IEventDispatcher):void
Unregister all event listeners that were registered with the stage. This method is called whenever this canvas component is removed from the display list.
Parameters
eventDispatcher:IEventDispatcher — The stage
|
doEvent | () | method |
protected function doEvent(e:Event = null):void
Delayed processing of a MouseEvent.MOUSE_MOVE
.
Parameters
e:Event (default = null ) — The event to process.
|
fitContent | () | method |
public function fitContent():void
Adjusts the view port to fully encompass the current content rectangle.
The implementation uses the viewportLimiter
to limit the resulting
viewport.
The resulting zoom level will not be greater than 1.0
, unless
the viewportLimiter demands a greater zoom value.
The actual fitting is executed asynchronously when the component gets validated.
Thus, when this method returns, the viewport is not fit yet. Code which relies
on an updated view port has to be executed in a callLater()
call.
See also
fitContentCore | () | method |
protected function fitContentCore():void
When fitContent()
is called, this method
is invoked in the next updateDisplayList()
execution
to actually fit the content rectangle into the viewport.
See also
fitGraphBounds | () | method |
public function fitGraphBounds(margins:IRectangle = null):void
Updates the content rectangle and adjusts the viewport to encompass the contents.
This method combines the calls to updateContentRect()
and
fitContent()
.
The actual fitting is executed asynchronously when the component gets validated.
Thus, when this method returns, the viewport is not fit yet. Code which relies
on an updated view port has to be executed in a callLater()
call.
Parameters
margins:IRectangle (default = null ) — A set of margins to add to the content rectangle. Optional, if omitted
the current margins will not be changed.
|
See also
forceRepaint | () | method |
public function forceRepaint():void
Invalidates this canvas component and causes a repaint of all display objects that are visible in this canvas component.
getCanvasObject | () | method |
public function getCanvasObject(worldX:Number, worldY:Number):ICanvasObject
Returns the top most canvas object instance that is hit at the given coordinate set.
Parameters
worldX:Number — the x coordinate of the query in the world coordinate system
| |
worldY:Number — the y coordinate of the query in the world coordinate system
|
ICanvasObject — The top most canvas object that is hit at the given coordinates.
|
getCanvasObjects | () | method |
public function getCanvasObjects(worldX:Number, worldY:Number):Iterable
Returns a list of all canvas objects in hit order at the given world coordinate location.
The order of the elements in the list is the natural hit test order, i.e. elements painted on top of others will be reported first in the list.
Parameters
worldX:Number — the x coordinate for the query
| |
worldY:Number — the y coordinate for the query
|
Iterable — a list of canvas objects that are hit in reverse painting order
|
getCanvasRect | () | method |
public function getCanvasRect():Rectangle
Returns a rectangle defined by the available space for displaying the CanvasObjectTree within this Component, in stage coordinates.
ReturnsRectangle — A rectangle defined by the available space for displaying the CanvasObjectTree.
|
getHits | () | method |
public function getHits(stageX:Number, stageY:Number, useShape:Boolean = true):Array
Returns an array of ICanvasObject
s that are hit by the given coords.
Note that this method uses the flash internal hit test which may be faster than using
getCanvasObject
/getCanvasObjects
Parameters
stageX:Number — Whether to use only the bounding box (false ) or the detailed shape (true ) for the hittest.
| |
stageY:Number | |
useShape:Boolean (default = true )
|
Array — An Array of ICanvasObject s that are hit.
|
increaseZoom | () | method |
public function increaseZoom(factor:Number = 1.2):void
Increase the current zoom level using the provided factor.
This implementation uses the viewportLimiter
to limit the viewport.
Parameters
factor:Number (default = 1.2 ) — The factor to multiply the current zoom value with
|
See also
initListeners | () | method |
protected function initListeners(eventDispatcher:IEventDispatcher):void
Initialize all event listeners that should be registered with the stage. This method is called whenever this canvas component is added to the display list.
Parameters
eventDispatcher:IEventDispatcher — The stage
|
inputModeContextLookup | () | method |
protected function inputModeContextLookup(type:Class):Object
Callback that is used by the default implementation of inputModeContext
to resolve lookup
calls.
Parameters
type:Class — The Type to query
|
Object — The result of the query.
|
See also
invalidateAllObjects | () | method |
public function invalidateAllObjects():void
Forces a repaint of all canvas objects.
The repaint will be done during the next screen update.
See also
invalidateDirtyObjects | () | method |
public function invalidateDirtyObjects():void
Forces a repaint of the dirty canvas objects.
The repaint will be done during the next screen update.
See also
invalidateDisplayList | () | method |
override public function invalidateDisplayList():void
Marks a component so that its updateDisplayList() method gets called during a later screen update.
isCanvasHit | () | method |
public function isCanvasHit(target:DisplayObject, stageX:Number, stageY:Number):Boolean
Checks whether the point at stageX,stageY
is within the
canvas bounds and target
is a child of the canvas.
Parameters
target:DisplayObject — A display object that was the target of an event.
| |
stageX:Number — The x coordinate to check (stage coordinates)
| |
stageY:Number — The y coordinate to check (stage coordinates)
|
Boolean — true if target is a child of the canvas and stageX, stageY
is within the canvas bounds
|
iterateHits | () | method |
public function iterateHits(x:Number, y:Number, root:ICanvasObjectGroup = null, filter:Function = null):Iterator
Iterates all hit elements in the canvas below the given group that are accepted by a given filter.
Hit testing is performed using the IHitTestable
instance returned for each visible ICanvasObject
in the current scene graph.
Parameters
x:Number — the x coordinate to perform the hit test at
| |
y:Number — the y coordinate to perform the hit test at
| |
root:ICanvasObjectGroup (default = null ) — the root of the scene graph to use
| |
filter:Function (default = null ) — A filter function that decides whether a given canvas object should be considered for testing at all.
|
Iterator — a live iterable of the elements that are hit
|
See also
lookup | () | method |
public function lookup(type:Class):Object
Parameters
type:Class |
Object |
measure | () | method |
override protected function measure():void
Calculates the default size and the default minimum size of the component.
mouseWheelZoom | () | method |
protected function mouseWheelZoom(evt:CanvasMouseEvent):void
If the autoMouseWheelZoom
property is set to true
,
this method will adjust the current zoom level.
If the mouseWheelZoomMouseLocationRecognizer
returns true
for the passed event
this method will keep the world coordinates at the current mouse position.
Otherwise if the mouseWheelZoomCenteredRecognizer
returns true
it will keep
the world coordinates at the center of the canvas.
If both recognizers return false
no zoom action takes place.
Parameters
evt:CanvasMouseEvent — The CanvasMouseEvent to be interpreted.
|
See also
onAdd | () | method |
protected function onAdd(event:FlexEvent):void
Called when the component is added to the display list.
Calls initListeners
, passing the stage as the eventDispatcher
.
Parameters
event:FlexEvent |
onAutoDragChanged | () | method |
protected function onAutoDragChanged(oldValue:Boolean, newValue:Boolean):void
Called when the autoDrag
property changes.
Dispatches the CanvasComponent.AUTO_DRAG_CHANGED
event.
Parameters
oldValue:Boolean | |
newValue:Boolean |
See also
onAutoDragInsetsChanged | () | method |
protected function onAutoDragInsetsChanged(oldValue:ImmutableRectangle, newValue:ImmutableRectangle):void
Called when the autoDragInsets
property changes.
Dispatches the CanvasComponent.AUTO_DRAG_INSETS_CHANGED
event.
Parameters
oldValue:ImmutableRectangle | |
newValue:ImmutableRectangle |
See also
onCanvasMouseClicked | () | method |
protected function onCanvasMouseClicked(evt:CanvasMouseEvent):void
Callback method that is called when the mouse has been clicked.
The clickCount
property of the event can be queried
to determine whether a double click has occurred.
This callback will be called after the onMouseUp()
method has been invoked and only if the mouse has not been moved
by a great amount since the last onMouseDown
event.
This method will dispatch the CanvasMouseEvent.CANVAS_MOUSE_CLICK
event.
Subclasses overriding this method should make sure to invoke the
super class implementation.
Parameters
evt:CanvasMouseEvent — The canvas mouse event that describes the mouse gesture.
|
See also
onCanvasMouseDown | () | method |
protected function onCanvasMouseDown(evt:CanvasMouseEvent):void
Callback method that is called when a mouse button has been pressed.
This method will dispatch the CanvasMouseEvent.CANVAS_MOUSE_DOWN
event. Subclasses overriding this method should make sure to invoke the
super class implementation.
Parameters
evt:CanvasMouseEvent — The canvas mouse event that describes the mouse gesture.
|
See also
onCanvasMouseDragged | () | method |
protected function onCanvasMouseDragged(evt:CanvasMouseEvent):void
Callback method that is called when the mouse gets dragged. Moving the mouse while at least one button is pressed is considered dragging.
This method will dispatch the CanvasMouseEvent.CANVAS_MOUSE_DRAG
event. Subclasses overriding this method should make sure to invoke the
super class implementation.
Parameters
evt:CanvasMouseEvent — The canvas mouse event that describes the mouse gesture.
|
See also
onCanvasMouseMoved | () | method |
protected function onCanvasMouseMoved(evt:CanvasMouseEvent):void
Callback method that is called when the mouse has been moved and
the mouse button has not been pressed. If the mouse button has been pressed,
onCanvasMouseDragged
method would have been called instead.
This method will dispatch the CanvasMouseEvent.CANVAS_MOUSE_MOVE
event. Subclasses overriding this method should make sure to invoke the
super class implementation.
Parameters
evt:CanvasMouseEvent — The canvas mouse event that describes the mouse gesture.
|
See also
onCanvasMouseUp | () | method |
protected function onCanvasMouseUp(evt:CanvasMouseEvent):void
Callback method that is called when a mouse button has been released.
This method will dispatch the CanvasMouseEvent.CANVAS_MOUSE_UP
event. Subclasses overriding this method should make sure to invoke the
super class implementation.
Parameters
evt:CanvasMouseEvent — The canvas mouse event that describes the mouse gesture.
|
See also
onCanvasMouseWheel | () | method |
protected function onCanvasMouseWheel(evt:CanvasMouseEvent):void
Callback method that is called when the mouse wheel has been turned.
This method will dispatch the CanvasMouseEvent.CANVAS_MOUSE_WHEEL
event. Subclasses overriding this method should make sure to invoke the
super class implementation.
mouseWheelZoom
method.
Parameters
evt:CanvasMouseEvent — The canvas mouse event that describes the mouse gesture.
|
See also
onContentRectChanged | () | method |
protected function onContentRectChanged():void
Callback that is invoked when the ContentRect
property changes.
See also
onEditableChanged | () | method |
protected function onEditableChanged():void
Callback that is called when the editable
property changes.
onHitTestRadiusChanged | () | method |
protected function onHitTestRadiusChanged(oldValue:Number, newValue:Number):void
Callback that is invoked when the hitTestRadius property changed.
Parameters
oldValue:Number | |
newValue:Number |
onInputModeChanged | () | method |
protected function onInputModeChanged(oldValue:IInputMode, newValue:IInputMode):void
Callback that is invoked when the inputMode
property changes.
This will raise the inputModeChanged"
event.
Parameters
oldValue:IInputMode | |
newValue:IInputMode |
See also
onInputModeContextChanged | () | method |
protected function onInputModeContextChanged(oldInputModeContext:IInputModeContext, newInputModeContext:IInputModeContext):void
Called when the inputModeContext
property value changes
and after initialization of the field.
Triggers the inputModeContextChanged"
event.
Parameters
oldInputModeContext:IInputModeContext — the old value, which may be null the first time
| |
newInputModeContext:IInputModeContext — the new value
|
onMouseDown | () | method |
protected function onMouseDown(evt:MouseEvent):void
Tries to gain the focus, if the canvas area was hit.
Calls onCanvasMouseDown
with the corresponding
CanvasMouseEvent
.
Parameters
evt:MouseEvent — The original mouse event
|
See also
onMouseEvent | () | method |
protected function onMouseEvent(evt:MouseEvent):void
Called when this component receives a MouseEvent.
This method is deprecated. Please use the various
onCanvasMouseXXX hooks or event listeners for
CanvasMouseEvent
s instead.
Parameters
evt:MouseEvent |
See also
onMouseMove | () | method |
protected function onMouseMove(evt:MouseEvent):void
Calls onCanvasMouseDragged
or
onCanvasMouseMoved
with the corresponding
CanvasMouseEvent
.
This method will not necessarily trigger drag events immediately. This depends on the values
of dragTime
and dragSize
.
Parameters
evt:MouseEvent |
See also
onMouseUp | () | method |
protected function onMouseUp(evt:MouseEvent):void
Calls onCanvasMouseUp
and possibly
onCanvasMouseClicked
with the corresponding
CanvasMouseEvent
.
This method will not necessarily trigger the click event. This depends on the values
doubleClickSize
and doubleClickTime
as well
as if there has been a drag event delivered since the last mouse press.
Parameters
evt:MouseEvent — The original mouse event
|
See also
onMouseWheel | () | method |
protected function onMouseWheel(evt:MouseEvent):void
Calls onCanvasMouseWheel
with the corresponding
CanvasMouseEvent
.
Parameters
evt:MouseEvent — The original mouse event
|
See also
onRemove | () | method |
protected function onRemove(event:FlexEvent):void
Called when the component is removed from the display list.
Calls disposeListeners
, passing the stage as the eventDispatcher
.
Parameters
event:FlexEvent |
onViewPortChanged | () | method |
protected function onViewPortChanged():void
Callback that is invoked when the view port property changes.
The view port is the visible portion of the world rectangle in the
world coordinate system.
This method fires the viewPortChanged
event.
See also
() | method |
public function print(bitmap:Boolean = true, borderSize:uint = 5, backgroundFill:* = 0xFFFFFF, printRect:Rectangle = null, canvasSprite:Sprite = null):void
Prints the current canvas object tree or a pre-calculated copy of it.
The content is scaled down to fit on the page.
For more printing options, use class com.yworks.canvas.CanvasPrinter
For completely customized printing, use createSprite()
along with a Flex PrintJob
.
Parameters
bitmap:Boolean (default = true ) — Whether to print in bitmap or vector mode. See the documentation
of the flash.printing.PrintJob class for details.
| |
borderSize:uint (default = 5 ) — spacing to include between the content bounds and the printable area bounds, in pixels.
| |
backgroundFill:* (default = 0xFFFFFF ) — A uint specifying the desired background color or null if no background
fill should be used.
| |
printRect:Rectangle (default = null ) — The portion of the canvas to print, in world coordinates.
| |
canvasSprite:Sprite (default = null ) — A sprite containing a copy of the canvas object tree or null if a new copy
shall be created.
If no print rectangle is provided, the contentRect will be used after updateContentRect() has been called
and the update has completed.
|
See also
processEvent | () | method |
protected function processEvent(event:Event):void
Processes a mouse event.
A MouseEvent.MOUSE_MOVE
will start a timer with the duration mouseInterval
ms.
After this interval only the last mouse move event will be forwarded to onMouseMove
.
All other events will immediately be forwarded to onMouseUp
, onMouseDown
, or
onMouseWheel
. Also, a pending mouse move event will be forwarded before the new event.
Parameters
event:Event — The event to process.
|
removeInputMode | () | method |
setLimitedCenter | () | method |
public function setLimitedCenter(center:Point):void
Sets the provided center unless this would cause the viewport to exceed
the limits of the viewportLimiter
.
Parameters
center:Point — the new viewpoint to set
|
See also
setLimitedViewpoint | () | method |
public function setLimitedViewpoint(vp:Point):void
Sets the provided viewpoint unless this would cause the viewport to exceed
the limits of the viewportLimiter
.
Parameters
vp:Point — the new viewpoint to set
|
See also
setLimitedViewport | () | method |
public function setLimitedViewport(target:IRectangle):void
Sets the provided viewport unless this would cause the viewport to exceed
the limits of the viewportLimiter
.
Parameters
target:IRectangle — the new target viewport to set
|
See also
setLimitedZoom | () | method |
public function setLimitedZoom(newZoom:Number):void
Sets the provided zoom value unless this would cause the viewport to exceed
the limits of the viewportLimiter
.
Parameters
newZoom:Number — the new zoom value to set
|
See also
toViewCoordinates | () | method |
public function toViewCoordinates(p:IMutablePoint):void
Converts a point in world coordinates to view coordinates.
Parameters
p:IMutablePoint — A point in world coordinates
|
toWorldCoordinates | () | method |
public function toWorldCoordinates(p:IMutablePoint):void
Converts a point in view coordinates to world coordinates.
Parameters
p:IMutablePoint — A point in view coordinates
|
updateContentRect | () | method |
public function updateContentRect(margins:IRectangle = null):void
Updates the contentRect
to encompass the bounds by all elements in the
current scene graph upon the next invocation of updateDisplayList
.
This method will traverse all visible elements in the canvas object tree and query their bounds.
The resulting bounds will be set to the content rectangle plus the provided margins
.
The actual updating is executed asynchronously when the component gets validated.
Thus, when this method returns, the content rectangle is not updated yet. Code which relies
on an updated content rectangle has to be executed in a callLater()
call.
Parameters
margins:IRectangle (default = null ) — Margins to be added around the content rectangle.
|
See also
updateDisplayList | () | method |
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Parameters
unscaledWidth:Number | |
unscaledHeight:Number |
updateTree | () | method |
protected function updateTree(partially:Boolean = false):void
Repaints the display list
Parameters
partially:Boolean (default = false ) — When true the display list is updated only partially
|
updateViewport | () | method |
protected function updateViewport():void
update the viewport bounds upon the next invocation of updateDisplayList
.
zoomTo | () | method |
public function zoomTo(px:Number, py:Number, theZoom:Number):void
Sets the zoom level and view port center to the given values.
Parameters
px:Number — the x-coordinate of the new center of the view port in world coordinates
| |
py:Number — the y-coordinate new center of the view port in world coordinates
| |
theZoom:Number — the new zoom level
|
zoomToRect | () | method |
public function zoomToRect(rect:Rectangle, maxZoom:Number):void
Adjusts the view port to fit in the given rectangle.
The new zoom level is calculated so that the given rectangle is included in the view port and
maxZoom
isn't exceeded.
Parameters
rect:Rectangle — A rectangle in world coordinates that shall be fit into the view port.
| |
maxZoom:Number (default = NaN ) — The maximal level to zoom to.
|
autoDragChanged | Event |
mx.events.PropertyChangeEvent
com.yworks.canvas.CanvasComponent.AUTO_DRAG_CHANGED
Dispatched when the autoDrag
property changes.
autoDrag
property changes.
The event type is mx.events.PropertyChangeEvent
.
autoDragInsetsChanged | Event |
mx.events.PropertyChangeEvent
com.yworks.canvas.CanvasComponent.AUTO_DRAG_INSETS_CHANGED
Dispatched when the autoDragInsets
property changes.
autoDragInsets
property changes.
The event type is flash.events.PropertyChangeEvent
.
canvasMouseClick | Event |
com.yworks.canvas.input.CanvasMouseEvent
com.yworks.canvas.input.CanvasMouseEvent.CANVAS_MOUSE_CLICK
Dispatched when the mouse is clicked.
canvasMouseDoubleClick | Event |
com.yworks.canvas.input.CanvasMouseEvent
com.yworks.canvas.input.CanvasMouseEvent.CANVAS_MOUSE_DOUBLE_CLICK
Dispatched when the mouse is double clicked.
This event is deprecated. Please use CANVAS_MOUSE_CLICK and the event's clickCount property instead.
This event is deprecated. Please use CANVAS_MOUSE_CLICK and the event's clickCount property instead.canvasMouseDown | Event |
com.yworks.canvas.input.CanvasMouseEvent
com.yworks.canvas.input.CanvasMouseEvent.CANVAS_MOUSE_DOWN
Dispatched when the mouse is pressed.
canvasMouseDrag | Event |
com.yworks.canvas.input.CanvasMouseEvent
com.yworks.canvas.input.CanvasMouseEvent.CANVAS_MOUSE_DRAG
Dispatched when the mouse is dragged.
canvasMouseMove | Event |
com.yworks.canvas.input.CanvasMouseEvent
com.yworks.canvas.input.CanvasMouseEvent.CANVAS_MOUSE_MOVE
Dispatched when the mouse is moved.
canvasMouseUp | Event |
com.yworks.canvas.input.CanvasMouseEvent
com.yworks.canvas.input.CanvasMouseEvent.CANVAS_MOUSE_UP
Dispatched when the mouse is released.
canvasMouseWheel | Event |
com.yworks.canvas.input.CanvasMouseEvent
com.yworks.canvas.input.CanvasMouseEvent.CANVAS_MOUSE_WHEEL
Dispatched when the mousewheel moves.
contentRectChanged | Event |
flash.events.Event
com.yworks.canvas.CanvasComponent.CONTENT_RECT_CHANGED
Dispatched when the contentRect
property changes.
contentRect
property changes.
The event type is flash.events.Event
.
editableChanged | Event |
mx.events.PropertyChangeEvent
com.yworks.canvas.CanvasComponent.EDITABLE_CHANGED
Dispatched when the editable property changes.
Dispatched when the editable property changes. The event type isflash.events.PropertyChangeEvent
.
inputModeChanged | Event |
mx.events.PropertyChangeEvent
com.yworks.canvas.CanvasComponent.INPUT_MODE_CHANGED
Dispatched when the inputMode
property changes.
inputMode
property changes.
The event type is flash.events.PropertyChangeEvent
.
inputModeContextChanged | Event |
mx.events.PropertyChangeEvent
com.yworks.canvas.CanvasComponent.INPUT_MODE_CONTEXT_CHANGED
Dispatched when the inputModeContext
property changes.
inputModeContext
property changes.
The event type is flash.events.PropertyChangeEvent
.
invalidated | Event |
flash.events.Event
com.yworks.canvas.CanvasComponent.INVALIDATED
Dispatched when the canvas has been invalidated.
Dispatched when the canvas has been invalidated. The event type isflash.events.Event
.
scroll | Event |
mx.events.ScrollEvent
ScrollEvent.SCROLL
Dispatched when one of the scrollbars changes its scroll position.
updateTree | Event |
com.yworks.canvas.CanvasEvent
com.yworks.canvas.CanvasEvent.UPDATE_TREE
Dispatched when the canvas object tree is repainted.
Dispatched when the canvas object tree is repaintedviewPointChanged | Event |
com.yworks.canvas.CanvasEvent
com.yworks.canvas.CanvasEvent.VIEW_POINT_CHANGED
Dispatched when the viewPoint property changes.
Dispatched when the view point of aCanvasComponent
changes.
viewPortChanged | Event |
com.yworks.canvas.CanvasEvent
com.yworks.canvas.CanvasEvent.VIEW_PORT_CHANGED
Dispatched when the viewPort
property changes.
CanvasComponent
changes.
zoomChanged | Event |
com.yworks.canvas.CanvasEvent
com.yworks.canvas.CanvasEvent.ZOOM_CHANGED
Dispatched when the zoom property changes.
Dispatched when the zoom of aCanvasComponent
changes.
AUTO_DRAG_CHANGED | Constant |
public static const AUTO_DRAG_CHANGED:String = autoDragChanged
Dispatched when the autoDrag
property changes.
The event type is mx.events.PropertyChangeEvent
.
AUTO_DRAG_INSETS_CHANGED | Constant |
public static const AUTO_DRAG_INSETS_CHANGED:String = autoDragInsetsChanged
Dispatched when the autoDragInsets
property changes.
The event type is flash.events.PropertyChangeEvent
.
CONTENT_RECT_CHANGED | Constant |
public static const CONTENT_RECT_CHANGED:String = contentRectChanged
Dispatched when the contentRect
property changes.
The event type is flash.events.Event
.
EDITABLE_CHANGED | Constant |
public static const EDITABLE_CHANGED:String = editableChanged
Dispatched when the editable property changes.
The event type is flash.events.PropertyChangeEvent
.
INPUT_MODE_CHANGED | Constant |
public static const INPUT_MODE_CHANGED:String = inputModeChanged
Dispatched when the inputMode
property changes.
The event type is flash.events.PropertyChangeEvent
.
INPUT_MODE_CONTEXT_CHANGED | Constant |
public static const INPUT_MODE_CONTEXT_CHANGED:String = inputModeContextChanged
Dispatched when the inputModeContext
property changes.
The event type is flash.events.PropertyChangeEvent
.
INVALIDATED | Constant |
public static const INVALIDATED:String = invalidated
Dispatched when the canvas has been invalidated.
The event type is flash.events.Event
.
MOUSE_CHILDREN_ALWAYS | Constant |
public static const MOUSE_CHILDREN_ALWAYS:int = 1
Mouse events will always be propagated to child DisplayObjects
.
Constant for determining the enableMouseChildren
policy.
This setting increases the CPU usage when the mouse hovers over the canvas. Interactive objects will react to the mouse.
Note that the input modes won't be affected and will work as expected.
MOUSE_CHILDREN_AUTO
should automatically detect whether objects
on the canvas will require mouse events. This setting should only be used
if the auto detection fails.
MOUSE_CHILDREN_AUTO | Constant |
public static const MOUSE_CHILDREN_AUTO:int = -1
Mouse events will only be propagated to child DisplayObjects
if they may need interactivity.
Constant for determining the enableMouseChildren
policy.
This setting lets the canvas automatically detect whether objects
on the canvas will require mouse events. Mainly, when elements are styled using
TemplateNodeStyle
or TemplateLabelStyle
.If the template
components don't need to interact
with the user, they can be hidden from auto detection by setting
mouseEnabled
and mouseChildren
on that component to
false
.
MOUSE_CHILDREN_NEVER | Constant |
public static const MOUSE_CHILDREN_NEVER:int = 0
Mouse events will never be propagated to child DisplayObjects
.
Constant for determining the enableMouseChildren
policy.
This setting reduces the CPU usage when the mouse hovers over the canvas.
Interactive objects like nodes using the TemplateNodeStyle
won't react to the mouse.
Note that the input modes won't be affected and will work as expected.
Use this setting if you use objects styled with TemplateStyle
but don't need them to react to the mouse. This setting is recommended
for, e.g., a print preview.
VIEWPORT_CHANGED | Constant |
public static const VIEWPORT_CHANGED:String = viewPortChanged
Kept for backward compatibility.
Use com.yworks.canvas.CanvasEvent.VIEW_PORT_CHANGED
instead.