diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-04-18 17:39:14 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-04-18 17:39:14 -0400 |
| commit | 0a7a3a60b15d9bd6cdb9e7f153eb93f6686b8c37 (patch) | |
| tree | c9edf2d9df722b27f06f349fecca10ca623872bc /assets/javascripts/rectangles/map/draw.js | |
| parent | c780419e05bddf80b09e3091634361f289666f35 (diff) | |
scaling issue gotta fix
Diffstat (limited to 'assets/javascripts/rectangles/map/draw.js')
| -rw-r--r-- | assets/javascripts/rectangles/map/draw.js | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/assets/javascripts/rectangles/map/draw.js b/assets/javascripts/rectangles/map/draw.js index 1fca4b9..e15b083 100644 --- a/assets/javascripts/rectangles/map/draw.js +++ b/assets/javascripts/rectangles/map/draw.js @@ -3,6 +3,27 @@ map.draw = new function(){ var base = this + base.animate = function(){ + ctx.save() + map.draw.clear_canvas() + map.draw.ruler() + +// ctx.scale( map.zoom, map.zoom ) +// ctx.translate( map.center.a + map.bounds.a/2, map.center.b + map.bounds.b/2 ) +// ctx.scale( -1, 1 ) + + ctx.translate( map.center.a, map.center.b ) + ctx.translate( +map.bounds.a/2, +map.bounds.b/2 ) + ctx.scale( map.zoom, map.zoom ) + ctx.scale( -1, 1 ) + + map.draw.regions(clipper.regions) + map.draw.mouse(map.ui.mouse.cursor) + scene && map.draw.camera(scene.camera) + + ctx.restore() + } + base.clear_canvas = function (){ ctx.fillStyle = "rgba(255,255,255,0.99)" ctx.clearRect(0,0,w,h) @@ -29,9 +50,11 @@ map.draw = new function(){ } base.mouse = function(mouse){ + var radius = 5 / map.zoom + ctx.fillStyle = "rgba(255,0,0,0.4)"; ctx.beginPath(); - ctx.arc(mouse.x.b, mouse.y.b, 5, 0, 2*Math.PI, false); + ctx.arc(mouse.x.b, mouse.y.b, radius, 0, 2*Math.PI, false); ctx.fill(); if (mouse.width() != 0 && mouse.height() != 0) { |
