mirror of
https://github.com/Sheldan/canvas.git
synced 2026-04-14 11:48:15 +00:00
adding ability to toggle names
This commit is contained in:
@@ -34,7 +34,8 @@
|
|||||||
R -> reset to 2024-03-17 <br>
|
R -> reset to 2024-03-17 <br>
|
||||||
F -> reset camera <br>
|
F -> reset camera <br>
|
||||||
P -> toggle pause <br>
|
P -> toggle pause <br>
|
||||||
T -> restart trail
|
T -> restart trail <br>
|
||||||
|
N -> toggle names
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ const config = {
|
|||||||
timeStep: 1 * 3600,
|
timeStep: 1 * 3600,
|
||||||
AU: 149_597_870_700,
|
AU: 149_597_870_700,
|
||||||
pause: false,
|
pause: false,
|
||||||
|
displayNames: true,
|
||||||
lines: true,
|
lines: true,
|
||||||
currentTime: 1710633600 // Sun Mar 17 2024 00:00:00 GMT+0000
|
currentTime: 1710633600 // Sun Mar 17 2024 00:00:00 GMT+0000
|
||||||
}
|
}
|
||||||
@@ -201,7 +202,7 @@ function initScene(font) {
|
|||||||
const lineMaterial = new THREE.LineBasicMaterial({color: sphereColor});
|
const lineMaterial = new THREE.LineBasicMaterial({color: sphereColor});
|
||||||
const lineGeometry = new THREE.BufferGeometry().setFromPoints(labelLine);
|
const lineGeometry = new THREE.BufferGeometry().setFromPoints(labelLine);
|
||||||
const line = new THREE.Line( lineGeometry, lineMaterial);
|
const line = new THREE.Line( lineGeometry, lineMaterial);
|
||||||
sphereConfig.line = line;
|
sphereConfig.labelLine = line;
|
||||||
group.add(line);
|
group.add(line);
|
||||||
scene.add(group);
|
scene.add(group);
|
||||||
})
|
})
|
||||||
@@ -225,6 +226,14 @@ function setTrailToNow() {
|
|||||||
lines = {}
|
lines = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleNames() {
|
||||||
|
config.displayNames = !config.displayNames;
|
||||||
|
spheres.spheres.forEach(sphereConfig => {
|
||||||
|
sphereConfig.text.visible = config.displayNames;
|
||||||
|
sphereConfig.labelLine.visible = config.displayNames;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function keyPress(event) {
|
function keyPress(event) {
|
||||||
let keyCode = event.which;
|
let keyCode = event.which;
|
||||||
if(keyCode === 82) { // R
|
if(keyCode === 82) { // R
|
||||||
@@ -235,6 +244,8 @@ function keyPress(event) {
|
|||||||
config.pause = !config.pause;
|
config.pause = !config.pause;
|
||||||
} else if(keyCode === 84) { // T
|
} else if(keyCode === 84) { // T
|
||||||
setTrailToNow()
|
setTrailToNow()
|
||||||
|
} else if(keyCode === 78) { // N
|
||||||
|
toggleNames()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user