diff options
-rw-r--r-- | derelict.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/derelict.js b/derelict.js index d8c967d..13cd884 100644 --- a/derelict.js +++ b/derelict.js @@ -55,7 +55,7 @@ class Wreck { point = new THREE.Object3D() killmail - constructor({killmail, position, icon, grid}) { + constructor({killmail, icon, grid}) { const iconElement = document.importNode(icon, true) const object2d = new CSS2DObject(this.domElement) @@ -67,12 +67,12 @@ class Wreck { .then(response => response.json()) .then(typeId => this.domElement.dataset.label = typeId.name) this.domElement.appendChild(iconElement) - this.point.position.copy(position) + this.point.position.copy(killmail.victim.position) this.point.add(object2d) this.domElement.onclick = () => window.open(`https://zkillboard.com/kill/${this.killmail.killmail_id}/`) this.domElement.oncontextmenu = () => { - grid.controls.target.copy(position) + grid.controls.target.copy(this.point.position) grid.controls.update() } } @@ -128,10 +128,8 @@ function processKillmails(grid, killmails, icon) { clusters[0].sort((a, b) => a.killmail_time.localeCompare(b.killmail_time)) let elements = [] clusters[0].forEach(killmail => { - const vec3 = killmail.victim.position - vec3.sub(center) - vec3.divideScalar(SCALE) - const wreck = new Wreck({position: vec3, killmail, icon, grid}) + killmail.victim.position.sub(center).divideScalar(SCALE) + const wreck = new Wreck({killmail, icon, grid}) grid.add(wreck.point) elements.push(wreck) }) |