PointerDownEventHandler manages clicks on any part of the canvas (except buttons defined with eventListerners).
An instance is created in main-scene.ts and tied to the window.scene.onPointerDown event.
Note: There can only be 1 window.scene.onPointerDown call in the application. Therefore a need to have a handler with a registration process
Each object that wants to be called when a mesh is clicked has to register with two parameters:
handler: a call back function of the registered object
handlerid: a string identifed by the clicked mesh name (pickResult.pickedMesh.name.includes(clickedMeshName)
handleEvent is called by the onPointerDown event of the scene.
It loops over all clickedMeshNames and calls the callback if it finds a matching record.
Note: "Right" mouseclicks (evt.button == 2) are used for dropping items from inventory
and can only be invoked if the click is on the "ground" mesh.
PointerDownEventHandler manages clicks on any part of the canvas (except buttons defined with eventListerners).
An instance is created in main-scene.ts and tied to the window.scene.onPointerDown event.
Note: There can only be 1 window.scene.onPointerDown call in the application. Therefore a need to have a handler with a registration process
Each object that wants to be called when a mesh is clicked has to register with two parameters:
handleEvent is called by the onPointerDown event of the scene. It loops over all clickedMeshNames and calls the callback if it finds a matching record.
Note: "Right" mouseclicks (evt.button == 2) are used for dropping items from inventory and can only be invoked if the click is on the "ground" mesh.