unclejam
unclejam

Reputation: 341

Google Street View API: Disable changing position by double-clicking

I am using the Google Street view API and want to disable all of the controls besides panning and zooming. If you click or double click it will change your position to that location. Right now I am using the 'position_changed' event to check if the user changed the position and then try to reset the position to the original. It's a hack but its all I have found possible. The problem I am having is I get in an infinite loop.

        var origPosY = panorama.getPosition().Ya,
            origPosX = panorama.getPosition().Za,
            originalPos = new google.maps.LatLng(panorama.getPosition().Ya, panorama.getPosition().Za);

        google.maps.event.addListener(panorama, 'position_changed', function() {
            //console.log('Position changed',panorama.getPosition().Ya, panorama.getPosition().Za);
            //var newPos = new google.maps.LatLng(panorama.getPosition().Ya, panorama.getPosition().Za);
            if( origPosY != panorama.getPosition().Ya ){
                console.log('Resetting pos');
                panorama.setPosition(originalPos); 
            }

        });

It appears that when I check to make sure they are different it is still getting inside the if statement. Does anyone know of any other way to disable this functionality? They let you disable all the controls but not the double-click and mouse wheel. Any help would be greatly appreciated.

Upvotes: 2

Views: 2063

Answers (1)

Dr.Molle
Dr.Molle

Reputation: 117314

Set the options clickToGo and scrollwheel of panorama to false

Upvotes: 7

Related Questions