Package | com.yworks.canvas.drawing |
Class | public class GridSnapResultPaintable |
Inheritance | GridSnapResultPaintable Object |
Implements | IDisplayObjectCreator |
snappedGridPoint
as well as at all eight grid points around it using
horizontalSpacing
and verticalSpacing
of the gridInfo
to determine their position.
If the spacing in view coordinates between the snappedGridPoint
and any of these grid points is
smaller then the minimumSpacing
, a grid point further away from the snappedGridPoint
is used instead to fulfill the minimumSpacing
.
This way the snap result visualization adapts to the current zoom level but does place it's painted points only
on grid coordinates.
See also
Property | Defined By | ||
---|---|---|---|
gridInfo : GridInfo
The grid info containing the horizontal and vertical grid spacing. | GridSnapResultPaintable | ||
minimumSpacing : Number
The minimum spacing of the painted grid points around the snappedGridPoint in view coordinates . | GridSnapResultPaintable | ||
snappedGridPoint : IPoint
The grid point the moved object has snapped to. | GridSnapResultPaintable | ||
stroke : IStroke
The stroke used in the paint method. | GridSnapResultPaintable |
Method | Defined By | ||
---|---|---|---|
createDisplayObject(context:IDisplayObjectContext):DisplayObject
Creates a new DisplayObject from scratch. | GridSnapResultPaintable | ||
Paints '+' symbols at the snappedGridPoint as well as at all eight grid points around it using
horizontalGridWidth and verticalGridWidth to determine their position. | GridSnapResultPaintable | ||
Paints a '+' symbol at the given x and y coordinates stretching size
long to each side. | GridSnapResultPaintable | ||
updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject
Updates the given DisplayObject or creates a new one. | GridSnapResultPaintable |
gridInfo | property |
gridInfo:GridInfo
The grid info containing the horizontal and vertical grid spacing.
public function get gridInfo():GridInfo
public function set gridInfo(value:GridInfo):void
minimumSpacing | property |
minimumSpacing:Number
The minimum spacing of the painted grid points around the snappedGridPoint
in view coordinates .
The default value is 40
.
public function get minimumSpacing():Number
public function set minimumSpacing(value:Number):void
See also
snappedGridPoint | property |
snappedGridPoint:IPoint
The grid point the moved object has snapped to.
public function get snappedGridPoint():IPoint
public function set snappedGridPoint(value:IPoint):void
stroke | property |
stroke:IStroke
The stroke used in the paint
method.
public function get stroke():IStroke
public function set stroke(value:IStroke):void
See also
createDisplayObject | () | method |
public function createDisplayObject(context:IDisplayObjectContext):DisplayObject
Creates a new DisplayObject
from scratch.
Parameters
context:IDisplayObjectContext — The context for which the display object is created.
|
DisplayObject — A DisplayObject .
|
paint | () | method |
public function paint(g:YGraphics, ctx:IPaintContext):void
Paints '+' symbols at the snappedGridPoint
as well as at all eight grid points around it using
horizontalGridWidth
and verticalGridWidth
to determine their position.
It delegates to paintGridPoint
to paint each of these grid points.
Parameters
g:YGraphics — The graphics object to paint upon.
| |
ctx:IPaintContext — The paint context.
|
See also
paintGridPoint | () | method |
public function paintGridPoint(g:YGraphics, ctx:IPaintContext, x:Number, y:Number, size:Number = 4):void
Paints a '+' symbol at the given x
and y
coordinates stretching size
long to each side.
Parameters
g:YGraphics — The graphics object to paint upon.
| |
ctx:IPaintContext — The paint context.
| |
x:Number — The horizontal position of the center of the plus sign.
| |
y:Number — The vertical position of the center of the plus sign.
| |
size:Number (default = 4 ) — The size the plus sign stretches to each side.
|
updateDisplayObject | () | method |
public function updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject
Updates the given DisplayObject
or creates a new one.
Implementors can decide whether they update the given display object or create a new one. Updating can mean re-rendering or updating size and/or coordinates.
Parameters
oldDisplayObject:DisplayObject — The display object to update.
| |
context:IDisplayObjectContext — The context for which the display object should be updated.
|
DisplayObject — The updated display object or a completely new display object.
|