From 56d8f46434edc4327c31807efbf94bdcc373cd99 Mon Sep 17 00:00:00 2001 From: Franzz Date: Wed, 9 Sep 2026 23:48:24 +0200 Subject: [PATCH] Smoother touch panel sliding --- src/components/Project.vue | 18 +++++----- src/components/ProjectFeed.vue | 24 +++---------- src/components/ProjectSettings.vue | 9 +++-- src/scripts/swipeToClose.js | 54 +++++++++++++++++++++++++++++ src/styles/_mobile.scss | 4 +-- src/styles/_page.project.panel.scss | 11 +++--- 6 files changed, 81 insertions(+), 39 deletions(-) create mode 100644 src/scripts/swipeToClose.js diff --git a/src/components/Project.vue b/src/components/Project.vue index 0230a17..6cb6ed0 100644 --- a/src/components/Project.vue +++ b/src/components/Project.vue @@ -229,14 +229,6 @@ export default { v-model:base-map="baseMap" :terrain-enabled="terrainEnabled" /> - + - + diff --git a/src/components/ProjectFeed.vue b/src/components/ProjectFeed.vue index 7e50ba5..d1ad4ac 100644 --- a/src/components/ProjectFeed.vue +++ b/src/components/ProjectFeed.vue @@ -3,6 +3,7 @@ import Simplebar from 'simplebar-vue'; import AppIcon from '@components/AppIcon'; import ProjectPost from '@components/ProjectPost'; +import { createSwipeToClose, initialSwipeState } from '@scripts/swipeToClose'; export default { components: { @@ -26,7 +27,7 @@ export default { isOpen: false, posts: [], refreshRate: 60, - swipe: {x: null, y: null} + swipe: initialSwipeState() }; }, emits: ['request-last-update', 'new-markers', 'toggle'], @@ -76,7 +77,6 @@ export default { this.refIdLast = 0; this.firstChunk = true; this.posts = []; - this.swipe = {x: null, y: null}; this.toggle(!this.isMobile(), 0); this.getScrollElement().scrollTop = 0; @@ -162,23 +162,7 @@ export default { if((box.scrollTop + box.clientHeight) / (content?.offsetHeight || 1) >= 0.8) this.getNextFeed(); }, - onTouchStart(oEvent) { - if(!this.isMobile() || !this.isOpen || oEvent.touches.length != 1) return; - - const oTouch = oEvent.touches[0]; - this.swipe = {x: oTouch.clientX, y: oTouch.clientY}; - }, - onTouchEnd(oEvent) { - const oTouch = oEvent.changedTouches[0]; - if(!oTouch || this.swipe.x === null) return; - - const iDeltaX = oTouch.clientX - this.swipe.x; - const iDeltaY = oTouch.clientY - this.swipe.y; - - if(iDeltaX > 80 && Math.abs(iDeltaX) > Math.abs(iDeltaY) * 1.5) this.toggle(); - - this.swipe = {x: null, y: null}; - }, + ...createSwipeToClose(1), setUpdateTimer(iSeconds) { if(typeof this.feedTimer != 'undefined') clearTimeout(this.feedTimer); if(iSeconds >= 0) this.feedTimer = setTimeout(this.onUpdateTimer, iSeconds * 1000); @@ -224,7 +208,7 @@ export default {