diff options
| author | Julie Lala <jules@okfoc.us> | 2014-06-10 19:46:53 -0400 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2014-06-10 19:46:53 -0400 |
| commit | 4e4b5b5668835097f335efaf55dfe837eec7dc3c (patch) | |
| tree | 5cd6cb12a203c5dd7c8cf9f62b9cd9235e52513c /public/assets/javascripts/rectangles/models/room.js | |
| parent | 3074488306e041718dec221ff9142748e2e68916 (diff) | |
| parent | b231af3e38b8f066f18031fd69b0fdb30a5e244a (diff) | |
Merge branch 'master' of github.com:okfocus/vvalls
Diffstat (limited to 'public/assets/javascripts/rectangles/models/room.js')
| -rw-r--r-- | public/assets/javascripts/rectangles/models/room.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/public/assets/javascripts/rectangles/models/room.js b/public/assets/javascripts/rectangles/models/room.js index 731411c..d0478b3 100644 --- a/public/assets/javascripts/rectangles/models/room.js +++ b/public/assets/javascripts/rectangles/models/room.js @@ -1,7 +1,7 @@ window.Room = (function(){ var Room = function(opt){ - this.id = opt.id || Rooms.list.length + this.id = opt.id || Rooms.uid("room_") this.rect = opt.rect this.regions = [] this.walls = [] @@ -15,7 +15,15 @@ window.Room = (function(){ Room.prototype.toString = function(){ return this.rect.toString() } - + + Room.prototype.serialize = function(){ + return { + id: this.id, + rect: this.rect.serialize(), + height: ~~this.height, + } + } + Room.prototype.reset = function(){ var copy = this.rect.clone() copy.id = this.id |
