From e46805decab93dc40d8d13b74f8e56f635a3d314 Mon Sep 17 00:00:00 2001 From: Zhukj <3262118957> Date: Wed, 22 Apr 2026 11:17:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E9=95=BF?= =?UTF-8?q?=E6=8C=89=E4=BF=9D=E5=AD=98=E5=9B=BE=E7=89=87=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=8F=8A=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除不再需要的长按保存图片功能,包括HTML中的提示元素、CSS样式以及JS中的相关逻辑 将保存图片提示改为点击保存,简化用户操作流程 --- css/style.css | 21 --------------------- index.html | 3 +-- js/script.js | 45 ++------------------------------------------- 3 files changed, 3 insertions(+), 66 deletions(-) diff --git a/css/style.css b/css/style.css index 66309b6..3993103 100644 --- a/css/style.css +++ b/css/style.css @@ -526,27 +526,6 @@ html, body { display: none; } -/* 长按提示 */ -.long-press-tip { - position: fixed; - bottom: 20px; - left: 50%; - transform: translateX(-50%); - padding: 8px 16px; - background: rgba(0,0,0,0.7); - color: #fff; - font-size: 12px; - border-radius: 16px; - opacity: 0; - transition: opacity 0.3s; - pointer-events: none; - z-index: 1000; -} - -.long-press-tip.show { - opacity: 1; -} - /* 右键菜单 */ .context-menu { position: fixed; diff --git a/index.html b/index.html index f164575..3a43806 100644 --- a/index.html +++ b/index.html @@ -110,8 +110,7 @@ - -
长按屏幕可保存图片
+ diff --git a/js/script.js b/js/script.js index b67cc00..8895f3e 100644 --- a/js/script.js +++ b/js/script.js @@ -261,9 +261,6 @@ handleContainerClick(e); }); - // 初始化长按保存(只在3:5预览区域) - initLongPressSave(); - // 初始化右键菜单(只在3:5预览区域) initContextMenu(); @@ -276,13 +273,7 @@ // 加载默认背景图 loadDefaultBackground(); - // 显示长按提示 - setTimeout(() => { - longPressTip.classList.add('show'); - setTimeout(() => { - longPressTip.classList.remove('show'); - }, 3000); - }, 1000); + } // 加载默认背景图 @@ -1707,38 +1698,6 @@ editorToolbar.classList.remove('active'); } - // 初始化长按保存(只在3:5预览区域) - function initLongPressSave() { - // 只在图片容器上触发长按保存 - imageContainer.addEventListener('touchstart', (e) => { - // 如果触摸的是输入框,不触发长按保存 - if (e.target.closest('.text-input')) { - return; - } - - longPressTimer = setTimeout(() => { - if (navigator.vibrate) { - navigator.vibrate(50); - } - saveImage(); - }, 800); - }, { passive: true }); - - imageContainer.addEventListener('touchend', () => { - if (longPressTimer) { - clearTimeout(longPressTimer); - longPressTimer = null; - } - }); - - imageContainer.addEventListener('touchmove', () => { - if (longPressTimer) { - clearTimeout(longPressTimer); - longPressTimer = null; - } - }); - } - // 初始化右键菜单(只在3:5预览区域) function initContextMenu() { // 只在图片容器上禁用默认右键菜单并显示自定义菜单 @@ -2025,7 +1984,7 @@ `; const tipText = document.createElement('p'); - tipText.innerHTML = '长按图片保存到相册
(预览已缩放,实际保存为高清原图)'; + tipText.innerHTML = '预览图片
(点击保存到相册)'; tipText.style.cssText = ` color: #fff; font-size: 18px;