Packagecom.yworks.canvas.input
Classpublic class SimpleGridConstraintProvider
InheritanceSimpleGridConstraintProvider Inheritance Object
Implements INodeGridConstraintProvider, IBendGridConstraintProvider, IPortGridConstraintProvider

A simple integer based implementation of IGridConstraintProvider.



Public Properties
 PropertyDefined By
  gridInfo : GridInfo
Gets the grid info containing the canonic grid origin as well as the grid's horizontal and vertical spacing.
SimpleGridConstraintProvider
Public Methods
 MethodDefined By
  
Creates a new instance using the given grid info.
SimpleGridConstraintProvider
  
snapToGrid(context:IInputModeContext, item:Object, point:IPoint):IPoint
Performs the actual snapping to grid coordinates.
SimpleGridConstraintProvider
Property Detail
gridInfoproperty
gridInfo:GridInfo

Gets the grid info containing the canonic grid origin as well as the grid's horizontal and vertical spacing.


Implementation
    public function get gridInfo():GridInfo
    public function set gridInfo(value:GridInfo):void
Constructor Detail
SimpleGridConstraintProvider()Constructor
public function SimpleGridConstraintProvider(gridInfo:GridInfo)

Creates a new instance using the given grid info.

Parameters
gridInfo:GridInfo — The info describing the grid's origin as well as it's horizontal and vertical spacing.
Method Detail
snapToGrid()method
public function snapToGrid(context:IInputModeContext, item:Object, point:IPoint):IPoint

Performs the actual snapping to grid coordinates.

Parameters

context:IInputModeContext — The context in which the snapping should occur.
 
item:Object — The item of which the coordinates should be snapped.
 
point:IPoint — The coordinates to snap.

Returns
IPoint — The closest grid point the given point can snap to.