Created
June 30, 2011 14:55
-
-
Save wyattdanger/1056396 to your computer and use it in GitHub Desktop.
playing with canvas to draw map
This file contains hidden or 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
(function () { | |
// MC Namespace | |
var MC = { | |
Map: function () {}, | |
Marker: function () {} | |
}; | |
// MC Map | |
MC.Map.prototype = { | |
init: function () { | |
this.drawMap(); | |
}, | |
drawMap: function (id) { | |
var canvas = document.getElementById('map'), | |
ctx = canvas.getContext('2d'), | |
map = new Image(); | |
canvas.setAttribute('width', 930); | |
canvas.setAttribute('height', 475); | |
map.onload = function(){ | |
ctx.drawImage(map, 0, 0); | |
}; | |
map.src = '/images/map.png'; | |
} | |
}; | |
// MC Marker | |
MC.Marker.prototype = { | |
init: function () { | |
console.log('initialized'); | |
} | |
}; | |
// jQuery DOMReady Initializer | |
$(function () { | |
var map = new MC.Map(); | |
map.init(); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment