summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models/wall.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/rectangles/models/wall.js')
-rw-r--r--public/assets/javascripts/rectangles/models/wall.js70
1 files changed, 37 insertions, 33 deletions
diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js
index 8723c3c..1dd0ebf 100644
--- a/public/assets/javascripts/rectangles/models/wall.js
+++ b/public/assets/javascripts/rectangles/models/wall.js
@@ -82,7 +82,16 @@
}
})
})
- this.outline()
+
+ // flip the mx order
+ var shouldFlip = this.side & (LEFT | BACK)
+ if (! shouldFlip) {
+ this.mx.reverse()
+ }
+
+ var wallColor = "rgba(255,255,255,0.95)"
+ var outlineColor = "rgba(0,0,0,1.0)"
+ this.outline(wallColor, outlineColor)
}
@@ -207,44 +216,39 @@
})
}
- Wall.prototype.outline = function(){
+ Wall.prototype.outline = function(wallColor, outlineColor){
var useX = this.side & FRONT_BACK
- var shouldFlip = this.side & (LEFT | BACK)
var mx = this.mx
- if (! shouldFlip) {
- mx = mx.reverse()
- }
-
var len = this.mx.length
-
- var backgroundColor = "rgba(255,255,255,0.95)"
- var borderColor = "rgba(0,0,0,1.0)"
-
- zz = window.zz || 0
+ var outlineString = "1px solid " + outlineColor
+ zz = 0
mx.forEach(function(mx, i){
- if (mx.outlined) return
- mx.outlined = true
- mx.el.style.backgroundColor = backgroundColor
-
- // all walls get bottom lines
- mx.el.style.borderBottom = "1px solid " + borderColor
-
- // all walls get top lines
- mx.el.style.borderTop = "1px solid " + borderColor
-
- // walls on initial sides get left lines
- // if their left edge lines up with the rect edge
- if (i == 0) {
- mx.el.style.borderLeft = "1px solid " + borderColor
- }
-
- // walls on terminal sides get right lines....
- // if their right edge lines up with the rect edge
- if (i == len-1) {
- mx.el.style.borderRight = "1px solid " + borderColor
- }
+ // if (mx.outlined) return
+ // mx.outlined = true
+ if (wallColor) {
+ mx.el.style.backgroundColor = wallColor
+ }
+ if (outlineColor) {
+ // all walls get bottom lines
+ mx.el.style.borderBottom = outlineString
+
+ // all walls get top lines
+ mx.el.style.borderTop = outlineString
+
+ // walls on initial sides get left lines
+ // if their left edge lines up with the rect edge
+ if (i == 0) {
+ mx.el.style.borderLeft = outlineString
+ }
+
+ // walls on terminal sides get right lines....
+ // if their right edge lines up with the rect edge
+ if (i == len-1) {
+ mx.el.style.borderRight = outlineString
+ }
+ }
})
}