summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/builder/BuilderInfo.js
diff options
context:
space:
mode:
authorryderr <r@okfoc.us>2014-11-17 11:23:53 -0500
committerryderr <r@okfoc.us>2014-11-17 11:23:53 -0500
commit21e23e63e089685a558d2e5c74439e9de5c33c4f (patch)
tree6ee8cf44e00aca897ec02d48a1e398c4e41092cb /public/assets/javascripts/ui/builder/BuilderInfo.js
parent39fa1a5b835797deb4b28d7ba6faae766a979dca (diff)
parent84d606cc4c56778ae7e6b8b7d86e100131717a53 (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.js29
1 files changed, 28 insertions, 1 deletions
diff --git a/public/assets/javascripts/ui/builder/BuilderInfo.js b/public/assets/javascripts/ui/builder/BuilderInfo.js
index 7606361..9a7dbf9 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){
@@ -118,7 +132,12 @@ var BuilderInfo = View.extend({
},
changeHeight: function(e){
e.stopPropagation()
- this.room.height = this.$height.unitVal()
+ var height = this.room.height = this.$height.unitVal()
+ if (window.heightIsGlobal) {
+ Rooms.forEach(function(room){
+ room.height = height
+ })
+ }
Rooms.rebuild()
},
changeX: function(e){
@@ -141,5 +160,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")
+ },
})