Sha256: b72e9b8fdbe0fa2a45a920e072f129f1fe7c0d0c6e465acdfe81ac9dcae5b4cd

Contents?: true

Size: 820 Bytes

Versions: 6

Compression:

Stored size: 820 Bytes

Contents

ADF.Overlay.Views.New ||= {}

class ADF.Overlay.Views.New.Default extends ADF.GMap.Views.OverlayView 
  
  hidden: false
  draggable: true
  clickEvent: null
  
  constructor: (options) ->
    super(options)
    @clickableArea = if options.area then options.area else @map.getGMap()
    @initOverlay()

  initOverlay: () ->
    if not @overlay 
      if @point && @point.lat() > 0 && @point.lng() > 0
        @pushOverlay()
      else
        @bindMap()
    else
      @overlay.view = @
      @redraw()

  bindMap: () ->
    @clickEvent = google.maps.event.addListener @clickableArea, 'click', @onClicked unless @clickEvent?
    
  unbindMap: () ->
    google.maps.event.removeListener(@clickEvent) if @clickEvent?
    @clickEvent = null
    
  onClicked: (e) =>
    @point = e.latLng
    @unbindMap()
    @pushOverlay()

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
socmap_adf-1.0.0 lib/assets/javascripts/socmap_adf/modules/overlay/views/new/overlay.js.coffee
socmap_adf-0.0.11 lib/assets/javascripts/socmap_adf/modules/overlay/views/new/overlay.js.coffee
socmap_adf-0.0.10 lib/assets/javascripts/socmap_adf/modules/overlay/views/new/overlay.js.coffee
socmap_adf-0.0.9 lib/assets/javascripts/socmap_adf/modules/overlay/views/new/overlay.js.coffee
socmap_adf-0.0.8 lib/assets/javascripts/socmap_adf/modules/overlay/views/new/overlay.js.coffee
socmap_adf-0.0.7 lib/assets/javascripts/socmap_adf/modules/overlay/views/new/overlay.js.coffee