Fixing pinch-zoom in Forge viewer applications

Over the last few days I’ve been working to improve support for touch devices in Dasher 360: the primary focus is on touch-enabled TVs and monitors, but I’ve been doing much of the testing for this on my mobile phone. Which means things are steadily getting better for people wanting to use phones and tablets to access the site, too.

It turns out – and this may not come as a surprise to many of you – that the default pinch behaviour in the Forge viewer is to do an unconstrained orbit. No zoom, just the orbit mode that makes the least sense for building models. So the experience inside Dasher 360 was frankly really bad.Broken pinch-zoom in Dasher 360

The good news is that it’s actually pretty easy to override the default behaviour and add custom touch-gesture support inside your Forge viewer applications. The key to doing this is to create your own object that implements Autodesk.Viewing.ToolInterface, and in particular the handleGesture() function. This allows you to intercept a number of…

Read more