图片滑动改为双层分页 + 相邻图预取,消除切图卡顿与空白
原实现松手时把拖到一半的图瞬移回中心再换 src,视觉上先跳一下; 新图又要等松手后才开始下载,所以会闪白。改为: - 双层 img:拖动方向确定后相邻图摆到另一侧,两图一起跟手移动, 松手各自滑到位(旧图滑出、新图滑入),不再瞬移 - 开图即用 Image 预取前后各一张(再往后一张),切图直接用已解码位图; 每次落定后补取新邻居,关窗清空引用 - 缩放/平移强制 transition:none,避免与滑动动画的过渡打架 - 连点方向键/快速连滑先收尾上一段动画,避免接替层被瞬移 - 第二层 img 由脚本创建,旧缓存 HTML 也能正常工作 css: 两层 img 绝对定位居中叠放 + will-change: transform
This commit is contained in:
@@ -852,7 +852,8 @@ footer { position: relative; flex: none; padding: 8px 12px calc(10px + env(safe-
|
||||
/* ================= 全屏查看器(搬自 index;图片单点放大+缩放,消息双击放大) ================= */
|
||||
#img-viewer { position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,0.93); display: flex; align-items: center; justify-content: center; overflow: hidden; }
|
||||
#img-viewer.hidden { display: none; }
|
||||
#img-viewer-img { max-width: 100vw; max-height: 88vh; touch-action: none; cursor: grab; user-select: none; -webkit-user-drag: none; }
|
||||
/* 两层 img 绝对定位居中叠放:滑动切换时旧图滑出、新图同步滑入(见 js/stream.js 的 slideTo) */
|
||||
#img-viewer img { position: absolute; inset: 0; margin: auto; max-width: 100vw; max-height: 88vh; touch-action: none; cursor: grab; user-select: none; -webkit-user-drag: none; will-change: transform; }
|
||||
/* 组内页码:底部居中悬浮,不参与命中测试(点它等于点背景会关闭) */
|
||||
#img-count { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 151; padding: 3px 12px; border-radius: 999px; background: rgba(0,0,0,0.5); color: #fff; font-size: 12px; letter-spacing: .5px; pointer-events: none; }
|
||||
#fs-viewer { position: fixed; inset: 0; z-index: 130; background: rgba(8,10,20,0.88); padding: 40px 14px 24px; overflow: auto; /* 缩放后支持横纵滚动 */ }
|
||||
|
||||
Reference in New Issue
Block a user