Sha256: 2322cc87ec2a402b340bb8c5cfa9bb5ed198457be27b7db8a5402324bac80b77

Contents?: true

Size: 705 Bytes

Versions: 1

Compression:

Stored size: 705 Bytes

Contents

@Gmaps4Rails.PolygonController =

  #polygons is an array of arrays. It loops.
  addPolygons: (polygonData)->
    for polygonArgs in polygonData
      @polygons.push @createPolygon(polygonArgs)

  replacePolygons : (polylineData) ->
    #reset previous polylines and kill them from map
    @clearPolygons()
    #set new polylines
    @addPolygons(polylineData)
    #.... and adjust map boundaries
    @adjustMapToBounds()

  clearPolygons : ->
    for polygon in @polygons
      #delete polylines from map
      polygon.clear()
    #empty array
    @polygons = []

  showPolygons : ->
    for polygon in @polygons
      polygon.show()

  hidePolygons : ->
    for polygon in @polygons
      polygon.hide()

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gmaps4rails-2.0.0.pre vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/polygon_controller.coffee