Module.Ravel

Usage:
var ravel=new Module.Ravel

Properties:
handle
of type Handle. A reference to one of the handles of the ravel. Initialise it to a particular ravel with ravel.handle.get(i), where i is the index of the desired handle. One consequence of this, and Javascript's object reference semantics is that you cannot refer simultaneously to two or more handles of the same ravel in the code.
x,y
The mouse coordinates of the centre of the Ravel. Used in methods that process mouse coordinates.

Methods:
numHandles()
Returns the number of handles this ravel has.
rank()
returns the rank of the ravel. Equivalent to getHandleIds().length
setRank(rank)
sets the rank of the ravel. Equivalent to setHandleIds([0,1,...rank]);
getHandleIds()
returns an array of integer ids of the output handles
setHandleIds(array)
sets the array of integer ids of the output handles.
handleId(i)
returns the output handle index for the ith output handle. Equivalent to getHandleIds()[i].
version()
report the version of this ravel software
getState()
returns a JSON string representing the current state of the Ravel
setState(state)
set the state of the Ravel per the JSON string state
radius()
Returns the size of the ravel in pixels, from the origin to the handle tips.
rescale(radius)
Resize the ravel to have a radius radius.

clear()
Removes all handles from the system.
addHandle(axisName,sliceLabels)
adds a handle to the Ravel, with description axisName and having slice labels given by the javascript array sliceLabels.

moveHandleTo(handle, x, y)
moves the handle handle to lie along the vector (x,y). If the norm of (x, y) is below the collapse threshold, the handle is collapsed. This is a somewhat low-level method, usually one should just use the onMouse* event processing methods.

onMouseMotion(x,y)
Handle mouse motion. Handles are rendered differently when the mouse point is hovering over a handle. If the mouse button is pressed, then the handle is moved to the location of the mouse. Returns true if the ravel needs to be redrawn.
onMouseDown(x,y)
Handle mouse button press event.
onMouseUp(x,y)
Handle mouse button release event.

handleIfMouseOver(x,y,exclude)
Returns the index of a handle if the mouse is hovering over it. If the mouse is not hovering over any handle, then -1 is returned. If exclude is positive, then -1 is returned even if the mouse is hovering over the handle given by exclude.

description()
returns descriptive text of the operation of the ravel (plain English for now)

redistributeHandles()
Rank 1 ravels place the output handle in the pointing east position, and the other handles distributed around the circle. Rank 2 ravels place the second output handle pointing south. The other handles are distributed evenly around the other 3 quadrants. Current, ranks 3 or higher ranks are not supported.

Ravelation Pty Ldt