diff --git a/ui/system/edge_gesture_handler.js b/ui/system/edge_gesture_handler.js index 0642f15..ae0b85e 100644 --- a/ui/system/edge_gesture_handler.js +++ b/ui/system/edge_gesture_handler.js @@ -59,32 +59,26 @@ export class EdgeGestureHandler { this.edgeOverlays[edge.name] = overlay; // Add listeners to each edge overlay - overlay.addEventListener("touchstart", this.onEdgeTouchStart.bind(this), { + overlay.addEventListener("pointerdown", this.onEdgePointerDown.bind(this), { capture: false, }); - overlay.addEventListener("touchmove", this.onTouchMove.bind(this), { + overlay.addEventListener("pointermove", this.onPointerMove.bind(this), { capture: false, }); - overlay.addEventListener("touchend", this.onTouchEnd.bind(this), { + overlay.addEventListener("pointerup", this.onPointerUp.bind(this), { capture: false, }); - overlay.addEventListener("touchcancel", this.onTouchCancel.bind(this), { + overlay.addEventListener("pointercancel", this.onPointerCancel.bind(this), { capture: false, }); }); } - onEdgeTouchStart(event) { - if (event.touches.length !== 1) { - return; - } - - const touch = event.touches[0]; - - this.touchStartX = touch.clientX; - this.touchStartY = touch.clientY; - this.touchCurrentX = touch.clientX; - this.touchCurrentY = touch.clientY; + onEdgePointerDown(event) { + this.touchStartX = event.clientX; + this.touchStartY = event.clientY; + this.touchCurrentX = event.clientX; + this.touchCurrentY = event.clientY; // Set edge swipe state based on which edge was touched this.isEdgeSwipe = true; @@ -97,14 +91,13 @@ export class EdgeGestureHandler { event.preventDefault(); } - onTouchMove(event) { - if (!this.isEdgeSwipe || event.touches.length !== 1) { + onPointerMove(event) { + if (!this.isEdgeSwipe) { return; } - const touch = event.touches[0]; - this.touchCurrentX = touch.clientX; - this.touchCurrentY = touch.clientY; + this.touchCurrentX = event.clientX; + this.touchCurrentY = event.clientY; const deltaX = this.touchCurrentX - this.touchStartX; const deltaY = this.touchCurrentY - this.touchStartY; @@ -125,7 +118,7 @@ export class EdgeGestureHandler { } } - onTouchEnd() { + onPointerUp() { if (!this.isEdgeSwipe) { return; } @@ -142,7 +135,7 @@ export class EdgeGestureHandler { this.resetGestureState(); } - onTouchCancel() { + onPointerCancel() { this.resetGestureState(); this.animatePreviewOut(); } diff --git a/ui/system/mobile_notification_sheet.js b/ui/system/mobile_notification_sheet.js index c3b9bfc..c5df28b 100644 --- a/ui/system/mobile_notification_sheet.js +++ b/ui/system/mobile_notification_sheet.js @@ -86,24 +86,22 @@ export class MobileNotificationSheet extends LitElement { } // Touch handlers for swipe-to-dismiss - handleTouchStart(e, notification) { - const touch = e.touches[0]; + handlePointerDown(event, notification) { this.swipeState = { notification, - startX: touch.clientX, - currentX: touch.clientX, - element: e.currentTarget, + startX: event.clientX, + currentX: event.clientX, + element: event.currentTarget, }; - e.currentTarget.classList.add("swiping"); + event.currentTarget.classList.add("swiping"); } - handleTouchMove(e) { + handlePointerMove(event) { if (!this.swipeState) { return; } - const touch = e.touches[0]; - this.swipeState.currentX = touch.clientX; + this.swipeState.currentX = event.clientX; const deltaX = this.swipeState.currentX - this.swipeState.startX; // Only allow left swipe (dismiss) @@ -113,7 +111,7 @@ export class MobileNotificationSheet extends LitElement { } } - handleTouchEnd(e) { + handlePointerUp(event) { if (!this.swipeState) { return; } @@ -171,9 +169,9 @@ export class MobileNotificationSheet extends LitElement {
this.handleNotificationClick(notification)} - @touchstart=${(e) => this.handleTouchStart(e, notification)} - @touchmove=${this.handleTouchMove} - @touchend=${this.handleTouchEnd} + @pointerdown=${(e) => this.handlePointerDown(e, notification)} + @pointermove=${this.handlePointerMove} + @pointerup=${this.handlePointerUp} >
${notification.iconUrl diff --git a/ui/system/mobile_overview.js b/ui/system/mobile_overview.js index 9477716..0326208 100644 --- a/ui/system/mobile_overview.js +++ b/ui/system/mobile_overview.js @@ -76,23 +76,21 @@ export class MobileOverview extends LitElement { } // Touch handlers for swipe-up-to-close on cards - handleTouchStart(e, tab) { - const touch = e.touches[0]; + handlePointerDown(event, tab) { this.swipeState = { tab, - startY: touch.clientY, - currentY: touch.clientY, - element: e.currentTarget, + startY: event.clientY, + currentY: event.clientY, + element: event.currentTarget, }; } - handleTouchMove(e) { + handlePointerMove(event) { if (!this.swipeState) { return; } - const touch = e.touches[0]; - this.swipeState.currentY = touch.clientY; + this.swipeState.currentY = event.clientY; const deltaY = this.swipeState.currentY - this.swipeState.startY; // Only allow upward swipe (close) @@ -102,7 +100,7 @@ export class MobileOverview extends LitElement { } } - handleTouchEnd(e) { + handlePointerUp(event) { if (!this.swipeState) { return; } @@ -147,9 +145,9 @@ export class MobileOverview extends LitElement {
this.handleTabClick(tab)} - @touchstart=${(e) => this.handleTouchStart(e, tab)} - @touchmove=${this.handleTouchMove} - @touchend=${this.handleTouchEnd} + @pointerdown=${(e) => this.handlePointerDown(e, tab)} + @pointermove=${this.handlePointerMove} + @pointerup=${this.handlePointerUp} > ${tab.screenshotUrl ? html`