Package | com.yworks.canvas.geom |
Class | public class AnchoredPoint |
Inheritance | AnchoredPoint Object |
Implements | IMutablePoint |
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.
Property | Defined 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 |
Method | Defined By | ||
---|---|---|---|
Constructor. | AnchoredPoint | ||
[static]
Creates an implementation that is anchored to the center of the given rectangle at all times. | AnchoredPoint | ||
[static]
Creates an implementation that is anchored to the center of the given rectangle at all times. | AnchoredPoint |
anchor | property |
anchor:IPoint
[read-only] The point this instance is anchored to.
public function get anchor():IPoint
offset | property |
offset:YPoint
[read-only] The mutable offset this instance uses to calculate its position.
public function get offset():YPoint
x | property |
x:Number
Gets the current x coordinate of this point.
Depending on context the values returned may change over time.
public function get x():Number
public function set x(value:Number):void
y | property |
y:Number
Gets the current y coordinate of this point.
Depending on context the values returned may change over time.
public function get y():Number
public function set y(value:Number):void
AnchoredPoint | () | Constructor |
public function AnchoredPoint(anchor:IPoint, offset:YPoint)
Constructor.
Creates an implementation using the given anchor and offset.
Parametersanchor:IPoint — The anchor.
| |
offset:YPoint — The offset.
|
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.
|
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.
|
IMutablePoint — the created IMutablePoint implementation
|
See also