only a small patch which explains the basic usage of js handlers to extend gmap

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review

needs review

topwaters’s picture

Could you PLEASE show a working example of this as it would be written in the context of a js include. I tried this and it didn't work. I really need to access the map from some custom javascript to make my project work as I am using JSON to automatically update the map with waypoints and track data based on where the user zooms or pans.

Please please please release some more documentation on GMaps custom event handling system!

Thanks for your work.

dawehner’s picture

// Add a gmap handler
Drupal.gmap.addHandler('gmap', function(elem) {
  var obj = this;
  obj.bind('zoom', function() {
    var zoom = obj.vars.zoom;
    alert('user zoomed');
  }
}

This is just a short example, you can figure out more how it works to write documentation here.

topwaters’s picture

Thanks very much.

It looks like I was having trouble because I assumed that I could put an id other than 'gmap' in the " ...addHandler('gmap', "... portion, so the handler would be specific to a particular map. With the above, it doesn't seem to matter what id you have for your map, the event will apply to it...

How would I assign specific handlers to different maps on the same page? If I have a map with the id of map2 for example, how would I assign functions specific to it?

Thanks for your time.

Cheers

topwaters’s picture

Could someone please show me how you use the marker.js or gmap_marker.js to add markers, polylines or polygons from an external javascript file? I'm not sure if these files define the functions/classes/objects to be used in javascript includes or whether they are examples of code... I have tried to figure it out but simply need help. I need to load markers and polylines on the fly with AJAX (JSON) from a database. I have accomplished this with the regular Google code but am wanting to integrate it with Drupal and GMap.

If there's a better place for me to post these questions, please let me know.

Thanks in advance for any help :)

podarok’s picture

Version: 6.x-1.0 » 7.x-1.x-dev
Status: Needs review » Needs work

all feature requests can be imported in 6.x version after committing em in major versions with backport afterwards
Can You make this ?

kevinquillen’s picture

Issue summary: View changes

All you get from this example is 'addHandler' is undefined.

HOG’s picture

Assigned: Unassigned » HOG
HOG’s picture

Status: Needs work » Needs review
FileSize
4.98 KB

Fix example in documentation.
In patch also fix this isue: #463356

Status: Needs review » Needs work

The last submitted patch, 9: gmap_docu_348804_9.patch, failed testing.

HOG’s picture

Status: Needs work » Needs review
FileSize
4.96 KB

Fix patch file.

Status: Needs review » Needs work

The last submitted patch, 11: gmap_docu_348804_11.patch, failed testing.

HOG’s picture

Status: Needs work » Needs review
FileSize
754 bytes

Fix patch file syntax.

  • podarok committed ad4ea53 on 7.x-2.x authored by HOG
    Issue #348804 by HOG, dawehner: Added JS handler documentation start.
    
podarok’s picture

Status: Needs review » Fixed

#13 commited
Thanks!

Status: Fixed » Closed (fixed)

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