UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

27 lines (26 loc) 1.08 kB
"use strict"; import { BaseRayObjectIntersectionsController } from "./_BaseRayObjectIntersectionsController"; export class RayObjectIntersectionsHoverController extends BaseRayObjectIntersectionsController { constructor() { super(...arguments); this._propertiesListByObject = /* @__PURE__ */ new Map(); this._intersectedStateByObject = /* @__PURE__ */ new Map(); } process() { this._setIntersectedState(this._objects, this._intersectedStateByObject); const objects = this._objects; for (const object of objects) { const propertiesList = this._propertiesListByObject.get(object); if (propertiesList) { for (const properties of propertiesList) { const currentHoveredState = properties.hover.hoveredStateRef.value; const newHoveredState = this._intersectedStateByObject.get(object) || false; if (newHoveredState != currentHoveredState) { properties.hover.hoveredStateRef.value = newHoveredState; properties.hover.onHoveredStateChange(); } } } } } }