diff options
| author | Julie Lala <jules@okfoc.us> | 2014-10-14 10:45:25 -0400 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2014-10-14 10:45:25 -0400 |
| commit | 3cb1983858c1314661592fa78c814eed44acb1b7 (patch) | |
| tree | ac68510745ca98500f0bb427ea3c5d1abafb2d2e /public/assets/javascripts/ui/builder/BuilderInfo.js | |
| parent | 40c85ef5f19139ae5b2cf3e3c0f4878f7acaeae4 (diff) | |
| parent | 10a98d58fcba585dc13d251497c6028d04de0031 (diff) | |
Merge branch 'master' of github.com:okfocus/vvalls
Diffstat (limited to 'public/assets/javascripts/ui/builder/BuilderInfo.js')
| -rw-r--r-- | public/assets/javascripts/ui/builder/BuilderInfo.js | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/public/assets/javascripts/ui/builder/BuilderInfo.js b/public/assets/javascripts/ui/builder/BuilderInfo.js index 0bf2338..196eca6 100644 --- a/public/assets/javascripts/ui/builder/BuilderInfo.js +++ b/public/assets/javascripts/ui/builder/BuilderInfo.js @@ -13,6 +13,7 @@ var BuilderInfo = View.extend({ "change [name=units]": 'changeUnits', "change [name=resolution]": 'changeResolution', "change [name=viewHeight]": 'changeViewHeight', + "click [data-role=destroy-room]": 'destroy', }, initialize: function(opt){ @@ -25,8 +26,11 @@ var BuilderInfo = View.extend({ this.$units = this.$("[name=units]") this.$viewHeight = this.$("[name=viewHeight]") this.$unitName = this.$(".unitName") + this.$noSelection = this.$(".no-selection") + this.$settings = this.$(".setting") app.on("builder-pick-room", this.pick.bind(this)) - app.on("builder-destroy-room", this.destroy.bind(this)) + app.on("builder-destroy-room", this.hide.bind(this)) + app.on("builder-pick-nothing", this.deselect.bind(this)) }, load: function(data){ @@ -36,6 +40,8 @@ var BuilderInfo = View.extend({ }, toggle: function(state){ + this.$settings.toggle( !! this.room ) + this.$noSelection.toggle( ! this.room ) this.$el.toggleClass("active", state) }, @@ -43,7 +49,8 @@ var BuilderInfo = View.extend({ this.toggle(true) }, - hide: function(){ + hide: function(){ + this.room = null this.toggle(false) }, @@ -58,8 +65,22 @@ var BuilderInfo = View.extend({ this.$y.unitVal( room.rect.y.a ) this.show() }, + + deselect: function(){ + this.room = null + this.toggle(true) + }, + + destroy: function(){ + UndoStack.push({ + type: "destroy-room", + undo: this.room.copy(), + redo: { id: this.room.id }, + }) + + Rooms.remove(this.room) + app.tube("builder-destroy-room", this.room) - destroy: function(room){ this.room = null this.hide() }, |
