onClick(fn) | Callback function for object clicks with left mouse button. The object (or null if there's no object under the mouse line of sight), the event object and the coordinates of the intersecting point in the object's surface are included as arguments onClick(object, event, { x, y, z }) . | - |
onRightClick(fn) | Callback function for object right-clicks. The object (or null if there's no object under the mouse line of sight), the event object and the coordinates of the intersecting point in the object's surface are included as arguments onRightClick(object, event, { x, y, z }) . | - |
onHover(fn) | Callback function for object mouse over events. The object (or null if there's no object under the mouse line of sight) is included as the first argument, and the previous hovered object (or null ) as second argument: onHover(obj, prevObj) . | - |
hoverOrderComparator([fn]) | Getter/setter for the comparator function to use when hovering over multiple objects under the same line of sight. This function can be used to prioritize hovering some objects over others. | By default, hovering priority is based solely on camera proximity (closest object wins). |
hoverFilter([fn]) | Getter/setter for the filter function that defines whether an object is eligible for hovering and other interactions. This function receives an object as sole argument and should return a boolean value | () => true |
lineHoverPrecision([int]) | Getter/setter for the precision to use when detecting hover events over Line objects. | 1 |
tooltipContent([str or fn]) | Object accessor function or attribute for label (shown in tooltip). Supports plain text or HTML content. | |
enablePointerInteraction([boolean]) | Getter/setter for whether to enable the mouse tracking events. This activates an internal tracker of the canvas mouse position and enables the functionality of object hover/click and tooltip labels, at the cost of performance. If you're looking for maximum gain in your render performance it's recommended to switch off this property. | true |
hoverDuringDrag([boolean]) | Getter/setter for whether to trigger hover events while using the controls via pointer dragging. | false |
clickAfterDrag([boolean]) | Getter/setter for whether to trigger a click event after dragging using the controls. | false |
getPointerPos() | Getter for the current position of the pointer relative to the viewport, in { x, y } px coordinates. | |