Skip to content

Commit

Permalink
Taking the y scale into account to allow / block further zooming.
Browse files Browse the repository at this point in the history
  • Loading branch information
iangmaia committed Oct 12, 2015
1 parent 4009962 commit e1b4982
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Charts/Classes/Charts/BarLineChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,9 @@ public class BarLineChartViewBase: ChartViewBase, UIGestureRecognizerDelegate
{
let isZoomingOut = (recognizer.scale < 1)
let canZoomMoreX = isZoomingOut ? _viewPortHandler.canZoomOutMoreX : _viewPortHandler.canZoomInMoreX
let canZoomMoreY = isZoomingOut ? _viewPortHandler.canZoomOutMoreY : _viewPortHandler.canZoomInMoreY

if (_isScaling && canZoomMoreX)
if (_isScaling && canZoomMoreX && canZoomMoreY)
{
if (_gestureScaleAxis == .Both || _gestureScaleAxis == .Y && _scaleYEnabled)
{
Expand Down
10 changes: 10 additions & 0 deletions Charts/Classes/Utils/ChartViewPortHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -457,4 +457,14 @@ public class ChartViewPortHandler: NSObject
{
return (_scaleX < _maxScaleX)
}

public var canZoomOutMoreY: Bool
{
return (_scaleY > _minScaleY)
}

public var canZoomInMoreY: Bool
{
return (_scaleY < _maxScaleY)
}
}

0 comments on commit e1b4982

Please sign in to comment.