bumbu/svg-pan-zoom

ResetZoom() and resetPan() do nothing when in the same function as pan() zoom()

Open

#280 创建于 2018年1月23日

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

描述

Bug report

Expected behaviour

Calling resetZoom() & resetPan(), then later in the same function calling pan() and zoom() should undo any previous zooming and panning to allow panning/zooming to dynamically calculated positions.

Actual behaviour

If resetZoom() & resetPan() are called in the same function prior to calling pan() and zoom(), any previous zooming and panning is not reset, and resetZoom() & resetPan() are seemingly not called, resulting in pan() panning to the wrong positions

Steps to reproduce the behaviour

  1. Call pan() & zoom() on a svg that has been neither panned and zoomed() and confirm it goes to a given point.
  2. Reset zoom.
  3. Pan and zoom to and arbitrary point.
  4. Call resetZoom() & resetPan() in the same function as pan() & zoom() with the same values in pan() & zoom() as in step 1.
  5. The panning and zooming goes to a different point than step 1.

Configuration

  • svg-pan-zoom version: 3.5.3
  • Browser(s): Chrome
  • Operating system(s): Windows 8
  • Example code:

this.svgPan.resetZoom(); this.svgPan.resetPan(); this.svgPan.pan({ x: - ((left + right) / 2 - ((this.locationMap.nativeElement.getBoundingClientRect().left + this.locationMap.nativeElement.getBoundingClientRect().right) / 2)), y: - ((top + bottom) / 2 - ((this.locationMap.nativeElement.getBoundingClientRect().top + this.locationMap.nativeElement.getBoundingClientRect().bottom) / 2)) }); this.svgPan.zoom(2);

贡献者指南

ResetZoom() and resetPan() do nothing when in the same function as pan() zoom() · bumbu/svg-pan-zoom#280 | Good First Issue