Hello!
I’ve been trying in the last week to add customized interaction within the viewer v3 using the InteractionEngine but, outside of the three part tutorial I couldn’t find any documentation for @shapediver/viewer.features.interaction specifically. For example, I know I can use InteractionEngine.addInteractionManager(manager), but I can’t find an answer as to where the interactionEngine itself is saved, nor what token:string is used with removeInteractionManager(). Also, to reduce size file I moved the addition of interactions in an other file and passing through callback functions seems to break functionnality.
Snippet from file:
const addDragToInteractionEngine = (
interactionEngine: InteractionEngine,
onDownEvent:
| ((ray: IRay, intersections: IIntersection[]) => void)
| undefined = onDownBase,
onEndEvent:
| ((ray: IRay, intersections: IIntersection[]) => void)
| undefined = onEndBase
) => {
const dragManager = new DragManager();
const planeConstraint = new PlaneConstraint([0, 0, 1]);
dragManager.effectMaterial = new SDV.MaterialData({ color: "#DF0F090" });
dragManager.addDragConstraint(planeConstraint);
dragManager.onDown = onDownEvent;
dragManager.onEnd = onEndEvent;
interactionEngine.addInteractionManager(dragManager);
return interactionEngine;
};
Any help on the matter would be greatly appreciated!
Thanks!