-
-
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
Allow turning off drag in X and Y axes separately. #2413
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2413 +/- ##
==========================================
- Coverage 19.65% 19.64% -0.02%
==========================================
Files 112 112
Lines 13714 13727 +13
==========================================
Hits 2696 2696
- Misses 11018 11031 +13
Continue to review full report at Codecov.
|
+1 on that Request |
+1 - I made a similar change, but your is much better! |
wow I missed this.. Will try to review and merge |
@@ -29,6 +29,8 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD | |||
fileprivate var _pinchZoomEnabled = false | |||
fileprivate var _doubleTapToZoomEnabled = true | |||
fileprivate var _dragEnabled = true | |||
fileprivate var _dragYEnabled = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we change to false
by default? Ideally this should be set by user explicitly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dragEnabled
is true by default. Having dragYEnabled
false by default would change the current default behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, my bad. Lots of ||
and !
..
Seems like you are disabling the beginning of the drag gesture if it's in the wrong direction, |
I've only tested it when the chart is in a scroll view itself, so this didn't come up. Thanks! |
@danielgindi you are back 😃 |
Hey I'm always here, watching over you ;-) |
Thanks! Hope your daughter sleep well. My 8-month boy would wake up several times in the evening, kind of killing me.. haha |
Allow turning off drag in X and Y axes separately.
Currently if a chart is inside a scroll view and drag is enabled, the chart pan gesture recognizes all pan events and the containing scroll view doesn't work.
This PR allows enabling/disabling drag in either axis separately. Probably the most common use case would be enabling scale only in the X direction and enabling drag only in the X direction, so a vertically scrolling scroll view can work normally: