diff --git a/static/img/ball.png b/static/img/ball.png index daab427..b49b534 100644 Binary files a/static/img/ball.png and b/static/img/ball.png differ diff --git a/static/img/ball.svg b/static/img/ball.svg new file mode 100644 index 0000000..1f92891 --- /dev/null +++ b/static/img/ball.svg @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/static/img/make_figs.sh b/static/img/make_figs.sh new file mode 100755 index 0000000..c0ea20c --- /dev/null +++ b/static/img/make_figs.sh @@ -0,0 +1,3 @@ +#!/bin/bash +inkscape -z -e ball.png -w 64 -h 64 ball.svg +inkscape -z -e tip.png -w 64 -h 64 tip.svg diff --git a/static/img/tip.png b/static/img/tip.png new file mode 100644 index 0000000..cbc6ee8 Binary files /dev/null and b/static/img/tip.png differ diff --git a/static/img/tip.svg b/static/img/tip.svg new file mode 100644 index 0000000..e18e10f --- /dev/null +++ b/static/img/tip.svg @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/static/index.html b/static/index.html index 46999cb..e941749 100644 --- a/static/index.html +++ b/static/index.html @@ -26,12 +26,19 @@
+

Node (5,2)

diff --git a/static/main.css b/static/main.css index 4667beb..cd03e3a 100644 --- a/static/main.css +++ b/static/main.css @@ -21,7 +21,7 @@ html, body { margin: 0; padding: 0; overflow: hidden; font-size: 10pt; font-fam padding: 10px; font-family:"courier new"; position: absolute; - bottom: 10px; + top: 10px; right: 10px; font-size: 9pt; } @@ -34,7 +34,7 @@ html, body { margin: 0; padding: 0; overflow: hidden; font-size: 10pt; font-fam font-family:"courier new"; position: absolute; top: 10px; - right: 10px; + left: 10px; font-size: 9pt; } @@ -45,6 +45,12 @@ ul { margin: 0px; } +li{ + padding:3px; +} + + + .visible { visibility: visible; opacity: 1; @@ -62,3 +68,10 @@ ul { a { color: yellow; } + +h3 { + padding-top: 0px; + padding-bottom: 0px; + margin-top: 2px; + margin-bottom: 2px; +} diff --git a/static/scripts/editor.js b/static/scripts/editor.js new file mode 100644 index 0000000..70c887c --- /dev/null +++ b/static/scripts/editor.js @@ -0,0 +1,61 @@ +var editor = {}; +editor.nearest = undefined; + +editor.onFreeMove = function() { + var n = editor.nearestNode(mouse.ray); + if (editor.nearest !== n) { + editor.nearest = n; + if (n) { + gui.nodeMessage("Node " + n + " (VOP:" + abj.vops[n] + ")" + + "
" + "Click to edit neighbourhood"); + } else { + gui.hideNodeMessage(); + } + } +}; + +editor.onClick = function() { + var n = editor.nearestNode(mouse.ray); + if (n) { + var p = abj.meta[n].position; + editor.gimbal.position.set(p.x, p.y, p.z); + gui.controls.target.set(p.x, p.y, p.z); + gui.hideNodeMessage(); + editor.nearest = undefined; + gui.render(); + } +}; + +editor.prepare = function() { + mouse.onFreeMove = editor.onFreeMove; + mouse.onClick = editor.onClick; + editor.makeGimbal(); +}; + +// Gets a reference to the node nearest to the mouse cursor +editor.nearestNode = function(ray) { + for (var i in abj.meta) { + if (ray.distanceSqToPoint(abj.meta[i].position) < 0.03) { + return i; + } + } + return undefined; +}; + +editor.makeGimbal = function(center) { + editor.gimbal = new THREE.Object3D(); + + var pointGeometry = new THREE.Geometry(); + pointGeometry.vertices = [ + new THREE.Vector3(1, 0, 0), + new THREE.Vector3(0, 1, 0), + new THREE.Vector3(0, 0, 1), + new THREE.Vector3(-1, 0, 0), + new THREE.Vector3(0, -1, 0), + new THREE.Vector3(0, 0, -1) + ]; + var tips = new THREE.Points(pointGeometry, materials.tip); + + editor.gimbal.add(tips); + gui.scene.add(editor.gimbal); +}; diff --git a/static/scripts/materials.js b/static/scripts/materials.js index 5e4f52e..2d77ee4 100644 --- a/static/scripts/materials.js +++ b/static/scripts/materials.js @@ -15,6 +15,10 @@ materials.prepare = function() { transparent: false, linewidth: 1 }); + materials.gimbalEdge = new THREE.LineBasicMaterial({ + color: "black", + linewidth: 1, + }); materials.tip = new THREE.PointsMaterial({ size: 0.4, map: tipSprite, diff --git a/static/scripts/mouse.js b/static/scripts/mouse.js index a22c6a9..f143e37 100644 --- a/static/scripts/mouse.js +++ b/static/scripts/mouse.js @@ -47,6 +47,7 @@ mouse.onUp = function(event) { }; mouse.onMove = function(event) { + // TODO: wasclick sux mouse.wasClick = false; mouse.position_absolute = { x: event.clientX,