Sha256: c20d01ddbe7a8167f9a01bf22b9d34ea801809df4f251f35975bf0bfac2a3817

Contents?: true

Size: 1.3 KB

Versions: 8

Compression:

Stored size: 1.3 KB

Contents

@Gmaps.Google.Primitives = ->
  factory = {
    point:        google.maps.Point
    size:         google.maps.Size
    circle:       google.maps.Circle
    latLng:       google.maps.LatLng
    latLngBounds: google.maps.LatLngBounds
    map:          google.maps.Map
    mapTypez:     google.maps.MapTypeId
    markerImage:  google.maps.MarkerImage
    marker:       google.maps.Marker
    infowindow:   google.maps.InfoWindow
    listener:     google.maps.event.addListener
    clusterer:    MarkerClusterer
    listenerOnce: google.maps.event.addListenerOnce
    polyline:     google.maps.Polyline
    polygon:      google.maps.Polygon
    kml:          google.maps.KmlLayer

    addListener: (object, event_name, fn)->
      factory.listener object, event_name, fn

    addListenerOnce: (object, event_name, fn)->
      factory.listenerOnce object, event_name, fn

    mapTypes: (type)->
      factory.mapTypez[type]

    # position can be:
    # - [ lat, lng]
    # - { lat: , lng: }
    # - a google.maps.LatLng
    latLngFromPosition: (position)->
      if _.isArray(position)
        return new factory.latLng(position[0], position[1])
      else
        if _.isNumber(position.lat) and _.isNumber(position.lng)
          return new factory.latLng(position.lat, position.lng)
        else
          position
  }

  factory

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gmaps4rails-2.1.1 vendor/assets/javascripts/gmaps/google/primitives.coffee
gmaps4rails-2.1.0 vendor/assets/javascripts/gmaps/google/primitives.coffee
gmaps4rails-2.0.5 vendor/assets/javascripts/gmaps/google/primitives.coffee
gmaps4rails-2.0.4 vendor/assets/javascripts/gmaps/google/primitives.coffee
gmaps4rails-2.0.3 vendor/assets/javascripts/gmaps/google/primitives.coffee
gmaps4rails-2.0.2 vendor/assets/javascripts/gmaps/google/primitives.coffee
gmaps4rails-2.0.1 vendor/assets/javascripts/gmaps/google/primitives.coffee
gmaps4rails-2.0.0 vendor/assets/javascripts/gmaps/google/primitives.coffee