diff --git a/CHANGELOG.md b/CHANGELOG.md index e9d96c2..515ddf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 1.12.1 +- Fix: prevent drawing points if all are filtered out ([#201](https://github.com/flekschas/regl-scatterplot/issues/201)) - Fix: destroy the encoding texture before recreating it - Fix: reject `set()` calls if the instance was destroyed - Fix: ensures unnecessary color and encoding texture updates are avoided diff --git a/src/index.js b/src/index.js index b505567..d1d0a4d 100644 --- a/src/index.js +++ b/src/index.js @@ -2270,7 +2270,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; } @@ -4322,7 +4322,8 @@ const createScatterplot = ( }); } - if (isPointsDrawn) { + const numPoints = getNormalNumPoints(); + if (isPointsDrawn && numPoints > 0) { drawPointBodies(); }