From c780419e05bddf80b09e3091634361f289666f35 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 18 Apr 2014 14:42:01 -0400 Subject: camera cursor --- assets/javascripts/rectangles/map/draw.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'assets/javascripts/rectangles/map/draw.js') diff --git a/assets/javascripts/rectangles/map/draw.js b/assets/javascripts/rectangles/map/draw.js index 1dcd1ae..1fca4b9 100644 --- a/assets/javascripts/rectangles/map/draw.js +++ b/assets/javascripts/rectangles/map/draw.js @@ -44,6 +44,29 @@ map.draw = new function(){ } } } + + base.camera = function(cam){ + ctx.lineWidth = 0.5 + + ctx.save() + + ctx.translate(cam.x, cam.z) + ctx.rotate(cam.rotationY) + + var radius = 3 / map.zoom + + ctx.fillStyle = '#888'; + + ctx.beginPath(); + ctx.moveTo(0,0) + ctx.lineTo(-radius,-radius/2) + ctx.lineTo(0,radius*3) + ctx.lineTo(radius,-radius/2) + ctx.moveTo(0,0) + ctx.fill() + + ctx.restore() + } // -- cgit v1.2.3-70-g09d2