summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/builder/BuilderInfo.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/ui/builder/BuilderInfo.js')
-rw-r--r--public/assets/javascripts/ui/builder/BuilderInfo.js22
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")
+ },
})