I'm using the Google Street View to display custom panorama's, and would like a way to dynamically update the links that is displayed in the view (rotating them, adding new ones, and deleting them)
When I say "links" I refer to the arrows you use to navigate inside street view.
Now, I have an array that represents the links I want to add, and when I enter the panorama the first time, they get added properly (through the links_changed
event), however I have no way to see that the links have updated without jumping back and forth within streetview.
I have tried "tricking" the panorama to think that it has changed with:
panorama.setPano(panorama.getPano());
I have also tried triggering the links_changed
event manually by issuing:
google.maps.event.trigger(panorama, 'links_changed');
which runs the function just fine, but it doesnt do anything within streetview
Here's a JSFiddle that describes my problem:
Try this:
function createCustomLinks() {
var links = panorama.getLinks();
var panoId = panorama.getPano();
links.push({
heading: parseInt(degInput.value),
description: 'Something',
pano: panoId
});
panorama.setOptions({
links: links
});
}
And call createCustomLinks()
from your click event listener. That should work.