bumbu/svg-pan-zoom

Separate Zoom for X-Y axis

Open

#176 aberto em 15 de dez. de 2015

Ver no GitHub
 (10 comments) (0 reactions) (0 assignees)JavaScript (383 forks)batch import
discussionenhancementhelp wanted

Métricas do repositório

Stars
 (1.585 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

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.

Guia do colaborador