diff --git a/client/src/components/video.vue b/client/src/components/video.vue index 6f13e429..e97c4fc9 100644 --- a/client/src/components/video.vue +++ b/client/src/components/video.vue @@ -21,6 +21,9 @@ @mouseup.stop.prevent="onMouseUp" @mouseenter.stop.prevent="onMouseEnter" @mouseleave.stop.prevent="onMouseLeave" + @touchmove.stop.prevent="onTouchHandler" + @touchstart.stop.prevent="onTouchHandler" + @touchend.stop.prevent="onTouchHandler" />
@@ -688,6 +691,35 @@ } } + onTouchHandler(e: TouchEvent) { + let first = e.changedTouches[0] + let type = '' + switch (e.type) { + case 'touchstart': + type = 'mousedown' + break + case 'touchmove': + type = 'mousemove' + break + case 'touchend': + type = 'mouseup' + break + default: + return + } + + const simulatedEvent = new MouseEvent(type, { + bubbles: true, + cancelable: true, + view: window, + screenX: first.screenX, + screenY: first.screenY, + clientX: first.clientX, + clientY: first.clientY, + }) + first.target.dispatchEvent(simulatedEvent) + } + onMouseDown(e: MouseEvent) { if (!this.hosting) { this.$emit('control-attempt', e)