Packagecom.yworks.canvas.geom
Classpublic class AnchoredPoint
InheritanceAnchoredPoint Inheritance Object
Implements IMutablePoint

Provides implementations of the YPoint interface that are dynamically updated depending on the state of another geometric primitive they are being anchored to.

Implementations implement the YPoint interface by modifying their internally held offset to the point they are being anchored to. Changing the properties of instances of this type will not change the state of the point they are being anchored at.



Public Properties
 PropertyDefined By
  anchor : IPoint
[read-only] The point this instance is anchored to.
AnchoredPoint
  offset : YPoint
[read-only] The mutable offset this instance uses to calculate its position.
AnchoredPoint
  x : Number
Gets the current x coordinate of this point.
AnchoredPoint
  y : Number
Gets the current y coordinate of this point.
AnchoredPoint
Public Methods
 MethodDefined By
  
AnchoredPoint(anchor:IPoint, offset:YPoint)
Constructor.
AnchoredPoint
  
createCenterOffset(rect:IRectangle, xOffset:Number, yOffset:Number):AnchoredPoint
[static] Creates an implementation that is anchored to the center of the given rectangle at all times.
AnchoredPoint
  
createCenterOffsetScaled(rect:IRectangle, xOffset:Number, yOffset:Number):IMutablePoint
[static] Creates an implementation that is anchored to the center of the given rectangle at all times.
AnchoredPoint
Property Detail
anchorproperty
anchor:IPoint  [read-only]

The point this instance is anchored to.


Implementation
    public function get anchor():IPoint
offsetproperty 
offset:YPoint  [read-only]

The mutable offset this instance uses to calculate its position.


Implementation
    public function get offset():YPoint
xproperty 
x:Number

Gets the current x coordinate of this point.

Depending on context the values returned may change over time.


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

Gets the current y coordinate of this point.

Depending on context the values returned may change over time.


Implementation
    public function get y():Number
    public function set y(value:Number):void
Constructor Detail
AnchoredPoint()Constructor
public function AnchoredPoint(anchor:IPoint, offset:YPoint)

Constructor.

Creates an implementation using the given anchor and offset.

Parameters
anchor:IPoint — The anchor.
 
offset:YPoint — The offset.
Method Detail
createCenterOffset()method
public static function createCenterOffset(rect:IRectangle, xOffset:Number, yOffset:Number):AnchoredPoint

Creates an implementation that is anchored to the center of the given rectangle at all times.

Changing the state of the rectangle provided will thus indirectly change the state of the instance returned.

Parameters

rect:IRectangle — The rectangle that will be dynamically queried to obtain the center from.
 
xOffset:Number — The initial x offset to the center of the rectangle.
 
yOffset:Number — The initial y offset to the center of the rectangle.

Returns
AnchoredPoint — the created instance
createCenterOffsetScaled()method 
public static function createCenterOffsetScaled(rect:IRectangle, xOffset:Number, yOffset:Number):IMutablePoint

Creates an implementation that is anchored to the center of the given rectangle at all times.

The actual offset to the center of the rectangle depends on the size of the rectangle. An xRatio of 0.5 will result in a point being anchored to the right border of the rectangle, whereas a ratio of 0.0 will anchor the point to the center of the rectangle. Modifying the state of instance returned will modify the ratios, not the rectangle.

Parameters

rect:IRectangle — The rectangle that will be dynamically queried to obtain the center and size from..
 
xOffset:Number — The initial x offset to the width ratio.
 
yOffset:Number — The initial y offset to the height ratio.

Returns
IMutablePoint — the created IMutablePoint implementation

See also