diff options
Diffstat (limited to 'public/assets/javascripts/ui')
| -rw-r--r-- | public/assets/javascripts/ui/blueprint/BlueprintEditor.js | 8 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/blueprint/BlueprintInfo.js | 23 |
2 files changed, 27 insertions, 4 deletions
diff --git a/public/assets/javascripts/ui/blueprint/BlueprintEditor.js b/public/assets/javascripts/ui/blueprint/BlueprintEditor.js index 7a1c064..7704689 100644 --- a/public/assets/javascripts/ui/blueprint/BlueprintEditor.js +++ b/public/assets/javascripts/ui/blueprint/BlueprintEditor.js @@ -82,7 +82,7 @@ var BlueprintEditor = View.extend(AnimatedView.prototype).extend({ scale: media.scale, }) this.startAnimating() - this.regions = RegionList.build() + this.regions = RegionList.buildByShape() }, animate: function(t, dt){ @@ -114,9 +114,9 @@ var BlueprintEditor = View.extend(AnimatedView.prototype).extend({ map.draw.camera(scene.camera) // var colors = ["rgba(0,0,0,0.1)"] -// var colors = ["rgba(255,255,255,1)"] -// -// map.draw.regions(this.regions, colors, "#000") +// var colors = ["rgba(255,255,255,1)"] + +// map.draw.regions(this.regions, colors, "#000") // this.regions.forEach(function(room,i){ // map.draw.ctx.fillStyle = colors[i % colors.length] diff --git a/public/assets/javascripts/ui/blueprint/BlueprintInfo.js b/public/assets/javascripts/ui/blueprint/BlueprintInfo.js index 6dd6a7d..51b310e 100644 --- a/public/assets/javascripts/ui/blueprint/BlueprintInfo.js +++ b/public/assets/javascripts/ui/blueprint/BlueprintInfo.js @@ -10,6 +10,7 @@ var BlueprintInfo = View.extend({ "change [name=units]": 'changeUnits', "keydown [name=viewHeight]": 'enterViewHeight', "change [name=viewHeight]": 'changeViewHeight', + "click .openScaler": 'openScaler', }, initialize: function(opt){ @@ -18,13 +19,30 @@ var BlueprintInfo = View.extend({ this.$units = this.$("[name=units]") this.$viewHeight = this.$("[name=viewHeight]") this.$unitName = this.$(".unitName") + this.$blueprintScaleDisplay = this.$("#blueprintScaleDisplay") }, load: function(data){ this.$viewHeight.unitVal( window.viewHeight = data.viewHeight || app.defaults.viewHeight ) this.$height.unitVal( window.wallHeight = data.wallHeight || app.defaults.wallHeight ) this.$units.val( data.units ) + this.$('span.units').html( data.units ) this.$unitName.html( data.units ) + + var resolution + switch (data.units) { + case 'ft': + resolution = app.defaults.footResolution + break + case 'm': + resolution = app.defaults.meterResolution + break + case 'px': + default: + resolution = 1 + break + } + this.$blueprintScaleDisplay.html( ((1/data.scale) * resolution).toFixed(1) ) this.show() }, @@ -33,6 +51,11 @@ var BlueprintInfo = View.extend({ this.$viewHeight.unitVal( window.viewHeight ) }, + openScaler: function(){ + this.parent.scaler.pick( this.parent.data, true ) + this.parent.scaler.show() + }, + show: function(){ this.toggle(true) }, |
