Skip to content

Conversation

@hydrosquall
Copy link
Member

@hydrosquall hydrosquall commented Nov 23, 2025

Motivation

Changes

Demo:

2025-11-23_17-26-16.mp4

Note

I split the pr by commit so it should be easier to review. The core functional changes are in 1, the tests are in 2.

Changes vs Vega-Lite

  • This is a new feature, it might be a breaking API change that would benefit from a minor version bump when we publish
  • Before there were 2 types of selection (point and interval). Now there is a third, "region"

Modifications vs original PR

  • Changed from using mouse to pointer events for consistency with the interval selection
  • Updated markdown docs and comments to mention the new region type
  • Tests had to be rewritten to fit in the vitest / playwright paradigm (instead of vitest)
    • Instead of evaluating JS functions in the window, we're calling simulated browser events directly
  • Added more tests to prevent a decrease in coverage percentage / capture the situation where we won't draw a brush (thanks Codecov)
  • I froze the scaling ratio used to take snapshots to a scaling ratio of 2. Otherwise, I would get getting different results when running in headless vs headed mode.

Potential future work

  • I have test helper for SVG snapshots that can be brought to the other tests, expectMatchFileSnapshot
  • Switch Vitest interaction handlers instead of maintaining our own "regular vs pure" functions for creating events

Testing

Expand for code block
{
  "$schema": "https://vega.github.io/schema/vega-lite/v6.json",
  "data": {
    "url": "https://vega.github.io/editor/data/cars.json"
  },
  "params": [
    {
      "name": "brush",
      "select": "region"
    }
  ],
  "mark": "point",
  "encoding": {
    "x": {
      "field": "Horsepower",
      "type": "quantitative"
    },
    "y": {
      "field": "Miles_per_Gallon",
      "type": "quantitative"
    },
    "color": {
      "condition": {
        "param": "brush",
        "field": "Cylinders",
        "type": "ordinal"
      },
      "value": "grey"
    }
  }
}

Notes

@hydrosquall hydrosquall changed the title Cameron.yick/redo vega lasso assist feat(selections): Redo of lasso selections Nov 23, 2025
@hydrosquall hydrosquall force-pushed the cameron.yick/redo-vega-lasso-assist branch from 8bff340 to b3a67ab Compare November 23, 2025 02:23
@hydrosquall hydrosquall force-pushed the cameron.yick/redo-vega-lasso-assist branch from 1a4f269 to fed58ed Compare November 23, 2025 07:54
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 23, 2025

Deploying vega-lite with  Cloudflare Pages  Cloudflare Pages

Latest commit: 28e0918
Status: ✅  Deploy successful!
Preview URL: https://0962b0a0.vega-lite.pages.dev
Branch Preview URL: https://cameron-yick-redo-vega-lasso.vega-lite.pages.dev

View logs

@hydrosquall hydrosquall changed the title feat(selections): Redo of lasso selections feat(selections): Redo lasso selections Nov 23, 2025
@hydrosquall hydrosquall force-pushed the cameron.yick/redo-vega-lasso-assist branch 12 times, most recently from 6ff21ee to 32969e6 Compare November 23, 2025 20:57
@hydrosquall hydrosquall changed the title feat(selections): Redo lasso selections feat(selections): Region/Lasso Selections Nov 23, 2025
@hydrosquall hydrosquall self-assigned this Nov 23, 2025
@hydrosquall hydrosquall changed the title feat(selections): Region/Lasso Selections feat(selections): Region/Lasso Selections - v6 Nov 23, 2025
@hydrosquall hydrosquall force-pushed the cameron.yick/redo-vega-lasso-assist branch 2 times, most recently from 872876b to dfc4370 Compare November 24, 2025 00:19
@hydrosquall hydrosquall force-pushed the cameron.yick/redo-vega-lasso-assist branch from d170c9e to 3280083 Compare November 24, 2025 00:21
@hydrosquall hydrosquall marked this pull request as ready for review November 24, 2025 01:54
@hydrosquall hydrosquall requested a review from a team as a code owner November 24, 2025 01:54
This was referenced Nov 24, 2025
@hydrosquall hydrosquall added this to the 6.0 milestone Nov 24, 2025
@domoritz
Copy link
Member

Super cool! Should the branch preview be working?

Screenshot 2025-11-24 at 15 55 48

@hydrosquall
Copy link
Member Author

Super cool! Should the branch preview be working?

@domoritz thanks for checking! The data URL should be "url": "https://vega.github.io/editor/data/cars.json", as the relative URL of data/cars.json doesn't work - the code block in the PR description should provide the right absolute URL

I think the yellow schema warning squiggly appears since the new JSON schema hasn't been published yet.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants