Packagecom.yworks.canvas.geom
Classpublic class YPoint
InheritanceYPoint Inheritance Object
Implements IMutablePoint, IMovable

A simple default implementation of a mutable point in 2D coordinate space.



Public Properties
 PropertyDefined By
  x : Number
The x coordinate.
YPoint
  y : Number
The y coordinate.
YPoint
Public Methods
 MethodDefined By
  
YPoint(x:Number, y:Number)
Creates an instance using the given coordinate pair.
YPoint
  
create(px:Number = 0, py:Number = 0):YPoint
[static] Creates an instance using the given coordinate pair.
YPoint
  
[static] Creates a dynamic IMutablePoint implementation that delegates to the given instances.
YPoint
  
[static] Creates an instance using the coordinates of the given point.
YPoint
  
moveBy(dx:Number, dy:Number):Boolean
Moves this instance by adding the provided offsets to the coordinates of this point.
YPoint
  
moveByDx(dx:Number):Boolean
Moves this instance by adding the provided offset to the x coordinate of this point.
YPoint
  
moveByDy(dy:Number):Boolean
Moves this instance by adding the provided offset to the y coordinate of this point.
YPoint
  
setTo(point:IPoint):void
Sets the coordinates of this instance to the current state of the coordinates of the point provided.
YPoint
Property Detail
xproperty
x:Number

The x coordinate.


Implementation
    public function get x():Number
    public function set x(value:Number):void
yproperty 
y:Number

The y coordinate.


Implementation
    public function get y():Number
    public function set y(value:Number):void
Constructor Detail
YPoint()Constructor
public function YPoint(x:Number, y:Number)

Creates an instance using the given coordinate pair.

Parameters
x:Number — The x-coordinate.
 
y:Number — The y-coordinate.
Method Detail
create()method
public static function create(px:Number = 0, py:Number = 0):YPoint

Creates an instance using the given coordinate pair.

Parameters

px:Number (default = 0) — The x-coordinate.
 
py:Number (default = 0) — The y-coordinate.

Returns
YPoint — An instance of the YPoint class.
createDynamic()method 
public static function createDynamic(getter:IPoint, setter:IPointSetter):IMutablePoint

Creates a dynamic IMutablePoint implementation that delegates to the given instances.

Note that the implementation implements IMutablePoint only. It cannot be cast to YPoint.

Parameters

getter:IPoint — The instance used to read the state of the point.
 
setter:IPointSetter — The instance used to write the state of the point.

Returns
IMutablePoint — An instance that provides a live view of the two given instances.
createFrom()method 
public static function createFrom(point:IPoint):YPoint

Creates an instance using the coordinates of the given point.

Parameters

point:IPoint — The point which's coordinates shall be used.

Returns
YPoint — An instance of the YPoint class
moveBy()method 
public function moveBy(dx:Number, dy:Number):Boolean

Moves this instance by adding the provided offsets to the coordinates of this point.

Parameters

dx:Number — The offset to add to this point's x coordinate
 
dy:Number — The offset to add to this point's y coordinate

Returns
Booleantrue if dx != 0 || dy != 0
moveByDx()method 
public function moveByDx(dx:Number):Boolean

Moves this instance by adding the provided offset to the x coordinate of this point.

Parameters

dx:Number

Returns
Booleantrue if dx != 0.
moveByDy()method 
public function moveByDy(dy:Number):Boolean

Moves this instance by adding the provided offset to the y coordinate of this point.

Parameters

dy:Number

Returns
Booleantrue if dy != 0.
setTo()method 
public function setTo(point:IPoint):void

Sets the coordinates of this instance to the current state of the coordinates of the point provided.

Parameters

point:IPoint — The point to obtain the values from.