diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-03-30 21:46:25 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-03-30 21:46:25 -0400 |
| commit | 835fbcd8b47715d34d17b784409db1d45f992c29 (patch) | |
| tree | b94c371741e3001cab51f9b1f2eefeb1005e12ed | |
| parent | 744b4f00e9c8a7ef8a75cc8508bf10c0da8de9cc (diff) | |
rightclick to recenter canvas
| -rw-r--r-- | public/assets/javascripts/rectangles/engine/map/ui_ortho.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/public/assets/javascripts/rectangles/engine/map/ui_ortho.js b/public/assets/javascripts/rectangles/engine/map/ui_ortho.js index adff4d2..adcc078 100644 --- a/public/assets/javascripts/rectangles/engine/map/ui_ortho.js +++ b/public/assets/javascripts/rectangles/engine/map/ui_ortho.js @@ -10,6 +10,23 @@ Map.UI.Ortho = function(map){ down: function(e, cursor){ cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a) cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b) + + if (e.ctrlKey || e.which === 3) { + if (placing) { + // close polyline or cancel + return + } + cursor.quantize(1/map.zoom) + map.center.a = cursor.x.a + map.center.b = -cursor.y.a + cursor.x.b = cursor.x.a + cursor.y.b = cursor.y.a + base.mouse.down = false + e.preventDefault() + e.stopPropagation() + return + } + // compare to initial point var p = new vec2( cursor.x.a, cursor.y.a ) if (placing) { |
