Not sure if this is by design, or if this is indeed a bug.

If you click on a marker twice, the info balloon opens twice over itself. In order to close it, you must click on the "X". Similarly, if you have an open balloon, and click on another marker, the first remains open and the new one opens above that.

One would expect/hope that clicking away within the map would close any open balloon similar to the Google maps interface.

Comments

rdeboer’s picture

Is this using Google, Leaflet or Openlayers?

efruin’s picture

I'm experiencing the same thing using a Google map.

efruin’s picture

StatusFileSize
new460.15 KB

here's a screenshot of what I'm seeing.

rdeboer’s picture

Version: 7.x-1.9 » 7.x-1.19
Assigned: Unassigned » rdeboer
Category: bug » feature

I'll have a quick look to see if this is simply a parameter I need to pass to the Google Maps API. If it's not that simple, I welcome patches.

I suggest that you keep IP Geolocation Views and Maps but also install the "Leaflet" and "Leaflet More Maps" modules.
You can continue to use the View you have already created. All you have to do is flick the View style/format from "Map (Google, via IP Geolocaton)" to "Map (Leaflet, via IP Geolocation)".

Whit the Leaflet module, the marker balloons work as you describe.

With Leaflet by itself you only get one map (OSM Mapnik) to choose from, But after also installing "Leaflet More Maps" you'll see nearly 30 maps to choose from, including Google maps.

This (unrelated) issue has a screenshot showing Leaflet balloons with Google markers on a Bing map (just for something different again): http://drupal.org/node/1973064#comment-7314168

rdeboer’s picture

Google seem to have had a change of hearts regarding the default behaviour of balloons. The behaviour you're requesting is default Google Maps API v2 behaviour. IP Geoloc Views and Maps uses Google Maps API v3.

On their InfoWindow documentation pages Google says:

InfoWindows may be attached to either Marker objects (in which case their position is based on the marker's location) or on the map itself at a specified LatLng. If you only want one info window to display at a time (as is the behavior on Google Maps), you need only create one info window, which you can reassign to different locations or markers upon map events (such as user clicks). Unlike behavior in V2 of the Google Maps API, however, a map may now display multiple InfoWindow objects if you so choose.

If somebody wants this to be a configurable option, i.e. to allow selection of either Google Maps old-style vs Google Maps API V3 behaviour, then I welcome patches.

The files to modify are js/ip_geoloc_gmap_multi_loc.js and views/ip_geoloc_plugin_style_map.inc

Other than that, as mentioned in #4, switch to the Leaflet plugin that comes with IP Geolocation Views and Maps and use Google Maps (or any other map) via Leaflet.

inky@inky3d.com’s picture

I was using the Google map. Switched to Leaflet and the markers work great. (I had also tested with OpenLayers - which was even worse)

Thanks for the advice

rdeboer’s picture

Title: Markers open on top of themselves, don't close on click » In Google API v3 multiple markers can be opened, don't auto-close on click outside balloon
Status: Active » Closed (works as designed)

As mentioned above in #5 This is Google API v3 style. If you want Google API v2 style, switch to Leaflet or provide a patch to make this behaviour configurable.

anou’s picture

Version: 7.x-1.19 » 7.x-1.26
Issue summary: View changes
Status: Closed (works as designed) » Needs review
StatusFileSize
new1.2 KB

Hello,
here's a starter patch for this. My patch resolves 2 "problems":

  1. stops balloon from opening over itself again and again on each click on marker
  2. auto-closes already open balloon if you click on another marker

Another step could be to close all balloons when you click on map...

Hope it'll helps.

Thank for your module and have a nice day.

PiroXXI’s picture

Hi there,

Nice patch :) . It does the job pretty well.

One small feedback is that it doesn't yet work well with the "Marker balloons to open on initial display" option, as this balloon is not closed when an other one is opened.

Cheers,

Raphael

weri’s picture

Version: 7.x-1.26 » 7.x-1.27
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.89 KB

Thanks anou for the patch. I tested the patch and fixed also the problem described in comment #9 from PiroXXI.

I think the new patch is ready to commit.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 10: ip_geoloc-auto_close_balloon-1972570-10.patch, failed testing.

weri’s picture

Patch format updated (was in phpstorm's format). Sorry!

weri’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 12: ip_geoloc-auto_close_balloon-1972570-11.patch, failed testing.

weri’s picture

Status: Needs work » Needs review
StatusFileSize
new1.75 KB

Created patch now with git diff.....

Status: Needs review » Needs work

The last submitted patch, 15: ip_geoloc-auto_close_balloon-1972570-15.patch, failed testing.

weri’s picture

StatusFileSize
new1.85 KB

Last try :-/

Sorry about the many patches....

weri’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 17: ip_geoloc-auto_close_balloon-1972570-17.patch, failed testing.

Alienpruts’s picture

Hello weri,

how did you create the patch at comment 18? Certainly this is not by using git diff method? :)

I think your patches are failing because you should always create your patches onto the latest dev version of a module. Did you do that?

anou’s picture

Here's the new patch with weri's changes. Thanks.

anou’s picture

Status: Needs work » Needs review
anou’s picture

StatusFileSize
new1.7 KB

Same patch, no

trailing whitespace.

:-)

anou’s picture

weri’s picture

Status: Needs review » Reviewed & tested by the community

I tested the patch #23 from anou and it works as expected. Would be great to have this patch commited.

  • RdeBoer committed b13f76f on 7.x-1.x authored by anou
    Issue #1972570 by weri, anou: In Google API v3 multiple markers can be...
rdeboer’s picture

Committed. Thanks everyone!
Rik

PS: not tested -- no time, so please verify 7.x-1.x-dev if you can!

rdeboer’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.