Package | com.yworks.canvas.input |
Class | public class ReshapeableHandle |
Inheritance | ReshapeableHandle Object |
Implements | IMutablePoint, IMovable, IHandle |
IHandle
implementation that modifies a rectangle.
Implementations of this class work on a mutable rectangle instance for handling drags of the handle.
A separate point implementation is used for specifying the position of the handle.
As a convenience this class also implements the IMutablePoint
and
IMovable
interface which both modify the handle's position.
Property | Defined By | ||
---|---|---|---|
cursor : Cursor
Gets or sets the cursor to display when the mouse hovers over or drags this
handle. | ReshapeableHandle | ||
maximumSize : ISize
Gets or sets the maximum size allowed for the reshapeable. | ReshapeableHandle | ||
minimumEnclosedArea : IRectangle
Gets or sets the minimum rectangular area that needs to be contained in the reshapeable. | ReshapeableHandle | ||
minimumSize : ISize
Gets or sets the minimum size allowed for the reshapeable. | ReshapeableHandle | ||
type : uint
Gets or sets the type of the handle that can be used by the rendering engine
to render types differently. | ReshapeableHandle | ||
x : Number
Gets or sets the x coordinate. | ReshapeableHandle | ||
y : Number
Gets or sets the y coordinate. | ReshapeableHandle |
Property | Defined By | ||
---|---|---|---|
index : uint [read-only]
The position of the handle. | ReshapeableHandle | ||
location : IPoint [read-only]
The reference for the location of the handle. | ReshapeableHandle | ||
rect : IRectangle [read-only]
The rectangle instance to modify. | ReshapeableHandle | ||
reshapeable : IReshapeable [read-only]
The reshapeable instance to write the changes to. | ReshapeableHandle |
Method | Defined By | ||
---|---|---|---|
ReshapeableHandle(index:uint, location:IPoint, rect:IRectangle, reshapeable:IReshapeable, minimumSize:ISize, maximumSize:ISize)
Constructor for subclasses that creates a handle for the given position using the location instance
as the location for the handle. | ReshapeableHandle | ||
cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void
Delegates the original position to setPosition
| ReshapeableHandle | ||
create(position:uint, location:IPoint, rect:IRectangle, reshapeable:IReshapeable, minimumSize:ISize = null, maximumSize:ISize = null):ReshapeableHandle [static]
Creates a handle for the given position using the location instance
as the position for the handle. | ReshapeableHandle | ||
[static]
Creates a handle for the given position that uses and modifies the rectangle instance provided. | ReshapeableHandle | ||
[static]
Creates a handle for the given position that uses and modifies the instances using
the reshapeable interface. | ReshapeableHandle | ||
dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void
This implementation does nothing. | ReshapeableHandle | ||
handleMove(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):Boolean
This implementation calls moveBy using the delta values. | ReshapeableHandle | ||
initializeDrag(context:IInputModeContext):void
This implementation does nothing. | ReshapeableHandle | ||
moveBy(dx:Number, dy:Number):Boolean
Actually moves this handle by modifying the reshapeable. | ReshapeableHandle | ||
moveByDx(dx:Number):Boolean
Moves in x direction. | ReshapeableHandle | ||
moveByDy(dy:Number):Boolean
Moves in y direction. | ReshapeableHandle | ||
setPosition(x:Number, y:Number):void
Sets the absolute position of the handle. | ReshapeableHandle |
cursor | property |
cursor:Cursor
Gets or sets the cursor to display when the mouse hovers over or drags this handle.
public function get cursor():Cursor
public function set cursor(value:Cursor):void
index | property |
index:uint
[read-only] The position of the handle. 0 for north-west up to 8 for south-east.
protected function get index():uint
location | property |
location:IPoint
[read-only] The reference for the location of the handle.
protected function get location():IPoint
maximumSize | property |
maximumSize:ISize
Gets or sets the maximum size allowed for the reshapeable.
The value is stored by reference.
The default value is ImmutableSize.UNBOUND
.
public function get maximumSize():ISize
public function set maximumSize(value:ISize):void
minimumEnclosedArea | property |
minimumEnclosedArea:IRectangle
Gets or sets the minimum rectangular area that needs to be contained in the reshapeable.
The default value is ImmutableRectangle.EMPTY
.
public function get minimumEnclosedArea():IRectangle
public function set minimumEnclosedArea(value:IRectangle):void
minimumSize | property |
minimumSize:ISize
Gets or sets the minimum size allowed for the reshapeable.
The value is stored by reference.
The default value is ImmutableSize.EMPTY
.
public function get minimumSize():ISize
public function set minimumSize(value:ISize):void
rect | property |
rect:IRectangle
[read-only] The rectangle instance to modify.
protected function get rect():IRectangle
reshapeable | property |
reshapeable:IReshapeable
[read-only] The reshapeable instance to write the changes to.
protected function get reshapeable():IReshapeable
type | property |
type:uint
Gets or sets the type of the handle that can be used by the rendering engine to render types differently.
public function get type():uint
public function set type(value:uint):void
See also
x | property |
x:Number
Gets or sets the x coordinate.
The setter delegates to moveByDx
public function get x():Number
public function set x(value:Number):void
y | property |
y:Number
Gets or sets the y coordinate.
The setter delegates to moveByDy
public function get y():Number
public function set y(value:Number):void
ReshapeableHandle | () | Constructor |
public function ReshapeableHandle(index:uint, location:IPoint, rect:IRectangle, reshapeable:IReshapeable, minimumSize:ISize, maximumSize:ISize)
Constructor for subclasses that creates a handle for the given position using the location instance as the location for the handle.
The instance modifies the instances using the reshapeable interface and reads the current state using the rect. The handle will automatically trim changes of the rectangle to the specified minimum and maximum size.
Parametersindex:uint — The position index to use for the handle. 0 for north-west up to 8 for south-east.
| |
location:IPoint — The location to use for the handle.
| |
rect:IRectangle — The rectangle.
| |
reshapeable:IReshapeable — The reshapeable to write the changes to.
| |
minimumSize:ISize — The minimum size allowed for the rectangle.
| |
maximumSize:ISize — The maximum size allowed for the rectangle.
|
cancelDrag | () | method |
public function cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void
Delegates the original position to setPosition
Parameters
context:IInputModeContext — The canvas to work on.
| |
originalX:Number — The original x coordinate.
| |
originalY:Number — The original y coordinate.
|
create | () | method |
public static function create(position:uint, location:IPoint, rect:IRectangle, reshapeable:IReshapeable, minimumSize:ISize = null, maximumSize:ISize = null):ReshapeableHandle
Creates a handle for the given position using the location instance as the position for the handle.
Parameters
position:uint — One position of the RectangleHandlePositions to use for the handle.
| |
location:IPoint — The location to use for the handle.
| |
rect:IRectangle — The rectangle.
| |
reshapeable:IReshapeable — The reshapeable to write the changes to.
| |
minimumSize:ISize (default = null ) — The minimum size allowed for the rectangle.
If null , ImmutableSize.EMPTY is used.
| |
maximumSize:ISize (default = null ) — The maximum size allowed for the rectangle.
If null , ImmutableSize.UNBOUND is used.
|
ReshapeableHandle — A new instance that models a handle at the given position of the rectangle.
|
See also
createFromRectangle | () | method |
public static function createFromRectangle(position:uint, rect:IMutableRectangle):ReshapeableHandle
Creates a handle for the given position that uses and modifies the rectangle instance provided.
Parameters
position:uint — One position of the RectangleHandlePositions to use for the handle.
| |
rect:IMutableRectangle — The rectangle that serves as a model for the handle.
|
ReshapeableHandle — A new instance that models a handle at the given position of the rectangle.
|
See also
createFromReshapeable | () | method |
public static function createFromReshapeable(position:uint, rect:IRectangle, reshapeable:IReshapeable):ReshapeableHandle
Creates a handle for the given position that uses and modifies the instances using the reshapeable interface.
The implementation uses the rect instance to determine the position of the handle and writes changes to the geometry of the rectangle to the reshapeable.
Parameters
position:uint — One position of the RectangleHandlePositions to use for the handle.
| |
rect:IRectangle — The rectangle
| |
reshapeable:IReshapeable — The reshapeable to write changes to.
|
ReshapeableHandle — A new instance that models a handle at the given position of the rectangle.
|
See also
dragFinished | () | method |
public function dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void
This implementation does nothing.
Parameters
context:IInputModeContext — The canvas to work on.
| |
originalX:Number — The x coordinate before the drag operation started.
| |
originalY:Number — The y coordinate before the drag operation started.
| |
newX:Number — The new x coordinate.
| |
newY:Number — The new y coordinate.
|
handleMove | () | method |
public function handleMove(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):Boolean
This implementation calls moveBy
using the delta values.
Parameters
context:IInputModeContext — The x coordinate before the drag operation started.
| |
originalX:Number — The y coordinate before the drag operation started.
| |
originalY:Number — The new x coordinate.
| |
newX:Number — The new y coordinate.
| |
newY:Number |
Boolean |
initializeDrag | () | method |
public function initializeDrag(context:IInputModeContext):void
This implementation does nothing.
Parameters
context:IInputModeContext — The canvas to work on.
|
moveBy | () | method |
public function moveBy(dx:Number, dy:Number):Boolean
Actually moves this handle by modifying the reshapeable.
Parameters
dx:Number — The x offset, the handle was moved by.
| |
dy:Number — The y offset, the handle was moved by.
|
Boolean |
moveByDx | () | method |
public function moveByDx(dx:Number):Boolean
Moves in x direction. Delegates to moveBy
Parameters
dx:Number — The offset, the handle was moved by.
|
Boolean |
moveByDy | () | method |
public function moveByDy(dy:Number):Boolean
Moves in y direction. Delegates to moveBy
Parameters
dy:Number — The offset, the handle was moved by.
|
Boolean |
setPosition | () | method |
public function setPosition(x:Number, y:Number):void
Sets the absolute position of the handle. Delegates to moveBy
Parameters
x:Number — The x coordinate to set.
| |
y:Number — The y coordinate to set.
|