mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-08 03:01:03 +02:00
Shorten how intersectors are added to the grid in the Intersector constructor
Thanks to modern JavaScript features this code can be simplified a tiny bit.
This commit is contained in:
parent
d92db130da
commit
4a5c455c0b
@ -192,11 +192,7 @@ class Intersector {
|
||||
const h = Math.floor((iMax - iMin) / STEPS);
|
||||
for (let i = iMin; i <= iMin + h * STEPS; i += STEPS) {
|
||||
for (let j = 0; j <= w; j++) {
|
||||
let existing = this.#grid[i + j];
|
||||
if (!existing) {
|
||||
this.#grid[i + j] = existing = [];
|
||||
}
|
||||
existing.push(intersector);
|
||||
(this.#grid[i + j] ??= []).push(intersector);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user