Questions about Street View

New home Forums Pro Add-on Pre-sale questions Questions about Street View

This topic contains 6 replies, has 2 voices, and was last updated by  Scott Lehane 1 month ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #53012

    Scott Lehane
    Member

    Hello,

    I am considering purchasing the Pro Version with the Visitor Generator Add-on, but I’m not sure it will do what I need it to do.

    In a nutshell, I’d like to create a map where registered members of the site can pin their own panoramic Street Views, (or their favorite Street Views from around the world) — kind of like a community for amateur 360-degree photographers. The site is intended to be viewed in VR visors, so the ability to hop from one pin to the next without much hassle is important.

    I’ve been playing with the free version, but I can’t figure out how to pin a street view on it. Is that something in the Pro Version? Is there some trick to it that I’m missing? Is it even supported?

    Thanks in advance for your help.

    #53021

    Perry
    Moderator

    Hi Scott

    Thank you for getting in touch.

    This sounds like a very interesting use case, there are a few approaches you could take here.

    If you’re looking to use Google’s StreetView then yes, our plugin does support that. We can potentially provide custom code (at no cost) to trigger street view when a marker is clicked if that’s the kind of experience you’re looking for. You would need our Visitor Generated Markers add-on to allow visitors to submit such markers.

    If you’re looking for users to submit their own street view imagery, then our Visitor Generated Markers add-on does support image upload. You could allow your users to upload their own panoramic shots there.

    With regards to jumping around markers, it’s quite easy to have the markers show up in street view, that’s also something we could look into if that’s a viable solution for your project.

    I hope that helps?

    Kind regards
    – Perry

    #53027

    Scott Lehane
    Member

    Thanks Perry!

    This is very helpful. I was considering a few different plug-ins for the job, but your response really sealed the deal.

    I might take you up on that offer of a bit of custom code to trigger Street View when a marker is clicked. How would we do that? In return I can offer a special thanks on the site. I can give you more details on it in a private message.

    I downloaded the Pro and Visitor Generated plug ins. Now I’m just learning how to use it.

    Cheers
    Scott

    #53037

    Perry
    Moderator

    Hi Scott

    This would work well

    jQuery(function ($) {
    	
    	console.log("Loading custom code");
    	
    	$(document.body).on("click.wpgmza", function(event) {
    		
    		if(!(event.target instanceof WPGMZA.Marker))
    			return;
    		
    		var pano = event.target.map.googleMap.getStreetView();
    		pano.setPosition(event.target.getPosition().toGoogleLatLng());
    		pano.setVisible(true);
    		
    	});
    	
    });

    We do need to patch our EventDispatcher today in order for this to work, it appears a bug has been introduced there. You can patch the function ahead of that by also using this JavaScript

    WPGMZA.EventDispatcher.prototype.dispatchEvent = function(event)
    	{
    		if(!(event instanceof WPGMZA.Event))
    		{
    			if(typeof event == "string")
    				event = new WPGMZA.Event(event);
    			else
    			{
    				var src = event;
    				event = new WPGMZA.Event();
    				for(var name in src)
    					event[name] = src[name];
    			}
    		}
    
    		event.target = this;
    			
    		var path = [];
    		for(var obj = this.parent; obj != null; obj = obj.parent)
    			path.unshift(obj);
    		
    		event.phase = WPGMZA.Event.CAPTURING_PHASE;
    		for(var i = 0; i < path.length && !event._cancelled; i++)
    			path._triggerListeners(event);
    			
    		if(event._cancelled)
    			return;
    			
    		event.phase = WPGMZA.Event.AT_TARGET;
    		this._triggerListeners(event);
    			
    		event.phase = WPGMZA.Event.BUBBLING_PHASE;
    		for(i = path.length - 1; i >= 0 && !event._cancelled; i--)
    			path._triggerListeners(event);
    		
    		// Native DOM event
    		var topMostElement = this.element;
    		for(var obj = this.parent; obj != null; obj = obj.parent)
    		{
    			if(obj.element)
    				topMostElement = obj.element;
    		}
    		
    		if(topMostElement)
    		{
    			var customEvent = {};
    			
    			for(var key in event)
    			{
    				var value = event[key];
    				
    				if(key == "type")
    					value += ".wpgmza";
    				
    				customEvent[key] = value;
    			}
    			
    			$(topMostElement).trigger(customEvent);
    		}
    	}

    You can remove that after applying the Pro 7.11.50 update which will go live early next week.

    This can be pasted in under Maps -> Settings -> Advanced in Custom JS.

    Does that help?

    Kind regards
    – Perry

    #53071

    Scott Lehane
    Member

    Thank you so much!

    Just so I’m clear, should I paste both snippets in Custom JSS? Would it matter which order I put them in? Or is the top snippet meant for the Custom CSS field?

    Sorry if that’s a dumb question.

    You guys rock!

    Scott

    #53089

    Perry
    Moderator

    Hi Scott

    You need to put all that code in Custom JS – and *not* in Custom CSS. It doesn’t matter which order you put them in.

    No need to apologise! And thank you for your kind words 🙂

    Please can you confirm that works following adding that to the Custom JS field?

    Kind regards
    – Perry

    #53167

    Scott Lehane
    Member

    It works beautifully! That was the last piece of a puzzle I’ve been working on for almost a year.

    The site is about to launch in the next 24 hours. (https://VRNation.tv). I’ll include a special thanks to you guys under the About Us page.

    #53170

    Perry
    Moderator

    Hi Scott

    Thank you very much! We’ll certainly take a look at the site once it goes live 🙂

    Good luck with the launch!

    If you do need anything else, please don’t hesitate to ask.

    Kind regards
    – Perry

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.