diff options
Diffstat (limited to 'public/assets/javascripts/ui/builder/BuilderInfo.js')
| -rw-r--r-- | public/assets/javascripts/ui/builder/BuilderInfo.js | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/public/assets/javascripts/ui/builder/BuilderInfo.js b/public/assets/javascripts/ui/builder/BuilderInfo.js new file mode 100644 index 0000000..53a122d --- /dev/null +++ b/public/assets/javascripts/ui/builder/BuilderInfo.js @@ -0,0 +1,70 @@ + +var BuilderInfo = View.extend({ + el: "#builderInfo", + + events: { + "keydown": 'stopPropagation', + "change [name=x]": 'changePosition', + "change [name=z]": 'changePosition', + "change [name=width]": 'changeDimensions', + "change [name=depth]": 'changeDimensions', + "change [name=height]": 'changeDimensions', + "change [name=units]": 'changeUnits', + "change [name=resolution]": 'changeResolution', + "change [name=camera-height]": 'changeCameraHeight', + }, + + initialize: function(opt){ + this.parent = opt.parent + this.$x = this.$("[name=x]") + this.$z = this.$("[name=z]") + this.$width = this.$("[name=width]") + this.$depth = this.$("[name=depth]") + this.$height = this.$("[name=height]") + this.$units = this.$("[name=units]") + this.$resolution = this.$("[name=resolution]") + this.$cameraHeight = this.$("[name=camera-height]") + app.on("builder-pick-room", this.pick.bind(this)) + app.on("builder-destroy-room", this.destroy.bind(this)) + }, + + toggle: function(state){ + this.$el.toggleClass("active", state) + }, + + show: function(){ + this.toggle(true) + }, + + hide: function(){ + this.toggle(false) + }, + + room: null, + + pick: function(room){ + this.room = room + this.$width.val( room.rect.x.length() ) + this.$depth.val( room.rect.y.length() ) + this.$height.val( room.height ) + this.$x.val( room.rect.x.a ) + this.$z.val( room.rect.y.a ) + + console.log(room) + }, + + destroy: function(room){ + this.room = null + this.hide() + }, + + changeDimensions: function(){ + }, + + changeUnits: function(){ + }, + + changeCameraHeight: function(){ + }, + +}) |
