Skip to content

Commit fc59cae

Browse files
committed
pad the data with duplicates
1 parent 4bc2405 commit fc59cae

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/transforms/exclusiveFacets.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ export function exclusiveFacets(data, facets) {
2121
if (overlaps === 0) return {data, facets}; // facets are exclusive
2222

2323
// For each overlapping index (duplicate), assign a new unique index at the
24-
// end of the existing array. For example, [[0, 1, 2], [2, 1, 3]] would become
25-
// [[0, 1, 2], [4, 5, 3]]. Attach a plan to the facets array, to be able to
26-
// read the values associated with the old index in unaffected channels.
24+
// end of the existing array, duplicating the datum. For example, [[0, 1, 2],
25+
// [2, 1, 3]] would become [[0, 1, 2], [4, 5, 3]].
26+
data = slice(data);
2727
facets = facets.map((facet) => slice(facet, Uint32Array));
2828
let j = n;
2929
O.fill(0);
3030
for (const facet of facets) {
3131
for (let k = 0, m = facet.length; k < m; ++k) {
3232
const i = facet[k];
33-
if (O[i]) facet[k] = j++;
33+
if (O[i]) (facet[k] = j), (data[j] = data[i]), ++j;
3434
O[i] = 1;
3535
}
3636
}

0 commit comments

Comments
 (0)