Implementing a demo mode inside the Forge viewer Part 2

Dasher 360 in kiosk mode

Now that we’ve seen how to move a fake cursor across the screen, let’s talk about how best to use this technique to implement a demo mode for your Forge viewer-based application.

Something I mentioned last time was that – for our purposes – this code needs to be fairly adaptable, whether for different views, models or screen configurations. It also needs to be easy for us to modify or extend.

Inside Dasher 360 we’ve implemented a number of different extensions. Many of these have their own UI, typically launched by a button. One of the first things I did for this project was to make each extension able to report the location of its launch button: this way we can query the information and use it to move the cursor to that location in order to simulate the launch action (we load and run the extension from our code, of course).

Here’s a snippet of TypeScript code that shows how this works, more or less (there are dependent functions that I haven’t included):

Read more