Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In startTouch(), pageX, pageY is not appropriate for the calculation …
…of dataX, dataY. This causes serious problems in the calculation of context.initialPinchCenter. The wrong calculations affect pinch-zoom when the x or y range is small and the graph div is farther to the bottom or right of the page. For example, see http://jsfiddle.net/j63zvups/1/ and try to pinch-zoom in vertical, for scaling the y axis. You will get an ungovernable behaviour. The solution is to use t.clientX and t.target.getBoundingClientRect(). To see that the old calculations were incorrect, consider this: toDataYCoord(y) = yRange[0] + (area.y + area.h - y) / area.h * (yRange[1] - yRange[0]); Now, if you pass y = pageY, you can see that (area.y + area.h - pageY) / area.h is wrong when pageY > area.y + area.h, which is the case when you scroll far enough.
- Loading branch information