diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-11-13 18:33:39 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-11-13 18:33:39 -0500 |
| commit | bc4517c6b09e03f52161dc38ca591ed0cc227d5d (patch) | |
| tree | 435066ecb54c004a8d4cf9e9f332c2099816fd2f /public/assets/javascripts/ui/builder/BuilderInfo.js | |
| parent | 2017cf240fc1576e81a6fb9a53439f9fe76653e5 (diff) | |
toggle global height
Diffstat (limited to 'public/assets/javascripts/ui/builder/BuilderInfo.js')
| -rw-r--r-- | public/assets/javascripts/ui/builder/BuilderInfo.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/public/assets/javascripts/ui/builder/BuilderInfo.js b/public/assets/javascripts/ui/builder/BuilderInfo.js index 7606361..c25f03c 100644 --- a/public/assets/javascripts/ui/builder/BuilderInfo.js +++ b/public/assets/javascripts/ui/builder/BuilderInfo.js @@ -16,6 +16,7 @@ var BuilderInfo = View.extend({ "change [name=units]": 'changeUnits', "keydown [name=viewHeight]": 'enterViewHeight', "change [name=viewHeight]": 'changeViewHeight', + "change [name=heightGlobal]": 'changeHeightGlobal', "click [data-role=destroy-room]": 'destroy', }, @@ -31,6 +32,7 @@ var BuilderInfo = View.extend({ this.$unitName = this.$(".unitName") this.$noSelection = this.$(".no-selection") this.$settings = this.$(".setting") + this.$heightGlobalCheckbox = this.$("[name=heightGlobal]") app.on("builder-pick-room", this.pick.bind(this)) app.on("builder-destroy-room", this.hide.bind(this)) app.on("builder-pick-nothing", this.deselect.bind(this)) @@ -40,6 +42,18 @@ var BuilderInfo = View.extend({ this.$viewHeight.unitVal( window.viewHeight = data.viewHeight || app.defaults.viewHeight ) this.$units.val( "ft" ) this.$unitName.html( "ft" ) + + if (Rooms.regions.length == 0) { + this.changeHeightGlobal(true) + } + else { + var rooms = Rooms.values() + var height = rooms[0].height + var differentHeights = Rooms.some(function(room){ + return room.height != height + }) + this.changeHeightGlobal( ! differentHeights ) + } }, toggle: function(state){ @@ -141,5 +155,13 @@ var BuilderInfo = View.extend({ changeViewHeight: function(){ window.viewHeight = this.$viewHeight.unitVal( ) }, + changeHeightGlobal: function(state){ + if (typeof state == "boolean") { + this.$heightGlobalCheckbox.prop("checked", state) + window.heightIsGlobal = state + return + } + window.heightIsGlobal = this.$heightGlobalCheckbox.prop("checked") + }, }) |
