summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/assets/javascripts/mx/extensions/mx.movements.js2
-rw-r--r--public/assets/javascripts/rectangles/engine/map/draw.js8
-rw-r--r--public/assets/javascripts/rectangles/engine/shapes/polyline.js10
-rw-r--r--public/assets/javascripts/rectangles/engine/shapes/shapelist.js5
-rw-r--r--public/assets/javascripts/ui/blueprint/BlueprintEditor.js4
5 files changed, 19 insertions, 10 deletions
diff --git a/public/assets/javascripts/mx/extensions/mx.movements.js b/public/assets/javascripts/mx/extensions/mx.movements.js
index 9ed8790..cecba7a 100644
--- a/public/assets/javascripts/mx/extensions/mx.movements.js
+++ b/public/assets/javascripts/mx/extensions/mx.movements.js
@@ -155,7 +155,7 @@ MX.Movements = function (cam) {
app.controller.presets.hide()
$(".inuse").removeClass("inuse")
}
- else {
+ else if (! Rooms.shapesMode) {
app.controller.toolbar.toggleMap()
}
break
diff --git a/public/assets/javascripts/rectangles/engine/map/draw.js b/public/assets/javascripts/rectangles/engine/map/draw.js
index c97603b..8498a46 100644
--- a/public/assets/javascripts/rectangles/engine/map/draw.js
+++ b/public/assets/javascripts/rectangles/engine/map/draw.js
@@ -22,7 +22,13 @@ Map.Draw = function(map, opt){
ctx.scale( -1, 1 )
draw.coords()
- draw.regions(Rooms.regions, [ "#fff" ], "#000")
+ if (Rooms.shapesMode) {
+ shapes.draw(draw.ctx, "#fff", null)
+ shapes.draw(draw.ctx, null, "#000")
+ }
+ else {
+ draw.regions(Rooms.regions, [ "#fff" ], "#000")
+ }
draw.camera(scene.camera)
}
else {
diff --git a/public/assets/javascripts/rectangles/engine/shapes/polyline.js b/public/assets/javascripts/rectangles/engine/shapes/polyline.js
index 54e11c6..fc6cad7 100644
--- a/public/assets/javascripts/rectangles/engine/shapes/polyline.js
+++ b/public/assets/javascripts/rectangles/engine/shapes/polyline.js
@@ -95,7 +95,7 @@ var Polyline = Fiber.extend(function(base){
tail: closest_i,
}
}
- exports.draw = function(ctx){
+ exports.draw = function(ctx, fillStyle, strokeStyle){
var points = this.points
if (! points.length) return
if (points.length == 1) {
@@ -103,17 +103,17 @@ var Polyline = Fiber.extend(function(base){
map.draw.dot_at(this.points[0].a, points[0].b, 5)
}
if (points.length > 1) {
- ctx.fillStyle = "rgba(255,255,0,0.1)"
- ctx.strokeStyle = "#f80"
+ ctx.fillStyle = fillStyle
+ ctx.strokeStyle = strokeStyle
ctx.lineWidth = 2 / map.zoom
ctx.beginPath()
ctx.moveTo(points[0].a, points[0].b)
points.forEach(function(point, i){
i && ctx.lineTo(point.a, point.b)
})
- ctx.stroke()
+ strokeStyle && ctx.stroke()
if (! map.ui.placing || this.closed) {
- ctx.fill()
+ fillStyle && ctx.fill()
}
}
}
diff --git a/public/assets/javascripts/rectangles/engine/shapes/shapelist.js b/public/assets/javascripts/rectangles/engine/shapes/shapelist.js
index 9cbf165..75ecae6 100644
--- a/public/assets/javascripts/rectangles/engine/shapes/shapelist.js
+++ b/public/assets/javascripts/rectangles/engine/shapes/shapelist.js
@@ -76,6 +76,11 @@ var ShapeList = Fiber.extend(function(base){
})
return segments
}
+ exports.draw = function(ctx, fillStyle, strokeStyle) {
+ this.shapes.forEach(function(shape){
+ shape.draw(ctx, fillStyle, strokeStyle)
+ })
+ }
exports.serialize = function(){
return this.shapes.map(function(shape){
return shape.serialize()
diff --git a/public/assets/javascripts/ui/blueprint/BlueprintEditor.js b/public/assets/javascripts/ui/blueprint/BlueprintEditor.js
index 4b80b2c..0f35ac5 100644
--- a/public/assets/javascripts/ui/blueprint/BlueprintEditor.js
+++ b/public/assets/javascripts/ui/blueprint/BlueprintEditor.js
@@ -106,9 +106,7 @@ var BlueprintEditor = View.extend(AnimatedView.prototype).extend({
}
}
- shapes.forEach(function(shape){
- shape.draw(map.draw.ctx)
- })
+ shapes.draw(map.draw.ctx, "rgba(255,255,0,0.1)", "#f80")
map.draw.ctx.strokeStyle = "#f00";
map.draw.x_at(0,0)