Class Handle
Defined in: handles.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Handle(type)
Handles are created on-the-fly for a figure.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
Handle.connectorTypes
It's a (static) vector of connector types
|
<static> |
Handle.RADIUS
Default handle radius
|
Type of Handle
|
|
<static> |
Handle.types
It's a (static) vector of handle types
Note: R - stand for rotation
Note: More handles might be added in the future : like handles to increase the number of edges for a hexagone
Those handles will be specific for a figure
|
Used by Connector handles, to not display redundant handles (i.e.
|
|
The center of the circle (x coordinates)
|
|
The center of the circle (y coordinates)
|
Method Attributes | Method Name and Description |
---|---|
action(lastMove, newX, newY)
Handle an action.
|
|
actionConnector(lastMove, newX, newY)
Handle actions for Connector
|
|
actionFigure(lastMove, newX, newY)
Handle actions for Figure
|
|
contains(x, y)
See if the handle contains a point
|
|
equals(group)
Compares to another Handle
|
|
Get a handle bounds
|
|
Get the specific cursor for this handle.
|
|
<static> |
Handle.load(o)
Creates a {Handle} out of JSON parsed object
|
<static> |
Handle.loadArray(v)
Creates an array of handles from an array of {JSONObject}s
|
paint(context)
This is the method you have to call to paint a handler
All handles will be circles.
|
|
transform(matrix)
Transform the Handle through a matrix
|
Class Detail
Handle(type)
Handles are created on-the-fly for a figure. They are completelly managed by the HandleManager
Each handle is responsable for an action. The {Handle} does not need to keep a reference to the parent shape
as the HandleManager will do that.
- Parameters:
- {String} type
- - the type of handle
Field Detail
<static>
Handle.connectorTypes
It's a (static) vector of connector types
<static>
Handle.RADIUS
Default handle radius
type
Type of Handle
<static>
Handle.types
It's a (static) vector of handle types
Note: R - stand for rotation
Note: More handles might be added in the future : like handles to increase the number of edges for a hexagone
Those handles will be specific for a figure
visible
Used by Connector handles, to not display redundant handles (i.e. when they are on the same line)
x
The center of the circle (x coordinates)
y
The center of the circle (y coordinates)
Method Detail
action(lastMove, newX, newY)
Handle an action. Simply dispatch to the correct handler
- Parameters:
- {Array} lastMove
- - an array that will hold [x,y] of last x & y coordinates
- {Number} newX
- - new X coordinate
- {Number} newY
- - new Y coordinate
actionConnector(lastMove, newX, newY)
Handle actions for Connector
- Parameters:
- {Array} lastMove
- - an array that will hold [x,y] of last x & y coordinates
- {Number} newX
- - new X coordinate
- {Number} newY
- - new Y coordinate
actionFigure(lastMove, newX, newY)
Handle actions for Figure
- Parameters:
- {Array} lastMove
- - an array that will hold [x,y] of last x & y coordinates
- {Number} newX
- - new X coordinate
- {Number} newY
- - new Y coordinate
contains(x, y)
See if the handle contains a point
- Parameters:
- {Number} x
- - the x coordinate of the point
- {Number} y
- - the y coordinate of the point
{Boolean}
equals(group)
Compares to another Handle
- Parameters:
- {Handle} group
- - - the other glue
- Returns:
- {Boolean} - true if equals, false otherwise
getBounds()
Get a handle bounds
getCursor()
Get the specific cursor for this handle. Cursor is ONLY a visual clue for
the user to know how to move his mouse.
Behaviour:
If North handle is in the North we have 'Up/Down arrow" cursor
If North handle is in the West (so it has "Left/Right arrow") (or anything different that North)
we have 'Left/Right arrow' cursor but the figure will expand as follows:
- rotate back to initial position
- expand North
- rotate back to current position
- repaint
Author: Zack Newsham, Alex Gheorghiu .
Author: Zack Newsham
- See:
- http://www.w3schools.com/css/pr_class_cursor.asp for cusor values
<static>
{Handle}
Handle.load(o)
Creates a {Handle} out of JSON parsed object
Author: Alex Gheorghiu.
Author: Alex Gheorghiu
- Parameters:
- {JSONObject} o
- - the JSON parsed object
- Returns:
- {Handle} a newly constructed Handle
<static>
Handle.loadArray(v)
Creates an array of handles from an array of {JSONObject}s
Author: Alex Gheorghiu.
Author: Alex Gheorghiu
- Parameters:
- {Array} v
- - the array of JSONObjects
- Returns:
- an {Array} of {Handle}s
paint(context)
This is the method you have to call to paint a handler
All handles will be circles...so we avoid to much of the computing for rectangle handles
They will have a filling color (green) and a stoke (black)
- Parameters:
- {Context} context
- - the 2D context
transform(matrix)
Transform the Handle through a matrix
- Parameters:
- {Matrix} matrix
- - the matrix that will perform the transformation