Spaces:
Running on Zero
Running on Zero
Commit Β·
977875e
1
Parent(s): b94a4ba
fix: centre crossfade hatch on color boundary, not after it
Browse filesHatch was drawn at [seg[i+1].start, seg[i].end] which sat entirely inside
seg i+1's color block β visually after the edge. The color boundary IS at
seg[i+1].start, so hatch is now centred there: half crossfade on each side.
app.py
CHANGED
|
@@ -1750,16 +1750,14 @@ def _build_waveform_html(audio_path: str, segments: list, slot_id: str,
|
|
| 1750 |
}});
|
| 1751 |
|
| 1752 |
// ββ Crossfade overlap indicators ββ
|
| 1753 |
-
// The
|
| 1754 |
-
//
|
| 1755 |
-
// - first crossfadeSec of seg i+1 fades IN
|
| 1756 |
-
// Both halves are the same duration (crossfadeSec) and occupy the same
|
| 1757 |
-
// time range, so we draw the hatch centred on the join boundary.
|
| 1758 |
if (crossfadeSec > 0 && segments.length > 1) {{
|
| 1759 |
for (let i = 0; i < segments.length - 1; i++) {{
|
| 1760 |
-
//
|
| 1761 |
-
const
|
| 1762 |
-
const
|
|
|
|
| 1763 |
const xL = (overlapStart / duration) * W;
|
| 1764 |
const xR = (overlapEnd / duration) * W;
|
| 1765 |
// Diagonal hatch pattern over the overlap zone
|
|
|
|
| 1750 |
}});
|
| 1751 |
|
| 1752 |
// ββ Crossfade overlap indicators ββ
|
| 1753 |
+
// The color boundary is at segments[i+1][0] (= seg_i.end - crossfadeSec).
|
| 1754 |
+
// We centre the hatch on that edge: half the crossfade on each color side.
|
|
|
|
|
|
|
|
|
|
| 1755 |
if (crossfadeSec > 0 && segments.length > 1) {{
|
| 1756 |
for (let i = 0; i < segments.length - 1; i++) {{
|
| 1757 |
+
// Color edge = segments[i+1][0], hatch spans half on each side
|
| 1758 |
+
const edgeT = segments[i+1][0];
|
| 1759 |
+
const overlapStart = edgeT - crossfadeSec / 2;
|
| 1760 |
+
const overlapEnd = edgeT + crossfadeSec / 2;
|
| 1761 |
const xL = (overlapStart / duration) * W;
|
| 1762 |
const xR = (overlapEnd / duration) * W;
|
| 1763 |
// Diagonal hatch pattern over the overlap zone
|