diff options
author | Aki <please@ignore.pl> | 2021-04-07 01:53:24 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2021-04-07 01:53:24 +0200 |
commit | 26dc6a46e15c5762e9f71199162ce64f4457401a (patch) | |
tree | 62f14e85cfcc2e78ad72c0adef59d3e5b36412df | |
parent | 6c5a0d35dc6429275514c1ba51bef42b1e36da7a (diff) | |
download | derelict-prototype-26dc6a46e15c5762e9f71199162ce64f4457401a.zip derelict-prototype-26dc6a46e15c5762e9f71199162ce64f4457401a.tar.gz derelict-prototype-26dc6a46e15c5762e9f71199162ce64f4457401a.tar.bz2 |
Added stub grid selector
-rw-r--r-- | derelict.js | 16 | ||||
-rw-r--r-- | index.html | 1 |
2 files changed, 16 insertions, 1 deletions
diff --git a/derelict.js b/derelict.js index 13cd884..d88b951 100644 --- a/derelict.js +++ b/derelict.js @@ -4,6 +4,7 @@ import { CSS2DRenderer, CSS2DObject } from 'https://unpkg.com/three@0.126.1/exam const ESI = "https://esi.evetech.net/latest" const SCALE = 10000 +const METERS_IN_AU = 149597871000 class SkirmishGrid { scene = new THREE.Scene() @@ -125,7 +126,19 @@ function processKillmails(grid, killmails, icon) { const end = Math.max(...dates) const clusters = killmails.reduce(splitKillmails, new Array()) const center = averagePosition(clusters[0].map(km => km.victim.position)) - clusters[0].sort((a, b) => a.killmail_time.localeCompare(b.killmail_time)) + + const gridSelection = document.getElementById("grid") + clusters.forEach(cluster => { + const option = document.createElement("option") + const origin = new THREE.Vector3() + origin.copy(cluster[0].victim.position) + console.log(origin) + origin.divideScalar(METERS_IN_AU) + option.text = `${origin.x.toFixed(1)} AU, ${origin.y.toFixed(1)} AU, ${origin.z.toFixed(1)} AU` + gridSelection.options.add(option) + }) + gridSelection.oninput = () => console.log(clusters[gridSelection.selectedIndex]) + let elements = [] clusters[0].forEach(killmail => { killmail.victim.position.sub(center).divideScalar(SCALE) @@ -133,6 +146,7 @@ function processKillmails(grid, killmails, icon) { grid.add(wreck.point) elements.push(wreck) }) + const timeline = document.getElementById("timeline") const step = 1000 timeline.min = start - step @@ -8,6 +8,7 @@ <div id="wrapper"> <div id="container"></div> <div id="toolbar"> + <select id="grid"></select> <input type="range" id="timeline"> </div> </div> |