Skip to content

Commit

Permalink
Merge pull request HSF#284 from HSF/fix-hits
Browse files Browse the repository at this point in the history
fix(event-display): fix drawing of hits
  • Loading branch information
EdwardMoyse authored Apr 21, 2021
2 parents f965553 + db3ca8b commit ad7d5aa
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,14 @@ export class PhoenixObjects {
if (hitsParams.length > 0) {
// Peek at first one. Would be better to make these properties of the collections.
const first = hitsParams[0];
if (Array.isArray(first)) isSimpleArray = true;
if ('type' in first) {
type = first.type;
if (Array.isArray(first)) {
isSimpleArray = true;
hitsParamsClone = { pos: hitsParams };
} else {
hitsParamsClone = hitsParams;
if ('type' in first) {
type = first.type;
}
}
} else {
console.log('No hits! Aborting from getHits.');
Expand All @@ -228,12 +233,12 @@ export class PhoenixObjects {
// attributes
let hitLength = hitsParams.length * coordlength;
if (isSimpleArray) length = hitLength; // These are already arrays
const pointPos = new Float32Array();
const pointPos = new Float32Array(hitLength);
let i = 0;
for (const hit of hitsParams) {
for (let j = 0; j < coordlength; ++j, ++i) {
if (isSimpleArray) {
pointPos[i] = hit;
pointPos[i] = hit[j];
} else {
pointPos[i] = hit.pos[j];
}
Expand Down

0 comments on commit ad7d5aa

Please sign in to comment.