split touch events to enabled and supported. (#43)

This commit is contained in:
Miroslav Šedivý
2023-08-31 13:50:57 +02:00
committed by GitHub
parent 45c0b4527f
commit c71a9d7626
6 changed files with 46 additions and 12 deletions

View File

@ -195,7 +195,7 @@
// Initialize GestureHandler
this.gestureHandler = new GestureHandlerInit()
// bind touch handler using @Watch on hasTouchEvents
// bind touch handler using @Watch on supportedTouchEvents
// because we need to know if touch events are supported
// by the server before we can bind touch handler
@ -467,13 +467,19 @@
// touch and gesture handlers cannot be used together
//
@Watch('control.hasTouchEvents')
@Watch('control.enabledTouchEvents')
@Watch('control.supportedTouchEvents')
onTouchEventsChange() {
if (this.control.hasTouchEvents) {
this.unbindGestureHandler()
this.unbindGestureHandler()
this.unbindTouchHandler()
if (!this.control.enabledTouchEvents) {
return
}
if (this.control.supportedTouchEvents) {
this.bindTouchHandler()
} else {
this.unbindTouchHandler()
this.bindGestureHandler()
}
}