How can I use the billboard entity as a button to call another function upon the user clicking it?
How can I use the billboard entity as a button to call another function upon the user clicking it?
I normally have to create my own mouse handler, something like;
this.handler = new Cesium.ScreenSpaceEventHandler(this.mapService.viewer.canvas);
this.handler.setInputAction(
(movement) => this.handleClick(movement, false),
Cesium.ScreenSpaceEventType.LEFT_CLICK);
And then in the this.handleClick() function you check for features that was clicked on;
let features = this.mapService.viewer.scene.pickPosition(movement.position);
If the feature is your billbord (for example, check on UID of the entity), you know what to do. As far as I know, there’s no inbuilt simple onclick mechanism for stuff, it’s always from the controller and down into the objects, not the other way around unfortunately.
Cheers,
Alex