diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-04-16 15:08:44 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-04-16 15:08:44 -0400 |
| commit | 3412cc42a9fa5e42d47073a2fa05a39712ad40f7 (patch) | |
| tree | 016356ab239e51b1948ee2e2252bc847e13b17ba /assets/javascripts/rectangles/rect.js | |
| parent | e50348e6d5af52d0fcc51d0ca30e21594aee6cbf (diff) | |
layer of indirection for rooms
Diffstat (limited to 'assets/javascripts/rectangles/rect.js')
| -rw-r--r-- | assets/javascripts/rectangles/rect.js | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/assets/javascripts/rectangles/rect.js b/assets/javascripts/rectangles/rect.js index 1d402cd..50debbc 100644 --- a/assets/javascripts/rectangles/rect.js +++ b/assets/javascripts/rectangles/rect.js @@ -16,8 +16,6 @@ window.rect = (function(){ } this.translation = new vec2(0,0) this.sides = FRONT | BACK | LEFT | RIGHT - this.focused = false - this.id = 0 } rect.prototype.clone = function(){ return new rect( this.x.clone(), this.y.clone() ) @@ -48,35 +46,13 @@ window.rect = (function(){ if (this.sides & BACK) sides += "back " if (this.sides & LEFT) sides += "left " if (this.sides & RIGHT) sides += "right " - var s = this.id + " " + "[" + this.x.toString() + " " + this.y.toString() + "] " + sides - if (this.focused) return "<b>" + s + "</b>" + var s = "[" + this.x.toString() + " " + this.y.toString() + "] " + sides return s } rect.prototype.quantize = function(n){ this.x.quantize(n) this.y.quantize(n) } - rect.prototype.reset = function(){ - var copy = this.clone() - copy.sides = FRONT | BACK | LEFT | RIGHT - copy.focused = this.focused - copy.id = this.id - this.regions = [ copy ] - } - rect.prototype.clipTo = function(r){ - // for each of this rect's regions split the region if necessary - var regions = this.regions - var splits - - for (var i = 0, len = regions.length; i < len; i++) { - if (regions[i] && regions[i].intersects(r)) { - splits = regions[i].split(r) - regions = regions.concat(splits) - regions[i] = null - } - } - this.regions = regions - } rect.prototype.split = function(r){ var rz = this var splits = [] |
