Back to the Shapespark home page

Detect current view mode!

Hello guys,
I am a newbie.
I want to change a few things in my project. I need to detect the current view mode. How do I get the current view mode with code.
Many thanks!

This isn’t documented in the, but per this forum thread: Get details of view by name
the view object is now passed to the onViewSwitchDone callback as the second argument. You can inspect the mode property. Something like:

WALK.getViewer().onViewSwitchDone(function(viewName, view) {
    if (view.mode === 'orbit') {
      console.log('Switched to an orbit view ' + viewName);

Many thanks @jan!
Everything is resolved with viewName!