The SelectionManager provides shared selection functionality using a Convergence ElementReference associated with the RealTimeModel
representing the Graph. The local user can set the selection using the SelectionManager and the local selection will be broadcast to all collaborators of the RealTimeModel. Remote selections will be rendered by highlighting the selected elements rendered in the local paper / graph.
ConvergenceJointUtils.SelectionManager
#Example
const model = <some Convergence RealTimeModel>;
const activity = <some Convergence Activity>;
const graphAdapter = ConvergenceJointUtils.GraphAdapter.create(model);
const paper = new joint.dia.Paper({
model: graphAdapter.graph()
});
const colorManager = new ConvergenceJointUtils.ActivityColorManager(activity);
const selectionManager = new ConvergenceJointUtils.SelectionManager(paper, graphAdapter, colorManager);
#API
Method | Description |
---|---|
constructor(paper, graphAdapter, colorManager) | Creates a new SelectionManager. |
dispose() | Disconnects the SelectionManager from the paper and model. |
isDisposed() | Determines if the SelectionManager is disposed. |
SelectionManager(paper, realTimeModel, colorManager)
Constructs a new SelectionManager remote selections will be rendered on the supplied paper. The local selection will be broadcast using an ElementReference from the associated graphAdapter.
Note: the realTimeModel should be bound to the graph that the paper is rendering. The colorManager determines the highlight color of remote selections.
const selectionManager =
new ConvergenceJointUtils.SelectionManager(paper, realTimeModel, colorManager);
Disconnects the SelectionManager from the paper and the RealTimeModel. After calling dispose, the local selection will no longer be broadcast and remote selections will be removed and no longer rendered. Once dispose is called this instance can no longer be used.
const = selectionManager = // new selection manager;
console.log(selectionManager.isDisposed()); // prints: false
selectionManager.dispose();
console.log(selectionManager.isDisposed()); // prints: true
Determines if the SelectionManager is disposed.
const = selectionManager = // new pointer manager;
console.log(selectionManager.isDisposed()); // prints: false