Added option to hide arrows
This commit is contained in:
parent
9ea0e14712
commit
a46bac5663
|
@ -20,6 +20,8 @@
|
||||||
<label for="fullarrow">Full arrow</label>
|
<label for="fullarrow">Full arrow</label>
|
||||||
<input type="checkbox" id="collisions" style="margin-bottom:10px" checked>
|
<input type="checkbox" id="collisions" style="margin-bottom:10px" checked>
|
||||||
<label for="collisions">Collisions</label>
|
<label for="collisions">Collisions</label>
|
||||||
|
<input type="checkbox" id="showarrows" style="margin-bottom:10px" checked>
|
||||||
|
<label for="showarrows">Show arrows</label>
|
||||||
<div style="border-width:1px; border-style: solid;" id="container"></div>
|
<div style="border-width:1px; border-style: solid;" id="container"></div>
|
||||||
#
|
#
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -12,6 +12,7 @@ var loader;
|
||||||
|
|
||||||
var container_size = {width: 1067, height: 600};
|
var container_size = {width: 1067, height: 600};
|
||||||
var prev = {x:0, y:0, go:false};
|
var prev = {x:0, y:0, go:false};
|
||||||
|
var showArrows = true;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
animate();
|
animate();
|
||||||
|
@ -36,6 +37,11 @@ function init() {
|
||||||
cameras.mainCamera().collisions = collisions.checked;
|
cameras.mainCamera().collisions = collisions.checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var showarrows = document.getElementById('showarrows');
|
||||||
|
showarrows.onchange = function() {
|
||||||
|
showArrows = showarrows.checked;
|
||||||
|
}
|
||||||
|
|
||||||
// on initialise le moteur de rendu
|
// on initialise le moteur de rendu
|
||||||
container = document.getElementById('container');
|
container = document.getElementById('container');
|
||||||
container.style.height = container_size.height + 'px';
|
container.style.height = container_size.height + 'px';
|
||||||
|
@ -218,7 +224,17 @@ function loadScene() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
cameras.map(function(camera) { if (camera instanceof FixedCamera) show(camera); });
|
var transform = showArrows ? show : hide;
|
||||||
|
cameras.map(function(camera) {
|
||||||
|
if (camera instanceof FixedCamera) {
|
||||||
|
transform(camera);
|
||||||
|
|
||||||
|
camera.traverse(function(elt) {
|
||||||
|
elt.raycastable = showArrows;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
cameras.updateMainCamera();
|
cameras.updateMainCamera();
|
||||||
cameras.update(cameras.mainCamera());
|
cameras.update(cameras.mainCamera());
|
||||||
cameras.look();
|
cameras.look();
|
||||||
|
@ -313,6 +329,7 @@ function pointedCamera(event) {
|
||||||
|
|
||||||
// Looking for cameras
|
// Looking for cameras
|
||||||
for (i in intersects) {
|
for (i in intersects) {
|
||||||
|
if (intersects[i].object.raycastable) {
|
||||||
if ((intersects[i].distance > 0.5 && minDistance === undefined) || (intersects[i].distance < minDistance )) {
|
if ((intersects[i].distance > 0.5 && minDistance === undefined) || (intersects[i].distance < minDistance )) {
|
||||||
// We will not consider a line as clickable
|
// We will not consider a line as clickable
|
||||||
if (! (intersects[i].object instanceof THREE.Line)) {
|
if (! (intersects[i].object instanceof THREE.Line)) {
|
||||||
|
@ -323,6 +340,7 @@ function pointedCamera(event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (bestIndex !== undefined) {
|
if (bestIndex !== undefined) {
|
||||||
if (cameras.getById(intersects[bestIndex].object.parent.id) !== undefined) {
|
if (cameras.getById(intersects[bestIndex].object.parent.id) !== undefined) {
|
||||||
|
|
Loading…
Reference in New Issue