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
70
71
|
var BlueprintScaler = ModalView.extend({
el: ".blueprintScaler",
events: {
"change [name=blueprint-dimensions]": "changeDimensions",
"change [name=blueprint-units]": "changeUnits",
"click #saveBlueprint": "save",
},
initialize: function(){
this.$blueprintMap = this.$("#blueprintMap")
this.$blueprintDimensionsRapper = this.$("#blueprintDimensions")
this.$dimensions = this.$("[name=blueprint-dimensions]")
this.$units = this.$("[name=blueprint-units]")
this.$save = this.$("#saveBlueprint")
this.map = map = new Map ({
type: "ortho",
el: this.$blueprintMap.get(0),
width: window.innerWidth,
height: window.innerHeight,
zoom: -2,
zoom_min: -6.2,
zoom_max: 1,
})
map.ui.add_tool("arrow", new ArrowTool)
map.ui.add_tool("position", new PositionTool)
map.ui.set_tool("position")
scene = scene || { camera: { x: 0, y: 0, z: 0 } }
this.floorplan = new MX.Image ()
this.animate()
},
pick: function(media){
this.floorplan.load({ media: media, keepImage: true })
},
animate: function(t){
requestAnimationFrame(this.animate.bind(this))
var dt = t - this.last_t
this.last_t = t
if (! t) return
this.map.update(t)
this.map.draw.ctx.save()
this.map.draw.translate()
this.floorplan.draw(this.map.draw.ctx, true)
this.map.draw.coords()
this.map.draw.mouse(this.map.ui.mouse.cursor)
this.map.draw.ctx.restore()
},
changeDimensions: function(){
},
changeUnits: function(){
},
save: function(){
},
})
|