feat: zoom content with Ctrl+wheel (5% step, 50-300%)

- Ctrl+wheel zooms preview and editor; 90ms throttle; preventDefault stops WebView2 page zoom
- Range widened to 50-300%, step unified at 5% for wheel, toolbar buttons and Ctrl +/-
- No mouse-anchor (same scrolling behavior as button zoom)
- Add agent/AGENTS.md: workspace boundary is the top rule; build/test temp dirs stay in target/
- build.ps1 redirects TEMP/TMP into target/tmp
This commit is contained in:
2026-10-21 16:23:00 +08:00
parent 1191cdd53b
commit 1e8cbea902
7 changed files with 94 additions and 9 deletions

View File

@@ -49,15 +49,18 @@
## 步骤 4:Ctrl + 滚轮
实现要点:
实现要点(已按确认调整):
- `document.addEventListener('wheel', handler, { passive: false })`。
- `window.addEventListener('wheel', handler, { passive: false })`。
- 只有 `e.ctrlKey` 时 `preventDefault()`,避免 WebView2 自己的页面缩放。
- 复用 `changeZoom(±ZOOM_STEP)`;建议按 `deltaY` 方向 + 80–120ms 节流,避免一次滚动跳很多级。
- 触控板双指捏合在 Chromium 里也表现为 `ctrlKey + wheel`,可顺带支持。
- 复用 `changeZoom(±ZOOM_STEP)`;`deltaY` 方向 + 90ms 节流。
- 步进统一为 **5%**(滚轮、工具栏按钮、`Ctrl +/-` 一致)。
- 范围 **50%–300%**;`Ctrl+0` 复位 100%。
- 不做鼠标位置锚点(与现有按钮缩放行为一致,滚动位置保持)。
- 触控板双指捏合在 Chromium 里也表现为 `ctrlKey + wheel`,顺带支持。
- 编辑模式下同样生效(`--content-scale` 已作用于 textarea)。
验收:预览/编辑都能缩放;范围仍为 70%–200%;Ctrl+0 复位;不触发浏览器缩放;不影响滚动。
验收:预览/编辑都能缩放;范围 50%–300%;Ctrl+0 复位;不触发浏览器缩放;不按 Ctrl 时滚动不受影响。
## 步骤 5:标题折叠
@@ -88,7 +91,7 @@
- [ ] 编辑 700ms 自动保存;关闭前落盘
- [ ] 外部修改提示与保护
- [ ] 查找(含中文输入法组合输入)
- [ ] Ctrl+滚轮、Ctrl+0、70%–200%
- [ ] Ctrl+滚轮、Ctrl+0、50%–300%
- [ ] 折叠状态与自动保存共存
- [ ] 代码配色浅/深
- [ ] 打印预览完整