how to do if switch object what to Show text with body-end.html
Could you explain in more detail what’ you’d like to achieve? Would you like to display the name of the selected object when cycling through the Switch Object extension?
YES That’s right!
It’s not a documented feature but you can track each object switch event with:
viewer.onApiUserStateChanged(function(key, value) {
});
For state changes triggered by the Switch Objects extension, the key in the callback is SwitchObjects:EXTENSION_NAME, and value is the index of the object in the list of switchable objects defined for your extension (0 for the first object, 1 for the second object, …).