Skip to content

Commit 56650c1

Browse files
committed
feat(android): disableScrollEnabled chart property
1 parent a396b35 commit 56650c1

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/ui-chart/charts/Chart.ts

+9-12
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ export abstract class Chart<U extends Entry, D extends IDataSet<U>, T extends Ch
168168
* Wether to filter highlights by axis. Default is true
169169
*/
170170
highlightsFilterByAxis = true;
171+
172+
/**
173+
* Wether to disable scroll while touching the chart. Default to true
174+
*/
175+
disableScrollEnabled = true;
171176
/**
172177
* tasks to be done after the view is setup
173178
*/
@@ -975,22 +980,14 @@ export abstract class Chart<U extends Entry, D extends IDataSet<U>, T extends Ch
975980
}
976981
}
977982

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;
988984
/**
989985
* disables intercept touchevents
990986
*/
991987
disableScroll() {
992-
if (__ANDROID__) {
988+
if (__ANDROID__ && this.disableScrollEnabled) {
993989
const parent: android.view.ViewParent = this.nativeViewProtected?.getParent();
990+
this.mDisallowInterceptTouchEvent = true;
994991
parent?.requestDisallowInterceptTouchEvent(true);
995992
}
996993
}
@@ -999,7 +996,7 @@ export abstract class Chart<U extends Entry, D extends IDataSet<U>, T extends Ch
999996
* enables intercept touchevents
1000997
*/
1001998
enableScroll() {
1002-
if (__ANDROID__) {
999+
if (__ANDROID__ && (this.disableScrollEnabled || this.mDisallowInterceptTouchEvent)) {
10031000
const parent: android.view.ViewParent = this.nativeViewProtected?.getParent();
10041001
parent?.requestDisallowInterceptTouchEvent(false);
10051002
}

0 commit comments

Comments
 (0)