summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles/draw.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-04-17 02:32:53 -0400
committerJulie Lala <jules@okfoc.us>2014-04-17 02:32:53 -0400
commit1af8f41cc88e3c57bfabe6d4a5dcd83fc4a0e1bc (patch)
treee10fd06cd40c21a7375f626ac130b438613b8abe /assets/javascripts/rectangles/draw.js
parent3b7c327b6502ef6e510a0a0e77c6b6facf0be723 (diff)
further code bath, fix minimap orientation/translation
Diffstat (limited to 'assets/javascripts/rectangles/draw.js')
-rw-r--r--assets/javascripts/rectangles/draw.js66
1 files changed, 0 insertions, 66 deletions
diff --git a/assets/javascripts/rectangles/draw.js b/assets/javascripts/rectangles/draw.js
deleted file mode 100644
index eb3dece..0000000
--- a/assets/javascripts/rectangles/draw.js
+++ /dev/null
@@ -1,66 +0,0 @@
-function clear_canvas(){
- ctx.fillStyle = "rgba(255,255,255,0.7)"
- ctx.clearRect(0,0,w,h)
- ctx.fillRect(0,0,w,h)
-}
-function draw_ruler(){
- ctx.strokeStyle = "rgba(80,80,80,0.5)"
- ctx.lineWidth = 1
- var len = 5
- for (var i = 0.5; i < w; i += 10) {
- line(i, 0, i, len)
- line(0, i, len, i)
- }
-}
-function line (x,y,a,b,translation){
- if (translation) {
- x += translation.a
- a += translation.a
- y += translation.b
- b += translation.b
- }
- ctx.beginPath()
- ctx.moveTo(x,y)
- ctx.lineTo(a,b)
- ctx.stroke()
-}
-function draw_regions(regions){
- for (var i = 0; i < regions.length; i++) {
- if (regions[i].dupe) continue
- ctx.fillStyle = colors[i % colors.length]
- fill_region(regions[i])
- stroke_sides(regions[i])
- }
-}
-function draw_mouse(mouse){
- 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.fill();
-
- if (mouse.width() != 0 && mouse.height() != 0) {
- if (clipper.dragging) {
- stroke_rect(mouse)
- }
- else {
- ctx.fillStyle = "rgba(255,255,0,0.5)"
- fill_region( mouse.clone().translate() )
- }
- }
-}
-
-function fill_region(r){
- ctx.fillRect(r.x.a + r.translation.a,
- r.y.a + r.translation.b,
- r.x.length(),
- r.y.length())
-}
-function stroke_sides (r){
- if (r.sides & FRONT) line(r.x.a, r.y.a, r.x.b, r.y.a)
- if (r.sides & BACK) line(r.x.a, r.y.b, r.x.b, r.y.b)
- if (r.sides & LEFT) line(r.x.a, r.y.a, r.x.a, r.y.b)
- if (r.sides & RIGHT) line(r.x.b, r.y.a, r.x.b, r.y.b)
-}
-function stroke_rect (r){
- line(r.x.a, r.y.a, r.x.b, r.y.b, r.translation)
-}