Sha256: d0b43fa4befc9b58fa955ddc309e68f62e963983dad38fea043e171689dc233b

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

$ ->
  return unless $("body.controller_user_taggings").length > 0

  if $("body.controller_user_taggings.action_new, body.controller_user_taggings.action_edit").length > 0
    $(".picture").mousemove (event) ->
      position = $(this)[0].getBoundingClientRect()
      picture = $(this)

      picture.data("pos-left", event.clientX - parseInt(position.left))
      picture.data("pos-top", event.clientY - parseInt(position.top))

    $(".picture").click ->
      picture = $(this)

      width = parseInt(picture.data("width"))
      height = parseInt(picture.data("height"))

      left = parseInt(picture.data("pos-left"))
      top = parseInt(picture.data("pos-top"))

      left_percentage = (left / width) * 100
      top_percentage = (top / height) * 100

      $("#user_tagging_position_left").val(left_percentage)
      $("#user_tagging_position_top").val(top_percentage)

      marker = $(".tagging-marker")
      marker_left = left - 50
      marker_top = top - 50
      marker.css({left: marker_left, top: marker_top})

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
family_gallery-0.0.8 app/assets/javascripts/family_gallery/user_taggings.js.coffee
family_gallery-0.0.7 app/assets/javascripts/family_gallery/user_taggings.js.coffee
family_gallery-0.0.6 app/assets/javascripts/family_gallery/user_taggings.js.coffee
family_gallery-0.0.5 app/assets/javascripts/family_gallery/user_taggings.js.coffee
family_gallery-0.0.4 app/assets/javascripts/family_gallery/user_taggings.js.coffee
family_gallery-0.0.3 app/assets/javascripts/family_gallery/user_taggings.js.coffee
family_gallery-0.0.2 app/assets/javascripts/family_gallery/user_taggings.js.coffee
family_gallery-0.0.1 app/assets/javascripts/family_gallery/user_taggings.js.coffee