| Package | com.yworks.canvas.geom |
| Class | public class YRectangle |
| Inheritance | YRectangle Object |
| Implements | IMovable, IMutableRectangle, IOrientedRectangle |
IMutablePoint
and IMutableSize.
This implementation delegates the storage to implementations of
IMutablePoint for the upper left corner of the rectangle
and IMutableSize for the size of the rectangle.
members. As a convenience it implements the IMovable and
IOrientedRectangle interfaces.
| Property | Defined By | ||
|---|---|---|---|
| anchorX : Number [read-only]
Implements the IOrientedRectangle and will return the
x coordinate of the position. | YRectangle | ||
| anchorY : Number [read-only]
Implements the IOrientedRectangle and will return the
y coordinate of the position plus the height. | YRectangle | ||
| height : Number
The height of this instance from the size instance. | YRectangle | ||
| position : IPoint
Returns the instance that stores the position of this rectangle. | YRectangle | ||
| size : ISize
Returns the instance that stores the size of this rectangle. | YRectangle | ||
| upX : Number [read-only]
always returns 0. | YRectangle | ||
| upY : Number [read-only]
always returns -1. | YRectangle | ||
| width : Number
The width of this instance from the size instance. | YRectangle | ||
| x : Number
Gets or sets the x coordinate of the upper left corner of this instance from the position
| YRectangle | ||
| y : Number
Gets or sets the y coordinate of the upper left corner of this instance from the position
| YRectangle | ||
| Method | Defined By | ||
|---|---|---|---|
YRectangle(x:Number = 0.0, y:Number = 0.0, width:Number = 0.0, height:Number = 0.0)
Creates a new instance using the provided values to initialize the position and size. | YRectangle | ||
create(x:Number = 0.0, y:Number = 0.0, width:Number = 0.0, height:Number = 0.0):YRectangle [static]
Creates a new instance using the provided values to initialize
the position and size. | YRectangle | ||
[static]
Creates a new instance using the provided instance to retrieve the initial values for
the position and size from. | YRectangle | ||
getCenterX(rectangle:IRectangle):Number [static]
Returns the x coordinate of the center of the given rectangle. | YRectangle | ||
getCenterY(rectangle:IRectangle):Number [static]
Returns the y coordinate of the center of the given rectangle. | YRectangle | ||
moveBy(dx:Number, dy:Number):Boolean
Moves this rectangle by applying the offsets to the position. | YRectangle | ||
moveByDx(dx:Number):Boolean
Moves this rectangle by applying the offset to the position. | YRectangle | ||
moveByDy(dy:Number):Boolean
Moves this rectangle by applying the offset to the position. | YRectangle | ||
reshape(x:Number, y:Number, width:Number, height:Number):void
Applies a new position and size in that order to the instances
that hold the state of this rectangle. | YRectangle | ||
setValues(rect:IRectangle):void
Reshapes this instance to the values provided by the given rectangle. | YRectangle | ||
toString():String
A String representation of this instance. | YRectangle | ||
| anchorX | property |
anchorX:Number [read-only]
Implements the IOrientedRectangle and will return the
x coordinate of the position.
public function get anchorX():Number| anchorY | property |
anchorY:Number [read-only]
Implements the IOrientedRectangle and will return the
y coordinate of the position plus the height.
public function get anchorY():Number| height | property |
height:Number
The height of this instance from the size instance.
public function get height():Number public function set height(value:Number):void| position | property |
position:IPointReturns the instance that stores the position of this rectangle.
This will return a live view of the position of this rectangle. However setting a position instance will only copy the values of the point provided to the current position.
public function get position():IPoint public function set position(value:IPoint):void| size | property |
size:ISizeReturns the instance that stores the size of this rectangle.
This will return a live view of the size of this rectangle. However setting a size instance will only copy the values of the size provided to the current size.
public function get size():ISize public function set size(value:ISize):void| upX | property |
upX:Number [read-only] always returns 0.
public function get upX():Number| upY | property |
upY:Number [read-only] always returns -1.
public function get upY():Number| width | property |
width:Number
The width of this instance from the size instance.
public function get width():Number public function set width(value:Number):void| x | property |
x:Number
Gets or sets the x coordinate of the upper left corner of this instance from the position
public function get x():Number public function set x(value:Number):void| y | property |
y:Number
Gets or sets the y coordinate of the upper left corner of this instance from the position
public function get y():Number public function set y(value:Number):void| YRectangle | () | Constructor |
public function YRectangle(x:Number = 0.0, y:Number = 0.0, width:Number = 0.0, height:Number = 0.0)Creates a new instance using the provided values to initialize the position and size.
An instance of YPoint will be used to store the position
and an instance of Size will be used to store the size.
x:Number (default = 0.0) — The x coordinate of the upper left corner of the rectangle.
| |
y:Number (default = 0.0) — The y coordinate of the upper left corner of the rectangle.
| |
width:Number (default = 0.0) — The width of the rectangle.
| |
height:Number (default = 0.0) — The height of the rectangle.
|
| create | () | method |
public static function create(x:Number = 0.0, y:Number = 0.0, width:Number = 0.0, height:Number = 0.0):YRectangleCreates a new instance using the provided values to initialize the position and size.
Parameters
x:Number (default = 0.0) — The x coordinate of the upper left corner of the rectangle.
| |
y:Number (default = 0.0) — The y coordinate of the upper left corner of the rectangle.
| |
width:Number (default = 0.0) — The width of the rectangle.
| |
height:Number (default = 0.0) — The height of the rectangle.
|
YRectangle — a new YRectangle instance with the provided values
|
| createFrom | () | method |
public static function createFrom(rect:IRectangle):YRectangleCreates a new instance using the provided instance to retrieve the initial values for the position and size from.
Parameters
rect:IRectangle — The rectangle to retrieve the initial size from.
|
YRectangle — A new YRectangle with the provided values
|
| getCenterX | () | method |
public static function getCenterX(rectangle:IRectangle):NumberReturns the x coordinate of the center of the given rectangle.
Parameters
rectangle:IRectangle — The given rectangle
|
Number — The x coordinate of the rectangle's center
|
| getCenterY | () | method |
public static function getCenterY(rectangle:IRectangle):NumberReturns the y coordinate of the center of the given rectangle.
Parameters
rectangle:IRectangle — The given rectangle
|
Number — The y coordinate of the rectangle's center
|
| moveBy | () | method |
public function moveBy(dx:Number, dy:Number):Boolean
Moves this rectangle by applying the offsets to the position.
Parameters
dx:Number — The offset to move the rectangle's position by.
| |
dy:Number — The offset to move the rectangle's position by.
|
Boolean — true if dx != 0 || dy != 0
|
| moveByDx | () | method |
public function moveByDx(dx:Number):Boolean
Moves this rectangle by applying the offset to the position.
Parameters
dx:Number — The offset to move the rectangle's position by.
|
Boolean — true if dx != 0
|
| moveByDy | () | method |
public function moveByDy(dy:Number):Boolean
Moves this rectangle by applying the offset to the position.
Parameters
dy:Number — The offset to move the rectangle's position by.
|
Boolean — true if dy != 0
|
| reshape | () | method |
public function reshape(x:Number, y:Number, width:Number, height:Number):voidApplies a new position and size in that order to the instances that hold the state of this rectangle.
Parameters
x:Number — The new x coordinate of the upper left corner of the rectangle.
| |
y:Number — The new y coordinate of the upper left corner of the rectangle.
| |
width:Number — The new width of the rectangle.
| |
height:Number — The new height of the rectangle.
|
| setValues | () | method |
public function setValues(rect:IRectangle):voidReshapes this instance to the values provided by the given rectangle.
Parameters
rect:IRectangle — The rectangle to copy the state from.
|
See also
| toString | () | method |
public function toString():StringA String representation of this instance.
ReturnsString — A String representation of this instance.
|