Skip to content

Instantly share code, notes, and snippets.

@lemieux
Created September 25, 2014 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lemieux/9470dcf998bfe90d4a45 to your computer and use it in GitHub Desktop.
Save lemieux/9470dcf998bfe90d4a45 to your computer and use it in GitHub Desktop.
# Public: Show the adder.
#
# Returns nothing.
show: =>
r = this.selectedSkeleton.ranges[0]
normedRange = Range.sniff(r).normalize(this.annotator.element[0])
range = normedRange.toRange()
clientRectangle = range.getBoundingClientRect()
# Position the Adder close to the text if it was hidden
if @element.hasClass('annotator-hide')
@element.hide().css({
top: clientRectangle.top + Util.getGlobal().scrollY - 7,
left: (
clientRectangle.left +
clientRectangle.width / 2 +
Util.getGlobal().scrollX
)
}).show('fast')
else
@element.animate({
top: clientRectangle.top + Util.getGlobal().scrollY - 7,
left: (
clientRectangle.left +
clientRectangle.width / 2 +
Util.getGlobal().scrollX
)
}, 200)
super
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment