The PointerManager provides a shared pointer that is connected to the joint.dia.Paper
objects. The location of the local pointer is captured from a Paper object and transmitted to participants of a Convergence Activity
. Remote pointers from other users are rendered on the Paper with a color corresponding to the specific user.
ConvergenceJointUtils.PointerManager
#Example
const activity = <some Convergence Activity>;
const paper = <some JointJS Paper>;
const colorManager = new ConvergenceJointUtils.ActivityColorManager(activity);
const pointerManager = new ConvergenceJointUtils.PointerManager(
paper, activity, colorManager, "../dist/img/cursor.svg");
#API
Method | Description |
---|---|
constructor(paper, activity, colorManager, cursorSvgUrl) | Creates a new PointerManager. |
dispose() | Disconnects the PointerManager from the paper and activity. |
isDisposed() | Determines if the PointerManager is disposed. |
PointerManager(paper, activity, colorManager, cursorSvgUrl)
Constructs a new PointerManager. The pointer manager will capture local pointer locations and render remote pointers on the supplied paper. The supplied activity will be used to determine who to share the pointer locations with. The color manager will be used to determine the color of each remote pointer. The cursorSvg will be used to determine what the pointer looks like.
const pointerManager = new ConvergenceJointUtils.PointerManager(
paper, activity, colorManager, cursorSvgUrl);
If you would like to supply your own svg icon you can do so by supplying the cursorSvgUrl parameter. If you do this you may need to change how the adapter colors the svg based on the user. An additional callback parameter can be passed to the constructor to accomplish this. For example:
function styleCallback(svgDoc, color) {
const paths = $(svgDoc.getElementsByTagName("path"));
paths.css("fill", color);
}
const pointerManager = new ConvergenceJointUtils.PointerManager(
paper, activity, colorManager, cursorSvgUrl, styleCallback);
Disconnects the paper from the activity. After calling dispose, the local pointer will no longer be broadcast and remote pointers will be removed and no longer rendered. Once dispose is called this instance can no longer be used.
const = pointerManager = // new pointer manager;
console.log(pointerManager.isDisposed()); // prints: false
pointerManager.dispose();
console.log(pointerManager.isDisposed()); // prints: true
Determines if the PointerManager is disposed.
const = pointerManager = // new pointer manager;
console.log(pointerManager.isDisposed()); // prints: false