This commit is contained in:
Devon22 2026-07-02 23:47:18 +08:00
parent 95b302bff6
commit 8a6a48f280
4 changed files with 25 additions and 8 deletions

View file

@ -1,9 +1,9 @@
{
"id": "gridexplorer",
"name": "GridExplorer",
"version": "3.4.13",
"version": "3.4.14",
"minAppVersion": "1.8.7",
"description": "Browse note files in a grid view.",
"description": "Browse and organize note files visually in a flexible grid layout.",
"author": "Devon22",
"authorUrl": "https://github.com/Devon22",
"isDesktopOnly": false

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "gridexplorer",
"version": "3.4.13",
"version": "3.4.14",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "gridexplorer",
"version": "3.4.13",
"version": "3.4.14",
"license": "MIT",
"dependencies": {
"jszip": "^3.10.1"

View file

@ -1,7 +1,7 @@
{
"name": "gridexplorer",
"version": "3.4.13",
"description": "Browse note files in a grid view.",
"version": "3.4.14",
"description": "Browse and organize note files visually in a flexible grid layout.",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",

View file

@ -104,6 +104,7 @@ export class GridPreviewManager {
let initialScrollTop = 0;
let isAtTop = false;
let isAtBottom = false;
let isFromEdge = false;
const handleTouchStart = (e: TouchEvent) => {
if (e.touches.length > 1) return;
@ -125,11 +126,28 @@ export class GridPreviewManager {
isDragging = false;
isPullingUp = false;
isHorizontalDragging = false;
const edgeThreshold = 24;
isFromEdge = startX < edgeThreshold || startX > window.innerWidth - edgeThreshold;
// Obsidian 自身的 swipe 手勢會在方向判斷完成前就介入,
// 所以必須在 touchstart 一開始就 stopPropagation
// 僅保留螢幕邊緣 24px 讓系統返回手勢通過
if (!isFromEdge) {
e.stopPropagation();
}
};
const handleTouchMove = (e: TouchEvent) => {
if (e.touches.length > 1) return;
// 理由同 handleTouchStart必須盡早攔截以避免 Obsidian 手勢介入
if (!isFromEdge) {
e.stopPropagation();
} else {
return;
}
currentY = e.touches[0].clientY;
currentX = e.touches[0].clientX;
const deltaY = currentY - startY;
@ -168,7 +186,6 @@ export class GridPreviewManager {
// 只有在進入我們自己定義的拖曳狀態時,才攔截事件與阻止預設行為
if (isHorizontalDragging || isDragging) {
e.stopPropagation();
if (e.cancelable) {
e.preventDefault();
}
@ -196,7 +213,7 @@ export class GridPreviewManager {
};
const handleTouchEnd = (e: TouchEvent) => {
if (isHorizontalDragging || isDragging) {
if (!isFromEdge) {
e.stopPropagation();
}