summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-04-30 12:24:39 -0400
committerJules Laplace <jules@okfoc.us>2015-04-30 12:24:39 -0400
commitdea857bcfb9695a1e205b7cf224388660c2735af (patch)
tree783a36ad12e04af330f3cdfb237eed69a4928704
parent94ba321f96638906e41eda7abf371066011c8508 (diff)
minimap can pivot with camera orientation
-rw-r--r--public/assets/javascripts/rectangles/engine/map/_map.js2
-rw-r--r--public/assets/javascripts/rectangles/engine/map/draw.js1
2 files changed, 2 insertions, 1 deletions
diff --git a/public/assets/javascripts/rectangles/engine/map/_map.js b/public/assets/javascripts/rectangles/engine/map/_map.js
index d582982..bf646bb 100644
--- a/public/assets/javascripts/rectangles/engine/map/_map.js
+++ b/public/assets/javascripts/rectangles/engine/map/_map.js
@@ -16,6 +16,7 @@ var Map = function(opt){
var base = this
base.el = opt.el
base.$el = $(base.el)
+ base.opt = opt
if (! base.el) return
@@ -33,7 +34,6 @@ var Map = function(opt){
scene.camera.x + sides.a, scene.camera.z + sides.b )
}
-
base.set_zoom = function (n) {
n = clamp(n, opt.zoom_min, opt.zoom_max)
base.zoom_exponent = n
diff --git a/public/assets/javascripts/rectangles/engine/map/draw.js b/public/assets/javascripts/rectangles/engine/map/draw.js
index 24f7cf3..11ba3f8 100644
--- a/public/assets/javascripts/rectangles/engine/map/draw.js
+++ b/public/assets/javascripts/rectangles/engine/map/draw.js
@@ -17,6 +17,7 @@ Map.Draw = function(map, opt){
else if (opt.minimap) {
ctx.translate( map.dimensions.a * 1/2, map.dimensions.b * 1/2)
ctx.scale( map.zoom, map.zoom )
+ if (map.opt.pivot) { ctx.rotate(scene.camera.rotationY + PI) }
ctx.translate( opt.center.x, - opt.center.z )
ctx.scale( -1, 1 )