Class: PointManipulator

algeobraCanvas~PointManipulator(scene, coordinateMapper, canvas, pointDescriptors)

Simple mouse interaction Takes a number of points and handles. They are separate to allow for constrained points that can be controlled via a handle. For example, a handle is the closest point on a circle to the settable point. Thus the handle will always be constrained to the circle. Touch is still a bit finnicky.

Constructor

new PointManipulator(scene, coordinateMapper, canvas, pointDescriptors)

Parameters:
Name Type Description
scene GeometryScene The scene where the points are registered
coordinateMapper CoordinateMapper A mapper to convert from and to the canvas
canvas HTMLCanvasElement The canvas element
pointDescriptors Object Descriptors for points and handles. write: The point that is updated via the mouse position read: The point that is used to check closeness radius: Interaction radius of the point
Source:

Methods

attach(canvas, coordinateMapper)

Attach this to a new canvas
Parameters:
Name Type Description
canvas HTMLCanvasElement The new canvas
coordinateMapper CoordinateMapper The corresponding coordinate mapper
Source:

detach()

Remove this from the local canvas
Source:

(static) createForPoints(scene, coordinateMapper, canvas, points, radius) → {PointManipulator}

Create a new PointManipulator that allows one to move the given points
Parameters:
Name Type Description
scene GeometryScene The scene
coordinateMapper CoordinateMapper Mapper
canvas HTMLCanvasElement The canvas to attach to
points Array.<Number> An array of point indices from the scene
radius Number The interaction radius of the points
Source:
Returns:
A new manipulator
Type
PointManipulator

(static) createForPointsAndHandles(scene, coordinateMapper, canvas, points, radius) → {PointManipulator}

Create a new PointManipulator that allows one to move the given points using handles
Parameters:
Name Type Description
scene GeometryScene The scene
coordinateMapper CoordinateMapper Mapper
canvas HTMLCanvasElement The canvas to attach to
points Array.<Array.<Number>> An array of arrays, where the second array elements are of length two and contains [point index, handle index] from the scene
radius Number The interaction radius of the points
Source:
Returns:
A new manipulator
Type
PointManipulator