diff options
Diffstat (limited to 'public/assets/test/ortho2.html')
| -rw-r--r-- | public/assets/test/ortho2.html | 21 |
1 files changed, 15 insertions, 6 deletions
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 } </style> <div id="perspective"></div> <div id="orthographic"></div> -<div id="hud"></div> +<div id="hud"> + <input type="text" id="url" placeholder="paste an image URL here!"> +</div> <script src="/assets/javascripts/util.js"></script> <script src="/assets/javascripts/vendor/bower_components/jquery/dist/jquery.min.js"></script> @@ -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() |
