Package | com.yworks.graph.drawing |
Class | public class ArrowPaintable |
Inheritance | ArrowPaintable Object |
Implements | IDisplayObjectCreator, IBoundsProvider |
IDisplayObjectCreator
implementation returning a DisplayObject
that renders arrowheads
and provides bounds for the drawing engine.
Property | Defined By | ||
---|---|---|---|
anchor : IPoint [read-only]
The point the arrow is anchored to by reference. | ArrowPaintable | ||
arrowType : uint [read-only]
Returns the type of the arrow as defined in ArrowType. | ArrowPaintable | ||
direction : IPoint [read-only]
An IPoint which determines the direction of the arrow. | ArrowPaintable | ||
fill : IFill
The IFill the arrow is filled with. | ArrowPaintable | ||
length : Number [read-only]
The length of the arrow. | ArrowPaintable | ||
scale : Number
Defines the scale, the arrow is painted with. | ArrowPaintable | ||
stroke : IStroke
The IStroke the arrow's outline is drawn with. | ArrowPaintable |
Method | Defined By | ||
---|---|---|---|
Don't call the constructor directly - use the create factory method. | ArrowPaintable | ||
Returns a tight rectangular area where the whole rendering
would fit into. | ArrowPaintable | ||
[static]
Factory method which will create an arrow of the given type and dimensions. | ArrowPaintable | ||
createDisplayObject(context:IDisplayObjectContext):DisplayObject
Creates a new DisplayObject which represents the styled model item. | ArrowPaintable | ||
Transforms the given YGraphics matrix so that the arrow is pointing right and the arrow
tip is at (0, 0). | ArrowPaintable | ||
updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject
Updates the given DisplayObject. | ArrowPaintable |
Method | Defined By | ||
---|---|---|---|
paintArrow(g:YGraphics):void
Paints the arrow in the given YGraphics object, assuming that the arrow is pointing to the right
and the arrow tip is at (0, 0). | ArrowPaintable |
anchor | property |
anchor:IPoint
[read-only] The point the arrow is anchored to by reference.
public function get anchor():IPoint
arrowType | property |
arrowType:uint
[read-only]
Returns the type of the arrow as defined in ArrowType
.
Has to be overridden by subclass implementations.
public function get arrowType():uint
See also
direction | property |
direction:IPoint
[read-only]
An IPoint
which determines the direction of the arrow.
public function get direction():IPoint
fill | property |
fill:IFill
The IFill
the arrow is filled with.
public function get fill():IFill
public function set fill(value:IFill):void
length | property |
length:Number
[read-only] The length of the arrow.
public function get length():Number
scale | property |
scale:Number
Defines the scale, the arrow is painted with.
public function get scale():Number
public function set scale(value:Number):void
stroke | property |
stroke:IStroke
The IStroke
the arrow's outline is drawn with.
public function get stroke():IStroke
public function set stroke(value:IStroke):void
ArrowPaintable | () | Constructor |
public function ArrowPaintable(anchor:IPoint, direction:IPoint, length:Number)
Don't call the constructor directly - use the create
factory method.
anchor:IPoint | |
direction:IPoint | |
length:Number |
calculateBounds | () | method |
public function calculateBounds(scratch:IMutableRectangle, ctx:ICanvasContext):IRectangle
Returns a tight rectangular area where the whole rendering would fit into.
Implementations can use the scratch
rectangle to put their
results in and return it as the result of the operation.
Client has to always provide a non-null
instance as
a parameter. They may however decide to return an internally
cached or dynamically created IRectangle
implementation and
disregard the scratch parameter.
If calculating the bounds is too expensive or the painting is not
bound to a certain area, this method may return null
.
If nothing is painted, this method should return an empty rectangle, where
either or both the width and height is non-positive or
ImmutableRectangle.Empty
.
Parameters
scratch:IMutableRectangle — An instance that can optionally be used to fill with the
corresponding values and be returned
| |
ctx:ICanvasContext — The context to calculate the bounds for (currently not used)
|
IRectangle — The bounds or null to indicate an unbound area
|
create | () | method |
public static function create(type:uint, anchor:IPoint, direction:IPoint, stroke:IStroke, fill:IFill):ArrowPaintable
Factory method which will create an arrow of the given type and dimensions.
Parameters
type:uint — Type of the arrow as defined in ArrowType
| |
anchor:IPoint — The point the arrow is anchored to by reference.
| |
direction:IPoint — The direction of the arrow by reference.
| |
stroke:IStroke — The stroke the arrow is painted with.
| |
fill:IFill — The fill the arrow is filled with.
|
ArrowPaintable — An ArrowPaintable specified by the above parameters.
|
See also
createDisplayObject | () | method |
public function createDisplayObject(context:IDisplayObjectContext):DisplayObject
Creates a new DisplayObject
which represents the styled model item.
This implementation creates a new YDisplayObject
and calls paint
using the
objects YDisplayObject
.
Parameters
context:IDisplayObjectContext |
DisplayObject |
See also
paint | () | method |
public function paint(g:YGraphics, ctx:IPaintContext):void
Transforms the given YGraphics
matrix so that the arrow is pointing right and the arrow
tip is at (0, 0).
The actual rendering of the arrow is delegated to paintArrow()
.
This method is called by createDisplayObject
using the YGraphics
of the newly created
YDisplayObject
.
Parameters
g:YGraphics — The graphics context to paint into.
| |
ctx:IPaintContext — The paint context.
|
See also
paintArrow | () | method |
protected function paintArrow(g:YGraphics):void
Paints the arrow in the given YGraphics
object, assuming that the arrow is pointing to the right
and the arrow tip is at (0, 0).
This method is called by paint
Subclasses have to override this method
Parameters
g:YGraphics — The graphics context to paint into.
|
updateDisplayObject | () | method |
public function updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject
Updates the given DisplayObject
.
Parameters
oldDisplayObject:DisplayObject | |
context:IDisplayObjectContext |
DisplayObject |
See also