@@ -168,6 +168,11 @@ export abstract class Chart<U extends Entry, D extends IDataSet<U>, T extends Ch
168
168
* Wether to filter highlights by axis. Default is true
169
169
*/
170
170
highlightsFilterByAxis = true ;
171
+
172
+ /**
173
+ * Wether to disable scroll while touching the chart. Default to true
174
+ */
175
+ disableScrollEnabled = true ;
171
176
/**
172
177
* tasks to be done after the view is setup
173
178
*/
@@ -975,22 +980,14 @@ export abstract class Chart<U extends Entry, D extends IDataSet<U>, T extends Ch
975
980
}
976
981
}
977
982
978
- /**
979
- * Setting this to true will set the layer-type HARDWARE for the view, false
980
- * will set layer-type SOFTWARE.
981
- *
982
- * @param enabled
983
- */
984
- public set hardwareAccelerationEnabled ( enabled ) {
985
- this . hardwareAccelerated = enabled ;
986
- }
987
-
983
+ mDisallowInterceptTouchEvent = true ;
988
984
/**
989
985
* disables intercept touchevents
990
986
*/
991
987
disableScroll ( ) {
992
- if ( __ANDROID__ ) {
988
+ if ( __ANDROID__ && this . disableScrollEnabled ) {
993
989
const parent : android . view . ViewParent = this . nativeViewProtected ?. getParent ( ) ;
990
+ this . mDisallowInterceptTouchEvent = true ;
994
991
parent ?. requestDisallowInterceptTouchEvent ( true ) ;
995
992
}
996
993
}
@@ -999,7 +996,7 @@ export abstract class Chart<U extends Entry, D extends IDataSet<U>, T extends Ch
999
996
* enables intercept touchevents
1000
997
*/
1001
998
enableScroll ( ) {
1002
- if ( __ANDROID__ ) {
999
+ if ( __ANDROID__ && ( this . disableScrollEnabled || this . mDisallowInterceptTouchEvent ) ) {
1003
1000
const parent : android . view . ViewParent = this . nativeViewProtected ?. getParent ( ) ;
1004
1001
parent ?. requestDisallowInterceptTouchEvent ( false ) ;
1005
1002
}
0 commit comments