summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles/map/draw.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/javascripts/rectangles/map/draw.js')
-rw-r--r--assets/javascripts/rectangles/map/draw.js25
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) {