Packagecom.yworks.canvas.input.snapLines
Classpublic class SnapLine
InheritanceSnapLine Inheritance Object
Subclasses NodeBasedSnapLine, NodePairBasedSnapLine, PointBasedSnapLine

Models a snap line that is a line segment in the world coordinate system that is parallel to the x or y axis and to which other items (lines or points) snap to during interactive movements. GraphSnapContext makes use of this class to interactively snap moving elements to snap lines.

See also

GraphSnapContext


Public Properties
 PropertyDefined By
  coordinates : IPoint
[read-only] The coordinates of the center point of the snap line.
SnapLine
  from : Number
The smaller value of the coordinate that delimits this snap line.
SnapLine
  orientation : SnapLineOrientation
[read-only] The orientation of the snap line as defined in SnapLineOrientation.
SnapLine
  resourceKey : ResourceKey
[read-only] The resource key which determines the visual appearance of the snap line.
SnapLine
  snapType : uint
[read-only] The type of the line that describes how other items will snap to this line.
SnapLine
  tag : Object
[read-only] The tag that is associated with this snap line.
SnapLine
  to : Number
The greater value of the coordinate that delimits this snap line.
SnapLine
  weight : Number
[read-only] The weight/importance of this snap line.
SnapLine
Public Methods
 MethodDefined By
  
SnapLine(orientation:SnapLineOrientation, snapType:uint, resourceKey:ResourceKey, coordinates:IPoint, tag:Object, weight:Number, from:Number, to:Number)
Creates a new snap line using the provided attributes.
SnapLine
Public Constants
 ConstantDefined By
  SNAP_LINE_BLANK_VARIABLE_LINE_KEY : ResourceKey
[static] Determines a blank line between the SnapLine.coordinates and the SnapLineSnapResult.snappedCoordinates
SnapLine
  SNAP_LINE_CENTER_BETWEEN_BOUNDS_KEY : ResourceKey
[static] Determines a snap line which lets an item snap in the center between two bounds of other items.
SnapLine
  SNAP_LINE_CENTER_BETWEEN_CENTERS_KEY : ResourceKey
[static] Determines a snap line which lets an item snap in the center between two centers of other items.
SnapLine
  SNAP_LINE_EQUAL_DISTANCE_BETWEEN_BOUNDS_KEY : ResourceKey
[static] Determines a snap line which lets an item snap if it has an equal distance to two other items.
SnapLine
  SNAP_LINE_EQUAL_DISTANCE_BETWEEN_CENTERS_KEY : ResourceKey
[static] Determines a snap line which lets an item snap if it's center has an equal distance to the centers' of two other items.
SnapLine
  SNAP_LINE_EQUAL_HEIGHT_KEY : ResourceKey
[static] Determines the snapping of a resized item if it's new height is equal to another item.
SnapLine
  SNAP_LINE_EQUAL_WIDTH_KEY : ResourceKey
[static] Determines the snapping of a resized item if it's new width is equal to another item.
SnapLine
  SNAP_LINE_EXTENDED_VARIABLE_LINE_KEY : ResourceKey
[static] Determines a decorated line between the SnapLine.coordinates and the SnapLineSnapResult.snappedCoordinates that is extended on both sides.
SnapLine
  SNAP_LINE_FIXED_DISTANCE_KEY : ResourceKey
[static] Determines a snap line which snaps to a distance between different graph items.
SnapLine
  SNAP_LINE_FIXED_LINE_KEY : ResourceKey
[static] Determines a snap line having a fixed visualization independent of the SnapLineSnapResult.
SnapLine
  SNAP_LINE_VARIABLE_LINE_KEY : ResourceKey
[static] Determines a decorated line between the SnapLine.coordinates and the SnapLineSnapResult.snappedCoordinates
SnapLine
  SNAP_TO_GRID_KEY : ResourceKey
[static]
SnapLine
Property Detail
coordinatesproperty
coordinates:IPoint  [read-only]

The coordinates of the center point of the snap line.


Implementation
    public function get coordinates():IPoint
fromproperty 
from:Number

The smaller value of the coordinate that delimits this snap line. This is the x coordinate in case of a horizontally oriented snap line, otherwise the y coordinate.


Implementation
    public function get from():Number
    public function set from(value:Number):void

See also

orientationproperty 
orientation:SnapLineOrientation  [read-only]

The orientation of the snap line as defined in SnapLineOrientation.


Implementation
    public function get orientation():SnapLineOrientation

See also

resourceKeyproperty 
resourceKey:ResourceKey  [read-only]

The resource key which determines the visual appearance of the snap line.


Implementation
    public function get resourceKey():ResourceKey
snapTypeproperty 
snapType:uint  [read-only]

The type of the line that describes how other items will snap to this line. This is one of SnapLineSnapType.TOP, SnapLineSnapType.BOTTOM, SnapLineSnapType.LEFT, SnapLineSnapType.RIGHT, or SnapLineSnapType.CENTER.


Implementation
    public function get snapType():uint

See also

tagproperty 
tag:Object  [read-only]

The tag that is associated with this snap line. The tag is most commonly used for the snap result tag.


Implementation
    public function get tag():Object

See also

toproperty 
to:Number

The greater value of the coordinate that delimits this snap line. This is the x coordinate in case of a horizontally oriented snap line, otherwise the y coordinate.


Implementation
    public function get to():Number
    public function set to(value:Number):void

See also

weightproperty 
weight:Number  [read-only]

The weight/importance of this snap line. Greater values indicate greater importance.


Implementation
    public function get weight():Number
Constructor Detail
SnapLine()Constructor
public function SnapLine(orientation:SnapLineOrientation, snapType:uint, resourceKey:ResourceKey, coordinates:IPoint, tag:Object, weight:Number, from:Number, to:Number)

Creates a new snap line using the provided attributes.

Parameters
orientation:SnapLineOrientation — The orientation of the snap line. This is one of SnapLineOrientation.Horizontal or SnapLineOrientation.Vertical.
 
snapType:uint — The type of the line that describes how other items will snap to this line. This is one of SnapLineSnapType.TOP, SnapLineSnapType.BOTTOM, SnapLineSnapType.LEFT, SnapLineSnapType.RIGHT or SnapLineSnapType.CENTER.
 
resourceKey:ResourceKey — A resource key which determines the visual representation of this snap line.
 
coordinates:IPoint — The coordinates of the center point of the snap line.
 
tag:Object — A tag that is associated with this snap line
 
weight:Number — The weight (importance) of this snap line. If more than one snap line is snapped to, the one with the greater weight will be used.
 
from:Number (default = NaN) — The smaller value of the coordinate that delimits this snap line.
 
to:Number (default = NaN) — The greater value of the coordinate that delimits this snap line.

See also

Constant Detail
SNAP_LINE_BLANK_VARIABLE_LINE_KEYConstant
public static const SNAP_LINE_BLANK_VARIABLE_LINE_KEY:ResourceKey

Determines a blank line between the SnapLine.coordinates and the SnapLineSnapResult.snappedCoordinates

See also

SNAP_LINE_CENTER_BETWEEN_BOUNDS_KEYConstant 
public static const SNAP_LINE_CENTER_BETWEEN_BOUNDS_KEY:ResourceKey

Determines a snap line which lets an item snap in the center between two bounds of other items.

SNAP_LINE_CENTER_BETWEEN_CENTERS_KEYConstant 
public static const SNAP_LINE_CENTER_BETWEEN_CENTERS_KEY:ResourceKey

Determines a snap line which lets an item snap in the center between two centers of other items.

SNAP_LINE_EQUAL_DISTANCE_BETWEEN_BOUNDS_KEYConstant 
public static const SNAP_LINE_EQUAL_DISTANCE_BETWEEN_BOUNDS_KEY:ResourceKey

Determines a snap line which lets an item snap if it has an equal distance to two other items.

SNAP_LINE_EQUAL_DISTANCE_BETWEEN_CENTERS_KEYConstant 
public static const SNAP_LINE_EQUAL_DISTANCE_BETWEEN_CENTERS_KEY:ResourceKey

Determines a snap line which lets an item snap if it's center has an equal distance to the centers' of two other items.

SNAP_LINE_EQUAL_HEIGHT_KEYConstant 
public static const SNAP_LINE_EQUAL_HEIGHT_KEY:ResourceKey

Determines the snapping of a resized item if it's new height is equal to another item.

SNAP_LINE_EQUAL_WIDTH_KEYConstant 
public static const SNAP_LINE_EQUAL_WIDTH_KEY:ResourceKey

Determines the snapping of a resized item if it's new width is equal to another item.

SNAP_LINE_EXTENDED_VARIABLE_LINE_KEYConstant 
public static const SNAP_LINE_EXTENDED_VARIABLE_LINE_KEY:ResourceKey

Determines a decorated line between the SnapLine.coordinates and the SnapLineSnapResult.snappedCoordinates that is extended on both sides.

See also

SNAP_LINE_FIXED_DISTANCE_KEYConstant 
public static const SNAP_LINE_FIXED_DISTANCE_KEY:ResourceKey

Determines a snap line which snaps to a distance between different graph items.

SNAP_LINE_FIXED_LINE_KEYConstant 
public static const SNAP_LINE_FIXED_LINE_KEY:ResourceKey

Determines a snap line having a fixed visualization independent of the SnapLineSnapResult.

See also

SnapLineSnapResult
SNAP_LINE_VARIABLE_LINE_KEYConstant 
public static const SNAP_LINE_VARIABLE_LINE_KEY:ResourceKey

Determines a decorated line between the SnapLine.coordinates and the SnapLineSnapResult.snappedCoordinates

See also

SNAP_TO_GRID_KEYConstant 
public static const SNAP_TO_GRID_KEY:ResourceKey