Skip to content

Instantly share code, notes, and snippets.

@renaehodgkins
Created August 3, 2012 14:45
Show Gist options
  • Save renaehodgkins/3248289 to your computer and use it in GitHub Desktop.
Save renaehodgkins/3248289 to your computer and use it in GitHub Desktop.
bindHoverToCountry: (paper, country_iso_code, path)->
that = this
path.hover(
(e)->
# when mouse hover the country, we build fill the country path with highlight color and display a tooltip around the mouse position
name = that.worldmap.names[country_iso_code]
desc = "#{that.data[name]} %"
this.tipSet = that.drawCountryTooltip(paper, e.offsetX, e.offsetY, name, desc)
this.c = this.c || this.attr("fill")
this.stop().animate({fill: "#C13A27"}, 500)
(e)->
this.tipSet.remove()
this.stop().animate({fill: this.c}, 500)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment