-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a minimum parameter to setVisibleXRange #115
Comments
You could make a PR. Just make sure that if you add another argument, the On Thu, May 28, 2015 at 5:46 PM, Dor Alon notifications@github.com wrote:
|
I've created a PR |
When trying to zoom in/out using the pinch gesture when the zoom in/out limit is reached the chart starts to pan. I've fixed this issue in the PR, I'm not sure this is the best way to do that |
I'm working on a financial app and it is critical to limit the pinch gesture zoom in.
I've managed to implement this feature, could you please add it to the master branch ?
My implementation:
public func setVisibleXRange(xMinRange: CGFloat, xMaxRange: CGFloat)
{
var maxScale = _deltaX / (xMinRange);
var minScale = _deltaX / (xMaxRange);
_viewPortHandler.setScaleXRange(minScale, maxScaleX: maxScale);
}
A.
/// maximum scale value on the x-axis
private var _maxScaleX = CGFloat(FLT_MAX);
B.
public func setScaleXRange(minScaleX: CGFloat, maxScaleX: CGFloat)
{
_maxScaleX = maxScaleX;
setMinimumScaleX(minScaleX);
}
C. Inside limitTransAndScale()
/// limits the maximum scale and X translation of the given matrix
private func limitTransAndScale(inout #matrix: CGAffineTransform, content: CGRect?)
{
// min scale-x is 1f
_scaleX = max(_minScaleX, matrix.a);
.
.
Thanks
The text was updated successfully, but these errors were encountered: