Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

StreetView API: Hiding FullScreen Control [closed]

I am trying to hide the toggle fullscreen element in the Streetview API HUD.

panorama = new google.maps.StreetViewPanorama(document.getElementById(data.id), {

        position            : new google.maps.LatLng(data.lat, data.lng),
        pov: {
            heading         : Number(data.heading),
            pitch           : Number(data.pitch)
        },
        linksControl: false,
        panControl: false,
        addressControl: false,
        enableCloseButton: false,
        zoomControl: false,
        fullScreenControl: false,
        enableCloseButton: false,
        addressControlOptions: {
             position: google.maps.ControlPosition.BOTTOM_CENTER
        }
    });

These options are specced here. All the options are working except for the fullScreenControl

My code can be viewed live here. The UI element is in the top right corner of the viewport.

The documentation warns as follows:

Note: This page describes the controls available in version 3.22 and later of the Google Maps JavaScript API. If you want to continue using the earlier set of controls for a while, you can set google.maps.controlStyle = 'azteca' in v3.22. Read more about the changes to the controls in this article: What's New in the v3.22 Map Controls.

However I am linking to the API Js file as follows:

<script src="//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>

And 3.exp should be 3.22 at the moment of writing.

What am I missing here?

like image 859
matthiasdv Avatar asked Sep 18 '15 14:09

matthiasdv


People also ask

How do I make Google Street View full screen?

FullScreen for GoogleMaps. FullScreen GoogleMap when push Esc key & F11. Ability to full screen map (hide header and left panel and nav). To take a screenshot.

How do I turn off Street View in Google Maps API?

Street View Map Usage You may hide this control within the map's MapOptions by setting streetViewControl to false . You may also change the default position of the Street View control by setting the Map 's streetViewControlOptions. position property to a new ControlPosition .

How do I hide the controls on Google Maps?

Adding or removing controls from the map is specified in the Map options object. Set the control to true to make it visible - Set the control to false to hide it.


4 Answers

fullscreenControl: false instead of fullScreenControl: false

like image 183
papy98 Avatar answered Oct 24 '22 10:10

papy98


The following is incorrect. It doesn't error but it has no effect on the control.

fullScreenControl: false,   -- this is not right

Correct code is

fullscreenControl: false,

See: https://developers.google.com/maps/documentation/javascript/reference

like image 26
XAos SPB Avatar answered Oct 24 '22 10:10

XAos SPB


Another solution is to use css to hide the fullscreen element:

.gm-style > div:nth-child(10){
 display:none;
}
like image 3
hagu81 Avatar answered Oct 24 '22 10:10

hagu81


I believe there is a minor flaw in the API at this moment. I´ve made some tests and was also unable to remove the full screen control with the fullScreenControlOptions field, as specified in the documentation.

The full screen control is displayed even if you set the disableDefaultUI to true.

I know this may not be the better way to get rid of the element, but you can do something like:

var FULL_SCREEN_CONTROL_STYLE = {
	width: '25px',
	height: '25px',
	top: '0px',
	right: '0px',
	position: 'absolute',
	overflow: 'hidden'
};

var children = panorama.getContainer().getElementsByTagName('div');

for (var i = 0; i<children.length; i++) {

	var current = children[i];
		
	var match = true;
	
	for (var k in FULL_SCREEN_CONTROL_STYLE) {
		if (current.style[k] != FULL_SCREEN_CONTROL_STYLE[k]) {
			match = false;
		}
	}
	
	if (match) { // THIS IS OUR ELEMENT
		current.parentElement.removeChild(current);
	}
	
}
like image 2
Romulo Avatar answered Oct 24 '22 08:10

Romulo