bumbu/svg-pan-zoom

Separate Zoom for X-Y axis

Open

#176 创建于 2015年12月15日

在 GitHub 查看
 (10 评论) (0 反应) (0 负责人)JavaScript (1,585 star) (383 fork)batch import
discussionenhancementhelp wanted

描述

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.

贡献者指南

Separate Zoom for X-Y axis · bumbu/svg-pan-zoom#176 | Good First Issue