diff --git a/app/static/js/app.jsx b/app/static/js/app.jsx index d2faeb2..0ce5f70 100644 --- a/app/static/js/app.jsx +++ b/app/static/js/app.jsx @@ -1206,7 +1206,12 @@ const TempoTrackLane = ({ if (!canvas) return; const ctx = canvas.getContext('2d'); const dpr = window.devicePixelRatio || 1; - const scrollLeftVal = scrollLeft || 0; + let el = canvas.parentElement; + for (let i = 0; i < 4 && el; i++) { + if (el.scrollWidth > el.clientWidth || getComputedStyle(el).overflowX === 'auto' || getComputedStyle(el).overflowX === 'scroll') break; + el = el.parentElement; + } + const scrollLeftVal = el && el.scrollWidth > el.clientWidth ? el.scrollLeft : (scrollLeft || 0); const height = canvas.parentElement ? canvas.parentElement.clientHeight : 40; canvas.width = Math.min(Math.round(drawWidth * dpr), 32768); canvas.height = Math.min(Math.round(height * dpr), 32768); diff --git a/wiki.md b/wiki.md index e571f73..7c3863c 100644 --- a/wiki.md +++ b/wiki.md @@ -9,6 +9,11 @@ - **Các file ảnh hưởng:** `app/static/js/app.jsx`, `app/core/vst_engine.py` - **Ghi chú/Test (nếu có):** `npm run build` pass. `vst_engine.py` thêm `load_soundfont_cached`, `release_soundfont`, `get_plugin_manager`, `_SF_INSTRUMENTS_CACHE` — refcount-based cache. +### [2026-07-25 07:25] Task: Fix auto-scroll + maxDuration tab isolation + 1-bar margin +- **Tóm tắt thay đổi:** (1) `maxDuration` dùng `activeTracks` + 4-bar buffer. (2) Cách ly MAIN vs SECTION-TAB. (3) Clip/section/MIDI drag/stretch/resize clamp 1-bar from right. (4) Clip drag + stretched clip dùng `updateActiveTracks`. (5) Stretched clip handler thêm auto-scroll. +- **Các file ảnh hưởng:** `app/static/js/app.jsx` +- **Ghi chú/Test (nếu có):** `npx babel app/static/js/app.jsx` — compile pass. + ### [2026-07-25 07:31] Task: Fix zoom cursor + right edge black + AI Copilot for Piano Roll - **Tóm tắt thay đổi:** (1) Tách `drawWidth` (content) và `cssWidth` (CSS) — canvas coordinate system không còn bị sai khi zoom out. (2) Thêm `min-width` fill viewport, không còn mảng đen phải. (3) Thêm AI Copilot input + handler trong Piano Roll — gõ prompt tạo MIDI notes trực tiếp. - **Các file ảnh hưởng:** `app/static/js/app.jsx` @@ -59,7 +64,8 @@ - **Các file ảnh hưởng:** `app/static/js/app.jsx` - **Ghi chú/Test (nếu có):** `npx babel app/static/js/app.jsx` — compile pass. -### [2026-07-25 07:25] Task: Fix auto-scroll + maxDuration tab isolation + 1-bar margin -- **Tóm tắt thay đổi:** (1) `maxDuration` dùng `activeTracks` + 4-bar buffer. (2) Cách ly MAIN vs SECTION-TAB. (3) Clip/section/MIDI drag/stretch/resize clamp 1-bar from right. (4) Clip drag + stretched clip dùng `updateActiveTracks`. (5) Stretched clip handler thêm auto-scroll. +### [2026-07-25 09:30] Task: Fix bar numbers disappear past bar 12 during drag +- **Tóm tắt thay đổi:** TempoTrackLane đọc `scrollLeft` từ DOM (walk parent chain tìm scroll container) thay vì React prop — canvas luôn dùng scroll position thực tế, không lag do async state. - **Các file ảnh hưởng:** `app/static/js/app.jsx` -- **Ghi chú/Test (nếu có):** `npx babel app/static/js/app.jsx` — compile pass. +- **Ghi chú/Test (nếu có):** +