Skip to content

Fix scatter collapse after repeated box zoom#101

Open
FarhanAliRaza wants to merge 3 commits into
mainfrom
codex/fix-scatter-view-collapse-on-zoom
Open

Fix scatter collapse after repeated box zoom#101
FarhanAliRaza wants to merge 3 commits into
mainfrom
codex/fix-scatter-view-collapse-on-zoom

Conversation

@FarhanAliRaza

@FarhanAliRaza FarhanAliRaza commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Motivation

Repeated anisotropic box zoom followed by Zoom Out could collapse a scatter plot into a horizontal band.

A box zoom can narrow X and Y by very different factors. Zoom Out previously expanded both axes geometrically without respecting each axis's original range, so the less-zoomed axis could grow far beyond its home span while the other axis was still zoomed in. That extreme aspect-ratio mismatch visually flattened the point cloud.

Description

  • Cap each axis independently at its original span during zoom-out. Once an axis reaches its home span it stops expanding, while a more deeply zoomed axis can continue zooming out. (js/src/53_interaction.js)
  • Add the exact repeated box-zoom reproduction to examples/demo-advance.ipynb.
  • Add a Chromium regression that performs three anisotropic box zooms and four zoom-outs, then verifies X remains zoomed while Y stops exactly at its home domain. (tests/test_zoom_precision.py)
  • Regenerate the tracked anywidget and standalone browser bundles from the JS source. (python/xy/static/index.js, python/xy/static/standalone.js)

The earlier GPU-coordinate precision workaround was removed because it was not needed for this failure.

Testing

  • node js/build.mjs --check — generated static bundles are fresh.
  • uv run ruff check tests/test_zoom_precision.py — passed.
  • uv run ruff format --check tests/test_zoom_precision.py — passed.
  • uv run pytest tests/test_zoom_precision.py tests/test_static_client_security.py tests/test_scatter.py tests/test_components.py -q — 187 passed.
  • Chrome verification using the 20,000-point notebook reproduction:
    • after three anisotropic box zooms: X 125×, Y 1.953×
    • after four zoom-outs: X 7.8125×, Y
    • before the fix, Y reached 0.122×—eight times wider than its home span
    • the point cloud remained two-dimensional and no console errors were emitted

Closes #87

@codspeed-hq

codspeed-hq Bot commented Jul 20, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 94 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing codex/fix-scatter-view-collapse-on-zoom (83d816c) with main (b283b10)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@FarhanAliRaza FarhanAliRaza changed the title Fix scatter precision after repeated box zoom Fix scatter collapse after repeated box zoom Jul 20, 2026
@FarhanAliRaza FarhanAliRaza added valid Issue is validated. This pr actually fixes the issue. Needs Code Review. and removed codex labels Jul 20, 2026

@masenf masenf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when zooming out, if the zoom level is already at 100%, the pan is reset as well. when this happens, it leaves the previous selection in place including the dot and tooltip.

Screen.Recording.2026-07-20.at.2.54.03.PM.mov

probably a task for another PR, but i'm wondering if we should let the outer page scroll when the chart is already zoomed out to mitigate ENG-10492 which is a bit annoying when browsing the docs. idk if it would be more jarring for a user actively zooming out to hit 100% and then suddenly scroll down the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

valid Issue is validated. This pr actually fixes the issue. Needs Code Review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scatter view collapses to a horizontal line after repeated box-zoom + zoom-out

2 participants