Encountering an issue while using RayCaster
to select TextGeometry
. The function createText()
is used to display text on the canvas, which works fine and adds it to the array of meshes for RayCaster
intersection checks. However, the function HandleSingleClick()
does not trigger for TextGeometries.
Testing with cubes confirms that it works as intended when clicking on them causes a color change. Strangely, this behavior does not occur with text elements. Even though the meshes are included in the RayCaster's check array, they are not being detected and acted upon as expected.
import {
Font,
TextGeometry
} from '../js/libs/Three.es.js';
import FontJson from '../fonts/helvetiker_bold.typeface.json';
export default class TextExtension extends Autodesk.Viewing.Extension {
constructor(viewer, options) {
super()
this.viewer = viewer
}
...
deactivate() {
}
/////////////////////////////////////////////////////////
// Unload callback
//
/////////////////////////////////////////////////////////
unload() {
console.log('MeshSelection unloaded')
this.viewer.toolController.deactivateTool(
'MeshSelection')
this.viewer.toolController.unregisterTool(this)
return true
}
...
}
Autodesk.Viewing.theExtensionManager.registerExtension(
'TextSpawner', TextExtension);