0

I'm using gmaps4rails V2 and and I'm not able to retrieve the markers position.

I have my array of Markers:

markers = handler.addMarkers(<%=raw @hash.to_json %>);

I want to iterate over it and delete the marker out of my map bounds

$.each markers, ->       
  pos = this.getPosition
  if !bounds.contains pos  
    handler.removeMarker this

This is my console output:

Uncaught TypeError: Object #<Marker> has no method 'getPosition' 

Am I missing something?

4

1 回答 1

0

gem 创建的标记是您可以在其上创建一些方法的代理。

要访问 google 对象,请执行以下操作:

 this.getServiceObject()

然后:

 this.getServiceObject().getPosition() // mind the parenthesis!
于 2014-02-08T08:38:41.273 回答