bumbu/svg-pan-zoom

Separate Zoom for X-Y axis

Open

#176 ouverte le 15 déc. 2015

Voir sur GitHub
 (10 commentaires) (0 réactions) (0 assignés)JavaScript (383 forks)batch import
discussionenhancementhelp wanted

Métriques du dépôt

Stars
 (1 585 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Hi,

I'd like to have separate X/Y scales when zooming. In other words, I'd like to return {x: true, y:false} from beforeZoom, as this is done in beforePan.

I have two use cases in my project:

  • A timeline, where you can chose a date. If the timeline is horizontal, you don't have to scale the y axis, but there is a need to scale the x axis
  • A line chart, where i'd like to have different scales on my two axis.

Implementation details:

  • Add an option named enableSeparateZooms, default: false.
  • If this option is set, each zoom-related options handles {x:, y:}-like zooms, if not set, the current behavior is kept
  • Add a method panZoomToRect({x,y,width,height}) to pan and zoom to a specific viewbox, potentially with different x/y zoom factors. width or height may be ommited (but not both), in which case the current scale ratio is kept

What do you think about the idea? Is there anything else to add ? I can try to make the PR if you want.

Guide contributeur