Packagecom.yworks.graph.input.snapLines
Classpublic class NodeSnapResultProvider
InheritanceNodeSnapResultProvider Inheritance Object
Implements INodeSnapResultProvider

The default implementation of the INodeSnapResultProvider interface.



Public Methods
 MethodDefined By
  
Called when a node is dragged to add SnapResults for SnapLines to which this node can potentially snap.
NodeSnapResultProvider
Protected Methods
 MethodDefined By
  
addGridSnapResult(context:GraphSnapContext, evt:CollectSnapResultEvent, pointInSuggestedLayout:IPoint, node:INode):void
Calculates a SnapResult and adds it to the argument.
NodeSnapResultProvider
  
Collects snap results that snap the node to a grid and adds them to the argument.
NodeSnapResultProvider
  
Verifies whether the node will snap to the given snap line.
NodeSnapResultProvider
  
Collects the results for the given layout for all snap lines in question.
NodeSnapResultProvider
Public Constants
 ConstantDefined By
  instance : INodeSnapResultProvider
[static] Yields the static shared instance of this class.
NodeSnapResultProvider
Method Detail
addGridSnapResult()method
protected function addGridSnapResult(context:GraphSnapContext, evt:CollectSnapResultEvent, pointInSuggestedLayout:IPoint, node:INode):void

Calculates a SnapResult and adds it to the argument. This method snaps the pointInSuggestedLayout to the next grid point or grid lines that are determined by GraphSnapContext.nodeGridConstraintProvider or obtained from the evt.context.

Parameters

context:GraphSnapContext — The context in which the snapping is performed.
 
evt:CollectSnapResultEvent — The event to add the results to.
 
pointInSuggestedLayout:IPoint — A location in the layout of the suggested layout of the node that will be snapped to a grid point location.
 
node:INode — The node that is currently being processed.

See also

collectGridSnapResults()method 
protected function collectGridSnapResults(context:GraphSnapContext, evt:CollectSnapResultEvent, suggestedLayout:IRectangle, node:INode):void

Collects snap results that snap the node to a grid and adds them to the argument. This implementation simply delegates to addGridSnapResult using the center of the suggestedLayout.

Parameters

context:GraphSnapContext — The context in which the snapping is performed.
 
evt:CollectSnapResultEvent — The event to add the results to.
 
suggestedLayout:IRectangle — The layout of the node if it would move without snapping.
 
node:INode — The node that is currently being processed.

See also

collectSingleLineSnapResults()method 
protected function collectSingleLineSnapResults(evt:CollectSnapResultEvent, snapLine:SnapLine, suggestedLayout:IRectangle, node:INode):void

Verifies whether the node will snap to the given snap line. If the node will snap, a SnapLineSnapResult will be created and added to the event.

Parameters

evt:CollectSnapResultEvent — The event to add the results to.
 
snapLine:SnapLine — The snap line to test snapping for.
 
suggestedLayout:IRectangle — The layout of the node if it would move without snapping.
 
node:INode — The node that is currently being processed.

See also

collectSnapLineSnapResults()method 
protected function collectSnapLineSnapResults(context:GraphSnapContext, evt:CollectSnapResultEvent, suggestedLayout:IRectangle, node:INode):void

Collects the results for the given layout for all snap lines in question. For each snap line that could be snapped to, this method calls collectSingleLineSnapResults.

Parameters

context:GraphSnapContext — The context for which the results are being queried.
 
evt:CollectSnapResultEvent — The event to which the results should be added.
 
suggestedLayout:IRectangle — The suggested layout of the node.
 
node:INode — The node that is being dragged.

See also

collectSnapResults()method 
public function collectSnapResults(context:GraphSnapContext, evt:CollectSnapResultEvent, suggestedLayout:IRectangle, node:INode):void

Called when a node is dragged to add SnapResults for SnapLines to which this node can potentially snap.

Parameters

context:GraphSnapContext — The snap context which manages the snap lines and the settings.
 
evt:CollectSnapResultEvent — The event argument to obtain the necessary information from and add results to.
 
suggestedLayout:IRectangle — The layout of the node if the node would not snap.
 
node:INode — The node that is being moved.

Constant Detail
instanceConstant
public static const instance:INodeSnapResultProvider

Yields the static shared instance of this class.