Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Huge Google Maps Controls (Possible Bug?)

I first noticed that my Google Maps Controls were disproportionally large on my own web app (seen below).

enter image description here

Initially I thought some of my CSS was playing with Google's CSS on the controls; however, visiting Google's own webpage told me this incident was not isolated to me...

Below is a map on their documentation: https://developers.google.com/maps/documentation/javascript/examples/control-positioning

enter image description here

The large controls appear on every page of their documentation for me as well. I tried different machines and different browsers (Chrome and Firefox).

I also tried other sites that used the Google Maps API and saw a similar phenomenon in some cases.

enter image description here

Is anyone else experiencing the same issues?

like image 605
p4t Avatar asked Aug 14 '18 02:08

p4t


People also ask

What are the user interface controls available in Google Maps?

Default ControlsZoom − To increase and decease the zoom level of the map, we will have a slider with + and − buttons, by default. This slider will be located at the corner of left hand side of the map. Pan − Just above the zoom slider, there will be a pan control for panning the map.

How do I find the point of intersection on Google Maps?

Finding Intersections To find the intersection between two roads, insert an ampersand ("&") between the two street names. Search for "Broadway & E 14th St, New York, NY" to find the intersection between Broadway and East 14th Street in New York, for example.


2 Answers

Looks like google have now acknowledged this and have provided a (currently un-documented) feature to change the UI scaling by passing in a "controlSize" when creating the map.

See comment from Google here.

JSFiddle here (from comment above).

Sample code:

var map; function initMap() {   map = new google.maps.Map(document.getElementById('map'), {     center: {lat: -34.397, lng: 150.644},     zoom: 8,     controlSize: 32,   }); } 

Note: 40 is the default currently (and corresponds to the large controls that this question is about). I've found 25 to be about the same as the previous controls.

Update:

As of v3.36 this is a documented feature, see here

like image 57
Dutchmanjonny Avatar answered Oct 11 '22 08:10

Dutchmanjonny


Turns out this isn't a bug. See more here:

Aug 13, 2018 03:56PM Reported Issue Google Maps JavaScript API weekly channel (3.34) will be using the larger control UI.

As we are seeing increases of touch operations on various devices, we adjusted the control UI to fit for both finger touches and mouse clicks.

It's possible to opt out of this by loading the API with v=quarterly, v=3, v=3.33 or v=3.32. Note: requests to retired version will receive the default channel, see 1.

If you have any requests or other issues concerning the new control UI please let us know.

1 https://issuetracker.google.com/112519576

Use v=quarterly, v=3, v=3.33 or v=3.32 when loading the API to use smaller controls.

EDIT:

Refer to answer from @Jonny van Beek on how to scale Google map's controls to the size of your choosing.

Refer to answers from @garethdn and @Peter (below) to find out how to replace Google's large controls with your own custom controls.

Refer to @Dutchmanjonny's post (below) for latest and correct solution to this problem.

like image 24
p4t Avatar answered Oct 11 '22 08:10

p4t