summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/blueprint/BlueprintScaler.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/ui/blueprint/BlueprintScaler.js')
-rw-r--r--public/assets/javascripts/ui/blueprint/BlueprintScaler.js34
1 files changed, 31 insertions, 3 deletions
diff --git a/public/assets/javascripts/ui/blueprint/BlueprintScaler.js b/public/assets/javascripts/ui/blueprint/BlueprintScaler.js
index e11b61e..a81c89b 100644
--- a/public/assets/javascripts/ui/blueprint/BlueprintScaler.js
+++ b/public/assets/javascripts/ui/blueprint/BlueprintScaler.js
@@ -18,7 +18,7 @@ var BlueprintScaler = ModalView.extend({
this.map = map = new Map ({
type: "ortho",
el: this.$blueprintMap.get(0),
- width: window.innerWidth/2,
+ width: window.innerWidth,
height: window.innerHeight,
zoom: -2,
zoom_min: -6.2,
@@ -27,10 +27,38 @@ var BlueprintScaler = ModalView.extend({
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(){
-
+ 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(){