app/assets/javascripts/tenon/features/tenon_content/image_controls.js.coffee in tenon-1.0.8 vs app/assets/javascripts/tenon/features/tenon_content/image_controls.js.coffee in tenon-1.0.9
- old
+ new
@@ -6,29 +6,36 @@
toggleControls: (e) =>
@hideControls()
@_buildControls(e)
e.stopImmediatePropagation()
+ showControls: (x, y) =>
+ x ||= @previousX
+ y ||= @previousY
+ @$controls.appendTo('body').css
+ left: @_leftOffset(x)
+ top: y + 'px'
+ display: 'block'
+
+ @previousX = x
+ @previousY = y
+
hideControls: =>
$('body > .image-controls').hide()
$('.tooltip').remove()
_removeControls: =>
$('body > .image-controls').remove()
+ delete Tenon.activeImageControls
_buildControls: (e) =>
@_removeControls()
+ Tenon.activeImageControls = this
$img = $(e.currentTarget)
@$image = $img.closest('.image')
@$controls = @$image.find('.image-controls').clone()
@_tagControls()
- @_showControls(e.pageX, e.pageY)
-
- _showControls: (left, top) =>
- @$controls.appendTo('body').css
- left: @_leftOffset(left)
- top: top + 'px'
- display: 'block'
+ @showControls(e.pageX, e.pageY)
_tagControls: =>
# Add some data for use in operations
@$controls.data('image', @$image)
@$controls.find('.replace-image')
\ No newline at end of file