GeezerVison is showing github.com — feat: スライドプレビューを fit-to-frame スケール描画に変更 (Fable #3) by ymnao · Pull Request #316 · ymnao/scripta
Conversation
概要
スライドプレビューを fit-to-frame スケール描画 に変更。固定論理サイズ 1280×720 (16:9) のステージに transform: scale() でコンテナに fit させる WYSIWYG プレビューへ移行。
Fable ロードマップ #3 (fit-to-frame スケール描画、M サイズ) に対応。#4 スライド PDF export の前提として、論理サイズ定数 SLIDE_LOGICAL_WIDTH / SLIDE_LOGICAL_HEIGHT を共通化。
関連 Issue
移行 Stage
- Stage 0: 雛形 + フロント表示確認
- Stage 1: ファイル I/O
- Stage 2: ワークスペース・ファイルツリー・ファイル監視
- Stage 3: 全文検索(ripgrep sidecar)
- Stage 4: Git Sync
- Stage 5: OGP / PDF / アップデート
- Stage 6: 仕上げ・配布・切り替え (スライド機能改善)
変更内容
- SlidePreview.tsx: 固定論理サイズ 1280×720 のステージ +
transform: scale() によるコンテナ fit。ResizeObserver + requestAnimationFrame coalesce で splitter drag 中も 60fps 上限に抑制。useLayoutEffect + 同期初回測定で初回描画 flash を回避
- SLIDE_LOGICAL_WIDTH / SLIDE_LOGICAL_HEIGHT を export: chore: Stage 0b — 旧 React フロントエンドのコピー + Tauri 直接依存差し替え #4 スライド PDF export で printToPDF の pageSize と共通の値を参照できるように準備
- CSS
.slide-preview-content: フォントを 14px → 28px、line-height 1.7 → 1.6 に。「1280×720 の presentation としての可読性」が基準になった旨をコメント化
- カウンター位置: pane が縦に長い場合でも frame 直下に貼りつくよう、boxRef 内側の flex-col に配置
- test-setup.ts: jsdom 用
ResizeObserver no-op mock (既存の Range / matchMedia の polyfill パターンと同 altitude)
- テスト: 論理サイズ 1280×720 が inline style に載る smoke を追加
動作確認
-
pnpm test (vitest renderer + main) — 2354 passed / 2 skipped (105 files)
-
pnpm typecheck (tsconfig.web / tsconfig.node / tsconfig.e2e) — clean
-
./node_modules/.bin/biome check — clean
-
./node_modules/.bin/electron-vite build — 成功
- codex-review security perspective — PASS (0 findings)
- 実 Electron e2e (sandbox listen EPERM のためローカル不可、CI で確認)
スクリーンショット
省略 (次セッションで実 Electron 起動時に取得予定)
検証エビデンス
リスク分類
tier: medium — フロントエンド UI の描画層変更、CSS フォントサイズ変更、ResizeObserver + requestAnimationFrame の新規導入
実行した検証
| 種別 |
コマンド |
結果 |
| ユニットテスト |
./node_modules/.bin/vitest run |
2354 passed / 2 skipped (105 files) |
| typecheck (renderer) |
./node_modules/.bin/tsc -p tsconfig.web.json --noEmit |
clean |
| typecheck (main) |
./node_modules/.bin/tsc -p tsconfig.node.json --noEmit |
clean |
| typecheck (e2e) |
./node_modules/.bin/tsc -p tsconfig.e2e.json --noEmit |
clean |
| Lint / Format |
./node_modules/.bin/biome check |
変更 6 files clean |
| Build |
./node_modules/.bin/electron-vite build |
✓ built in 466ms |
| レビュー |
/simplify (4 agents) |
5 findings apply (S1/S2/S3/E1/E2)、S4 skip、A1/A2 defer |
| レビュー |
/code-review medium (8 finder) |
2 confirmed apply、3 refuted、Altitude 4 件 defer |
| レビュー |
codex-review security |
PASS (0 findings) |
| 実 Electron e2e |
pnpm test:e2e:electron |
未実施 (sandbox listen EPERM のためローカル不可、CI で確認) |
| renderer-only e2e |
pnpm test:e2e |
未実施 (同上) |
レビュー指摘と対応
/simplify (round 1) 適用:
| Finding |
対応 |
S1: s > 0 ? s : 1 は early return と二重ガード |
setScale(Math.min(...)) に単純化 (c8014a9) |
S2: 内側 .slide-preview の冗長 overflow-hidden |
削除 (c8014a9) |
S3: padding: 64 inline |
Tailwind p-16 に統一 (c8014a9) |
| E1: ResizeObserver コールバックが rAF/debounce なし |
requestAnimationFrame で 1 フレームに coalesce (c8014a9) |
E2: useEffect による初回描画 flash |
useLayoutEffect + 同期初回測定に変更 (c8014a9) |
| S4: 新規 smoke test の情報量が乏しい |
skip: 論理サイズが DOM に載る wiring 確認として有効 |
Altitude A1: useFitScale フック抽出 |
defer: #5 発表モードで 2 番目の consumer が出た時点で自然抽出 |
| Altitude A2: 論理サイズ定数のドメイン層移動 |
defer: #4 PDF export で printToPDF 側が同定数を必要とした時が合流点 |
/code-review medium 適用:
| Finding |
対応 |
| B3: カウンター span が pane 下端に貼りつき frame と離れる |
boxRef 内側 flex-col に配置し gap-3 で frame 直下に (c8014a9) |
Cleanup: max-w-[1280px] ハードコード |
style={{ maxWidth: SLIDE_LOGICAL_WIDTH }} で SSOT に統一 (c8014a9) |
| overflow-hidden での長スライドクリップ (3 finder 一致) |
REFUTED: fit-to-frame WYSIWYG の趣旨で intentional (HANDOFF「実寸でどう収まるか」観点) |
| deps [] / clientWidth=0 で stuck |
PLAUSIBLE 低実害: 実 Chromium は observe() 時に初期 callback を発火 → scale 上書き |
typeof RO === 'undefined' dead branch |
現状維持: 6 文字の defensive guard、readability 高 |
| Altitude 4 件 (fit hook 抽出 / 論理定数のドメイン移動 / CSS-JS 結合 / test の impl 依存) |
defer: #4 PDF export or #5 発表モードの合流点まで |
| RO mock が callback 未保持 |
現時点実害なし: 将来 scale ロジック検証テストを書く時に見直し |
| Conventions (CLAUDE.md) |
0 finding |
codex-review security: PASS (0 findings)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
- 論理サイズ 1280×720 (16:9) の固定ステージに transform: scale() でコンテナ fit
- ResizeObserver + rAF-coalesced update で splitter drag 中も 60fps に coalesce
- useLayoutEffect + 同期初回測定で初回描画 flash を回避
- .slide-preview-content フォントを 14px→28px に (1280×720 presentation 基準)
- jsdom 用 ResizeObserver no-op mock を test-setup に注入
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.