d3 / d3-zoom

Pan and zoom SVG, HTML or Canvas using mouse or touch input.
https://d3js.org/d3-zoom
ISC License
507 stars 143 forks source link

Transform output is inconsistent with developer experience. #108

Closed trusktr closed 7 years ago

trusktr commented 7 years ago

Continuing from https://github.com/d3/d3/issues/3119#issuecomment-314589750

Instead, transforms are represented as a matrix, and transform operations derive a new matrix. So, the two operations you describe result in identical transforms which are formatted identically by transform.toString:

I understand.

This is more of a feature request: a feature to preserve meaningful transform input.

This could be useful in cases where we wish to retrieve the original values that were inputted.

In other libraries (f.e. Three.js, Pixi.js, etc), one can set position.x, position.y, etc, and later can retrieve those original values.

mbostock commented 7 years ago

Sorry, but this is not a feature request I’m willing to support. You might be able to use d3-transform. If it helps, I would be willing to consider changing zoom.transform so that you can pass in an object with x, y and k properties rather than requiring an instance of d3.zoomTransform; that could possibly let you use d3-transform (or another class of your own design) with the zoom.transform API.