summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/blueprint/BlueprintEditor.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/ui/blueprint/BlueprintEditor.js')
-rw-r--r--public/assets/javascripts/ui/blueprint/BlueprintEditor.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/public/assets/javascripts/ui/blueprint/BlueprintEditor.js b/public/assets/javascripts/ui/blueprint/BlueprintEditor.js
index 18ecf5f..7ec1352 100644
--- a/public/assets/javascripts/ui/blueprint/BlueprintEditor.js
+++ b/public/assets/javascripts/ui/blueprint/BlueprintEditor.js
@@ -5,6 +5,8 @@ var last_point = new vec2 (0,0)
var BlueprintEditor = View.extend(AnimatedView.prototype).extend({
+ rooms: [],
+
initialize: function(opt){
this.parent = opt.parent
@@ -81,6 +83,7 @@ var BlueprintEditor = View.extend(AnimatedView.prototype).extend({
scale: media.scale,
})
this.startAnimating()
+ this.rooms = RegionList.build()
},
animate: function(t, dt){
@@ -93,7 +96,7 @@ var BlueprintEditor = View.extend(AnimatedView.prototype).extend({
map.draw.ctx.save()
map.draw.translate()
- this.floorplan.draw(map.draw.ctx, true)
+ // this.floorplan.draw(map.draw.ctx, true)
map.draw.coords()
@@ -113,13 +116,14 @@ var BlueprintEditor = View.extend(AnimatedView.prototype).extend({
map.draw.mouse(map.ui.mouse.cursor)
map.draw.camera(scene.camera)
- var rooms = RegionList.build()
- rooms.forEach(function(room,i){
+ this.rooms.segments.forEach(function(seg,i){
+ map.draw.ctx.fillStyle = "#f00"
+ map.draw.ctx.fillRect( seg.x.a, seg.y.a, seg.width()+1, seg.height()+1 )
+ })
+
+ this.rooms.rooms.forEach(function(room,i){
map.draw.ctx.fillStyle = colors[i % colors.length]
- map.draw.ctx.fillRect( room[0][0].a, room[0][1].b,
- room[1][0].a - room[0][0].a,
- room[0][0].b - room[0][1].b
- )
+ map.draw.ctx.fillRect( room.x.a, room.y.a, room.width(), room.height() )
})
map.draw.ctx.restore()