summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-04-07 01:37:01 +0200
committerAki <please@ignore.pl>2021-04-07 01:37:01 +0200
commit6c5a0d35dc6429275514c1ba51bef42b1e36da7a (patch)
treeafe453a1f146cef54fce68526f40e7033dcb221e
parent7a8450fab37bfaf4a4ff66ac0c453ad77d1bbdfd (diff)
downloadderelict-prototype-6c5a0d35dc6429275514c1ba51bef42b1e36da7a.zip
derelict-prototype-6c5a0d35dc6429275514c1ba51bef42b1e36da7a.tar.gz
derelict-prototype-6c5a0d35dc6429275514c1ba51bef42b1e36da7a.tar.bz2
Removed duplicated argument for position
-rw-r--r--derelict.js12
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)
})