1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
var BlueprintInfo = View.extend({
el: "#blueprintInfo",
events: {
"mousedown": "stopPropagation",
"keydown": 'stopPropagation',
"change [name=height]": 'changeHeight',
"keydown [name=height]": 'enterHeight',
"change [name=units]": 'changeUnits',
"keydown [name=viewHeight]": 'enterViewHeight',
"change [name=viewHeight]": 'changeViewHeight',
},
initialize: function(opt){
this.parent = opt.parent
this.$height = this.$("[name=height]")
this.$units = this.$("[name=units]")
this.$viewHeight = this.$("[name=viewHeight]")
this.$unitName = this.$(".unitName")
},
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.$unitName.html( data.units )
this.show()
},
toggle: function(state){
this.$el.toggleClass("active", state)
this.$viewHeight.unitVal( window.viewHeight )
},
show: function(){
this.toggle(true)
},
hide: function(){
this.toggle(false)
},
deselect: function(){
this.toggle(true)
},
enterHeight: function(e){
if (e.keyCode == 13) this.changeHeight(e)
},
changeHeight: function(e){
e.stopPropagation()
window.wallHeight = this.$height.unitVal()
shapes.forEach(function(line){
line.mx.set_height( window.wallHeight )
})
},
changeUnits: function(){
app.units = this.$units.val()
this.$('.units').resetUnitVal()
},
enterViewHeight: function(e){
if (e.keyCode == 13) this.changeViewHeight(e)
},
changeViewHeight: function(){
window.viewHeight = this.$viewHeight.unitVal()
}
})
|