As I have seen on other websites created with Google Maps, there must be an option in the Google API to expand a marker by default. By default, you would not only see a red inverted raindrop, but also a full text box that pop-ups when you normally click on the marker.
In the Gmap documentation it is mentioned that there are more commands available in the gmap module parser. These commands seem not to be documented on Drupal.org. My request could then be interpreted in two ways.
1. Create an overview of additional commands and options that Gmap module users can manually add to the Gmap macro.
2. When using the Google Map Macro Editor, add the option 'Points (expanded by default)' to the drop-down menu under 'What happens when you click on the map:'. That way the user can easily differentiate between creating closed and expanded markers.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | Screen Shot 2013-02-19 at 2.00.00 PM.png | 583.22 KB | jordan8037310 |
Comments
Comment #1
webgeer commented1. The features are relatively well documented on http://webgeer.com/gmapdemo (although this includes documenting a number of xmaps features which are no longer supported). If someone wants to create a page a drupal.org that would be fine with me.
2. The macro creator needs quite a bit of updating. I don't really have time to do it right now, but what I would like to see is that when you click on a marker an info window opens and gives you a textbox to enter the html that you want to have appear in the info window when clicked and gives you a drop down menu of icons you can change it to. I would also like to add some more editing features for lines (remove last point, change color, change thickness, change opacity). None of this is that difficult to do, would just take a little bit of time...
Comment #2
mango commentedI have studied the documentation page you refer to (http://webgeer.com/gmapdemo) before submitting my request. Unfortunately, there is no mention of expanding markers by default. I cannot find information about the parser either, so my options to investigate this issue end there.
Comment #3
webgeer commentedI'm not sure what you mean by "expanding markers".
If you mean opening an info window, then it can be seen on that page. click on marker to see what is in a window and then look at the macro that was created to see how that was inserted. This is referred to as a "text popup" on that page. If you mean the ability to have the info window opened automatically when the page is opened without clicking, that does not exist. It could be done, but I'm not sure what the best way of adding that to the macro is.
Comment #4
mango commentedThat is what I meant: to have certain "text popups" open (or popup) by default. For example, on page http://webgeer.com/gmapdemo, if you click on marker number 1 the text popup shows "Kits pool". I would like to set up a gmap so that the text popup is displayed by default for particular markers of my choice.
Comment #5
webgeer commentedAny thoughts on how you think it should work from a user perspective?
I will add this ability for the associative array. I think it could also be added for the macro, but I'm not sure what would be the best way of doing it. One idea I have if the text starts with a "*" then it will do that as an open window. However, if you have any other ideas on ways to do it I could consider that too.
Comment #6
Joe D commentedIs there a way to control the size of the text box popup for a marker and/or the position where it pops up relative to the marker?
I want to make the box smaller and have it pop up below the marker.
Thanks
Comment #7
webgeer commentedThe size of the marker can be set be setting the width for the style .gmap-popup. You can edit the gmap.css file to do this. However, this only lets you set one width for all of the pop-up windows. Alternatively, if you are writing a module or creating the associative array some other way, you can set the width by defining the marker item map[markers][]['win-width']='200px'
I know of no way of making Google open the window below the marker. I think that it may be possible with a third party script, but I would prefer to keep as much of the code using the Google API as possible.
Both of these concepts are too complicated to ever be included as part of the macro.
Comment #8
bdragon commentedI'm working on closing bugs at the moment.
In any case, the 5.x version has had "expand by default" capability for a while now, but it wasn't exposed to the macro. I just (as of about a minute ago) extended the macro syntax like so (wait for the next snapshot or try latest DRUPAL-5 from CVS to experiment with it:)
After the coordinates of a marker and before the optional :, you can put tokens in. Currently the only one supported is "autoclick", which will make a marker act like it was clicked as soon as the map loads.
Comment #9
(not verified) commentedComment #10
afagioliif you're on dr5, try
Comment #11
dwatts3624 commentedaugustofagioli, I am getting better at Drupal but still am very new to overriding variables.
Would you be able to lend any advice on where to set that? Would I make a custom module or add it into the template.php file?
Really, all I'm trying to do it get the info window to autoclick on a CCK location field. I can set my macro in the field settings; however, bdragon's solution doesn't seem to work because the lat & long is set by the field not the macro.
Any ideas?
I've also tried using JS to manually make this happen.
Comment #12
skh commentedI too needed the info window of the first result to auto-open. After some digging, found a couple of ways to do it.
#1: function template_preprocess_gmap_view_gmap in gmap.views.inc
Override in your template.php, and:
Drawbacks: ends up building the map element twice.
#2: function theme_gmap($element) in gmap.module
Override in your template.php, and
Drawbacks: requires an identical theme_gmap function with one line change. I guess you could call theme_gmap directly instead.
Note: ['markers'][0] is the first result, you could set any of them to open automatically.
Comment #13
kevinchampion commentedIf you build the map using a map array, which you can then plug into theme_gmap, you simply set the 'options' parameter of the marker whose info window you'd like to be automatically opened to contain the property 'autoclick' => true. It looks something like this:
Comment #14
summit commentedI do not think this is fixed, because it is not module based possible. I set it to active again if thats ok.
If I am incorrect in this, I apologize.
For D7 there is this issue, may be this is the solution?
http://drupal.org/node/1377908
greetings, Martijn
Comment #15
coderider commentedi find a way to set gmap marker on autoclick i am useing this template function at my project site it works fine
copy hole function theme_gmap from gmap.module line/935 and past in to you template.php
rename it THEME_gmap.
and add this line
$map['markers'][0]['autoclick'] = TRUE;just after this line
hole edited function check below
just copy and past and rename to your theme
hope now this issue is fixed
coderider
Comment #17
jordan8037310 commentedThanks for this Coderider! Really helps. Just wondering, but did you happen to know of a way to center the map based on the fact that the info window is now displayed?
Usually when you "click" on a location and get the info window, the viewing area automatically moves to include the window. My view is a bit limited in height, but I was wondering if you had to deal with this as well.