From 44c9a2ed2cd77c61f5a6e2bab4daebb5527e7988 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 31 Mar 2015 15:22:17 -0400 Subject: url --- public/assets/test/ortho2.html | 21 ++-- public/assets/test/ortho3.html | 239 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 254 insertions(+), 6 deletions(-) create mode 100644 public/assets/test/ortho3.html diff --git a/public/assets/test/ortho2.html b/public/assets/test/ortho2.html index 74351b4..5609ec3 100644 --- a/public/assets/test/ortho2.html +++ b/public/assets/test/ortho2.html @@ -15,14 +15,21 @@ body { top:0px } #hud { - white-space: pre; + position: absolute; + top: 0; + left: 0; + padding: 10px; + background: white; } +#url { width: 300px }
-
+
+ +
@@ -98,12 +105,13 @@ Map.UI.Ortho = function(map){ move: 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) + last_point = new vec2( cursor.x.a, cursor.y.a ) if (placing && points.length > 1 && points[0].distanceTo( last_point ) < 10/map.zoom) { document.body.style.cursor = "pointer" last_point.assign(points[0]) cursor.x.a = cursor.x.b = last_point.a - cursor.y.a = cursor.y.b =last_point.b + cursor.y.a = cursor.y.b = last_point.b } else { document.body.style.cursor = "crosshair" @@ -225,6 +233,10 @@ function add_mx_point (p, i) { return mx } +$("#url").on("input", function(){ + floorplan.load({ src: this.value }) +}) + document.addEventListener('DOMContentLoaded', build) function build () { scene = new MX.Scene().addTo("#perspective") @@ -234,8 +246,6 @@ function build () { scene.height = window.innerHeight scene.perspective = window.innerHeight -// grid = new MX.Grid() -// scene.add(grid) floorplan = new MX.Image({ src: "https://s3.amazonaws.com/luckyplop/fbf4295da80f1f66c5e4a248f2ea3e1ce7a22c3d.jpg", keepImage: true, @@ -267,7 +277,6 @@ function animate(time){ map.draw.ctx.save() map.draw.translate() -// grid.draw(map.draw.ctx, true) floorplan.draw(map.draw.ctx, true) map.draw.coords() diff --git a/public/assets/test/ortho3.html b/public/assets/test/ortho3.html new file mode 100644 index 0000000..19bb13a --- /dev/null +++ b/public/assets/test/ortho3.html @@ -0,0 +1,239 @@ + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3-70-g09d2