Sha256: 19fafc97b7f0705bb84cb70d332753cab86b206cca324de75339a8be585a7162

Contents?: true

Size: 1.17 KB

Versions: 12

Compression:

Stored size: 1.17 KB

Contents

class ADF.Minimap.Views.Tooltip extends ADF.MVC.Views.Base
  
  template: JST['socmap_adf/modules/minimap/templates/tooltip']
  
  offset_left: 5
  offset_top: 0
  text: ""
  active: false
  
  initialize: =>
    @map = @options.map
    @containerArea = @options.containerArea
  
  render: () ->
    newElement = @make("div", {"class": "show_tip", "id" : "minimap_ballon", "style" : "display:none;position:absolute;"} )
    @setElement( newElement )
    @$el.html( @template )
    @

  setInactive: () ->
    @active = false
    $(@containerArea).unbind "mouseover"
    $(@containerArea).unbind "mouseout"
    $(@containerArea).unbind "mousemove"
    @hide()
    
  show: (e) =>
    @move(e)
    @$el.show()

  hide: (e) =>
    @$el.hide()

  move: (e) =>
    parentOffset = @$el.parent().offset()
    left = e.pageX - parentOffset.left + @offset_left
    top = e.pageY - parentOffset.top + @offset_top
    @$el.css("top", top+"px").css("left", left+"px")

  setText: ( text ) ->
    if not @active
      @active = true
      $(@containerArea).bind "mouseover", @show
      $(@containerArea).bind "mouseleave", @hide
      $(@containerArea).bind "mousemove", @move
    
    @$("span").html(text)

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
socmap_adf-1.0.0 lib/assets/javascripts/socmap_adf/modules/minimap/views/tooltip.js.coffee
socmap_adf-0.0.11 lib/assets/javascripts/socmap_adf/modules/minimap/views/tooltip.js.coffee
socmap_adf-0.0.10 lib/assets/javascripts/socmap_adf/modules/minimap/views/tooltip.js.coffee
socmap_adf-0.0.9 lib/assets/javascripts/socmap_adf/modules/minimap/views/tooltip.js.coffee
socmap_adf-0.0.8 lib/assets/javascripts/socmap_adf/modules/minimap/views/tooltip.js.coffee
socmap_adf-0.0.7 lib/assets/javascripts/socmap_adf/modules/minimap/views/tooltip.js.coffee
socmap_adf-0.0.6 lib/assets/javascripts/socmap_adf/modules/minimap/views/tooltip.js.coffee
socmap_adf-0.0.5 lib/assets/javascripts/socmap_adf/modules/minimap/views/tooltip.js.coffee
socmap_adf-0.0.4 lib/assets/javascripts/socmap_adf/modules/minimap/views/tooltip.js.coffee
socmap_adf-0.0.3 lib/assets/javascripts/socmap_adf/modules/minimap/views/tooltip.js.coffee
socmap_adf-0.0.2 lib/assets/javascripts/socmap_adf/modules/minimap/views/tooltip.js.coffee
socmap_adf-0.0.1 lib/assets/javascripts/socmap_adf/modules/minimap/views/tooltip.js.coffee