Skip to content

Commit

Permalink
Fix: prevent drawing points if all are filtered out
Browse files Browse the repository at this point in the history
  • Loading branch information
flekschas committed Jan 7, 2025
1 parent 27ce203 commit e6bf879
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.12.1

- Fix: prevent drawing points if all are filtered out ([#201](https://github.com/flekschas/regl-scatterplot/issues/201))

## 1.12.0

- Feat: add support for adjusting the anti-aliasing via `scatterplot.set({ antiAliasing: 1 })`. ([#175](https://github.com/flekschas/regl-scatterplot/issues/175))
Expand Down
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2242,7 +2242,7 @@ const createScatterplot = (
const filteredSelectedPoints = [];

for (const pointIdx of pointIdxsArray) {
if (pointIdx < 0 || pointIdx >= numPoints) {
if (!Number.isFinite(pointIdx) || pointIdx < 0 || pointIdx >= numPoints) {
// Skip invalid filtered points
continue;
}
Expand Down Expand Up @@ -4281,7 +4281,8 @@ const createScatterplot = (
});
}

if (isPointsDrawn) {
const numPoints = getNormalNumPoints();
if (isPointsDrawn && numPoints > 0) {
drawPointBodies();
}

Expand Down

0 comments on commit e6bf879

Please sign in to comment.