Last active
December 18, 2015 09:19
-
-
Save derekblank/5760586 to your computer and use it in GitHub Desktop.
Initialize constructor and init functions for map.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WorldMap | |
constructor: -> | |
@baseColor = '#f5f3e6' # set the base fill color of the vector shapes | |
@hoverColor = '#053a5a' # set hover color | |
@R = Raphael('map', 960, 543) # create the canvas element #map and define dimensions | |
@defaultAttr = | |
fill: @baseColor # define default attributes for all paths | |
@init() | |
init: => | |
# initialize array (path data is loaded in separate file) | |
worldRaphael = {} | |
# draw region paths | |
for region of world | |
worldRaphael[region] = @R.path(world[region].path) | |
.attr(@defaultAttr) # apply default transformations |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment