UNPKG

@babylonjs/viewer

Version:

The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.

3 lines (2 loc) 3.43 kB
import{bJ as e,bI as o}from"./index-Bw2N6w1y.esm.min.js";import{e as n}from"./declarationMapper-13w1YGqM.esm.min.js";import{A as t}from"./objectModelMapping-DX92iJ8M.esm.min.js";const r="KHR_node_hoverability",a="targetMeshPointerOver_";n("event/onHoverIn",r,{blocks:["FlowGraphPointerOverEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:e=>[a+e[0]]}},outputs:{values:{hoverNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"targetMesh",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"meshUnderPointer",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor(e,o,n,t,r,i,s){const l=r[r.length-1];l.config=l.config||{},l.config.glTF=s;const d=e.configuration?.nodeIndex?.value[0];if(void 0===d||"number"!=typeof d)throw new Error("nodeIndex not found in configuration");const u=a+d;return r[1].config.variable=u,i._userVariables[u]={className:"Mesh",id:s?.nodes?.[d]._babylonTransformNode?.id,uniqueId:s?.nodes?.[d]._babylonTransformNode?.uniqueId},r}});const i="targetMeshPointerOut_";n("event/onHoverOut",r,{blocks:["FlowGraphPointerOutEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:e=>[i+e[0]]}},outputs:{values:{hoverNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"targetMesh",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"meshOutOfPointer",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor(e,o,n,t,r,a,s){const l=r[r.length-1];l.config=l.config||{},l.config.glTF=s;const d=e.configuration?.nodeIndex?.value[0];if(void 0===d||"number"!=typeof d)throw new Error("nodeIndex not found in configuration");const u=i+d;return r[1].config.variable=u,a._userVariables[u]={className:"Mesh",id:s?.nodes?.[d]._babylonTransformNode?.id,uniqueId:s?.nodes?.[d]._babylonTransformNode?.uniqueId},r}}),t("/nodes/{}/extensions/KHR_node_hoverability/hoverable",{get:e=>{const o=e._babylonTransformNode;return!o||void 0===o.pointerOverDisableMeshTesting||o.pointerOverDisableMeshTesting},set:(e,o)=>{o._primitiveBabylonMeshes?.forEach((o=>{o.pointerOverDisableMeshTesting=!e}))},getTarget:e=>e._babylonTransformNode,getPropertyName:[()=>"pointerOverDisableMeshTesting"],type:"boolean"});class s{constructor(e){this.name=r,this._loader=e,this.enabled=e.isExtensionUsed(r)}async onReady(){this._loader.gltf.nodes?.forEach((e=>{e.extensions?.KHR_node_hoverability&&!1===e.extensions?.KHR_node_hoverability.hoverable&&e._babylonTransformNode?.getChildMeshes().forEach((e=>{e.pointerOverDisableMeshTesting=!0}))}))}dispose(){this._loader=null}}e(r),o(r,!0,(e=>new s(e)));export{s as KHR_node_hoverability}; //# sourceMappingURL=KHR_node_hoverability-DGpUlGTs.esm.min.js.map