I''d like to add an event listener for dragging markers, but it looks
like YM4R GM (and Mapstraction) doesn''t support this. I need an init
like:
marker = new GMarker(...
GEvent.addListener(marker, "dragend", function() { })
but the current setup makes "anonymous" markers - never creates
variable
that can be used to access them. Has anyone thought about this?
Perhaps we can add a "varname" attribute to the overlays to allow
further use of them?
The follow adds support to make draggable markers (though you can''t
really use them until the above is addressed).
Index: lib/gm_plugin/overlay.rb
==================================================================---
lib/gm_plugin/overlay.rb (revision 97)
+++ lib/gm_plugin/overlay.rb (working copy)
@@ -25,11 +25,13 @@
end
#Creates a marker: If an info_window or info_window_tabs is
present, the response to the click action from the user is setup here.
def create
- if @options.empty?
- creation = "new
GMarker(#{MappingObject.javascriptify_variable(@point)})"
- else
- creation = "new
GMarker(#{MappingObject.javascriptify_variable(@point)},#{MappingObject.javascriptify_variable(@options)})"
+ creation = "new
GMarker(#{MappingObject.javascriptify_variable(@point)}"
+ if @options
+ creation +=
",#{MappingObject.javascriptify_variable(@options)}"
end
+ if @draggable
+ creation +=
",#{MappingObject.javascriptify_variable(@options)}"
+ end
if @info_window && @info_window.is_a?(String)
creation =
"addInfoWindowToMarker(#{creation},#{MappingObject.javascriptify_variable(@info_window)},#{MappingObject.javascriptify_variable(@info_window_options)})"
elsif @info_window_tabs && @info_window_tabs.is_a?(Hash)
--
Orion Poplawski
Technical Manager 303-415-9701 x222
NWRA/CoRA Division FAX: 303-415-9702
3380 Mitchell Lane orion at cora.nwra.com
Boulder, CO 80301 http://www.cora.nwra.com