From e44f2ae20b96a6d5692bab56cab7452f6ad3d804 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 22 Apr 2014 13:06:27 -0400 Subject: grid that is actually quantized --- assets/javascripts/rectangles/map/draw.js | 12 ++++++++++++ 1 file changed, 12 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 cfa99d4..57faa10 100644 --- a/assets/javascripts/rectangles/map/draw.js +++ b/assets/javascripts/rectangles/map/draw.js @@ -100,6 +100,18 @@ map.draw = new function(){ ctx.fillStyle = "#eee"; dot_at(300,0) dot_at(0,300) + + ctx.strokeStyle = "rgba(0,0,0,0.1)" + ctx.lineWidth = 1/map.zoom + + var sides = map.sides() + var quant = sides.clone().quantize(200) + for (var x = quant.x.a - 200; x <= quant.x.b; x += 200) { + line(x, sides.y.a, x, sides.y.b) + } + for (var y = quant.y.a - 200; y <= quant.y.b; y += 200) { + line(sides.x.a, y, sides.x.b, y) + } } // -- cgit v1.2.3-70-g09d2