Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zoom interaction #1738

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

zoom interaction #1738

wants to merge 2 commits into from

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Jul 7, 2023

zoom is a new top-level option, values "xy", "x", "y". (first pass at #1590)

  • A mark has a zoom() method, which allows it to act when the chart receives a zoom event.
  • The default zoom method puts all the node’s contents into a new g and applies the zoom transform to that g.
  • The zoom method on the axis marks computes ticks for the rescaled scale. for the tick label it is set to null.
  • The zoom method on the dot mark rescales the dots by sqrt(k) instead of k, making it easy to “declutter by zooming”

Things that don't work yet, but I foresee no blocker:

  • pointing (still points to the unzoomed positions)
  • facets
  • fixed ticks, tickFormat
  • adaptive pointRadius for the geo mark
  • the image mark when applying a zoom:"x" gets squished
  • zoomExtent defaults and more generally, zoom configuration
  • clipping (cf. armadillo)

Things that seem more difficult—maybe not necessary in the first version:

  • zooming categorical scales
  • re-running initializers (say, if we wanted a hexbin that maintains an unzoomed grid)
  • re-running render (e.g. for the raster mark to still raster the frame but with different bounds, useful for say, the julia set)
  • adaptive rendering (say, to change a map's precision during rendering and depending on the scaling factor)

(Maybe an option could be to re-render everything, but with zoomed scales—maybe just by manipulating insets or whatever is needed—this would help cover a lot of the difficult cases, but it would certainly be inefficient.)

To make tests easier zoom is considered true everywhere ("xy")—this helps to surface all the cases where it doesn't work (or fails in a funny way).

zooming1.mov

@Fil Fil changed the title zoom zoom interaction Dec 21, 2023
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.

None yet

1 participant