fix: clip section sub-track content to section bounds

When section duration is resized shorter, sub-track clips and MIDI
notes were still drawn outside the section's visual rectangle.
Added ctx.save/clip/restore around sub-track rendering.
This commit is contained in:
2026-07-25 11:39:43 +07:00
parent e0531be65b
commit e90c929885
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -712,6 +712,10 @@ const WaveformLane = ({
const subTrackCount = Math.min(subTracks.length, 4);
const subTrackHeight = (height - 20) / Math.max(1, subTrackCount);
const subColors = ['#fbbf24', '#a78bfa', '#ec4899', '#10b981'];
ctx.save();
ctx.beginPath();
ctx.rect(secStartLocal, 2, secWidth, height - 4);
ctx.clip();
for (let stIdx = 0; stIdx < subTrackCount; stIdx++) {
const sub = subTracks[stIdx];
if (!sub) continue;
@@ -767,6 +771,7 @@ const WaveformLane = ({
});
});
}
ctx.restore();
});
// Draw MIDI items