Skip to content

Commit 63794b5

Browse files
authored
Fix: prevent drawing points if all are filtered out (#209)
1 parent c8a933e commit 63794b5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## 1.12.1
22

3+
- Fix: prevent drawing points if all are filtered out ([#201](https://github.com/flekschas/regl-scatterplot/issues/201))
34
- Fix: destroy the encoding texture before recreating it
45
- Fix: reject `set()` calls if the instance was destroyed
56
- Fix: ensures unnecessary color and encoding texture updates are avoided

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,7 +2270,7 @@ const createScatterplot = (
22702270
const filteredSelectedPoints = [];
22712271

22722272
for (const pointIdx of pointIdxsArray) {
2273-
if (pointIdx < 0 || pointIdx >= numPoints) {
2273+
if (!Number.isFinite(pointIdx) || pointIdx < 0 || pointIdx >= numPoints) {
22742274
// Skip invalid filtered points
22752275
continue;
22762276
}
@@ -4322,7 +4322,8 @@ const createScatterplot = (
43224322
});
43234323
}
43244324

4325-
if (isPointsDrawn) {
4325+
const numPoints = getNormalNumPoints();
4326+
if (isPointsDrawn && numPoints > 0) {
43264327
drawPointBodies();
43274328
}
43284329

0 commit comments

Comments
 (0)