# Timeline Editor - Feature Roadmap
This document outlines planned enhancements for the interactive timeline editor.
---
## Known Bugs (High Priority)
### Audio Playback Integration Issues
1. **Audio waveform doesn't scale with zoom nor follow timeline**
- Waveform should horizontally sync with timeline ticks/sequences
- Should scale to match `pixelsPerSecond` zoom level
- Currently remains static regardless of zoom
2. **Playback indicator doesn't follow zoom and height issues**
- Vertical red bar position calculation doesn't account for `pixelsPerSecond`
- Doesn't reach bottom when sequences have scrolled
- Needs to span full `timeline-content` height dynamically
3. **Sequences overlap timeline at scroll origin**
- Some sequences still go behind timeline ticks
- Notably when wheel pans back to beginning (scrollLeft = 0)
- Need proper clipping or z-index management
4. **Timeline and waveform should be fixed, not floating**
- Currently using sticky positioning
- Should use true fixed positioning at top
- Should remain stationary regardless of scroll
5. **Status indicator causes reflow**
- Green status text appears/disappears causing layout shift
- Should be relocated to top or bottom as fixed/always-visible
- Prevents jarring reflow when messages appear
---
## Phase 1: Core Editing Features (High Priority)
### 1.1 Snap-to-Beat ⭐ Priority: HIGH
**Goal:** Enable precise musical timing by snapping items to beat boundaries.
**Features:**
- Parse BPM from demo.seq file (`# BPM 120`)
- Calculate beat grid based on BPM (e.g., 120 BPM = 0.5s per beat)
- Visual beat markers on timeline (lighter gray lines between second markers)
- Toggle snap mode (keyboard shortcut: `S` key)
- When dragging, snap position to nearest beat
- Status indicator showing current snap mode and BPM
**Implementation Details:**
```javascript
// Calculate beat positions
const beatsPerSecond = bpm / 60.0;
const secondsPerBeat = 60.0 / bpm;
// Snap function
function snapToBeat(timeInSeconds) {
if (!snapEnabled) return timeInSeconds;
const beatIndex = Math.round(timeInSeconds * beatsPerSecond);
return beatIndex * secondsPerBeat;
}
// Visual beat markers
for (let beat = 0; beat < maxBeats; beat++) {
const beatTime = beat * secondsPerBeat;
// Render subtle vertical line at beatTime
}
```
**UI Additions:**
- Checkbox: "☑️ Snap to Beat (S)" in zoom controls
- Display: "BPM: 120 | Beat: 0.5s" in status bar
- Visual: Dashed vertical lines at beat boundaries
**Effort:** 4-6 hours
**Dependencies:** None
**Impact:** Makes musical timing much easier
---
### 1.2 Create New Effects ⭐ Priority: HIGH
**Goal:** Add effects to sequences without manual property editing.
**Features:**
- "➕ Add Effect" button (enabled when sequence is selected)
- Modal dialog or inline form for effect creation:
- Effect class name (dropdown or autocomplete)
- Start time (relative to sequence)
- Duration
- Priority (default: 0)
- Constructor arguments (optional text field)
- Double-click on sequence to add effect at that position
- Right-click context menu option
**Implementation Details:**
```javascript
function showEffectCreationDialog(sequenceIndex, timeHint = 0) {
const dialog = document.createElement('div');
dialog.className = 'modal-dialog';
dialog.innerHTML = `
New Effect
`;
document.body.appendChild(dialog);
}
function createEffect() {
const effect = {
type: 'effect',
className: document.getElementById('newEffectClass').value,
startTime: parseFloat(document.getElementById('newEffectStart').value),
endTime: parseFloat(document.getElementById('newEffectStart').value) +
parseFloat(document.getElementById('newEffectDuration').value),
priority: parseInt(document.getElementById('newEffectPriority').value),
args: document.getElementById('newEffectArgs').value
};
sequences[selectedSequenceIndex].effects.push(effect);
closeDialog();
renderTimeline();
}
```
**UI Additions:**
- Button: "➕ Add Effect to Sequence" (appears when sequence selected)
- Modal dialog with form
- Context menu on right-click
- Keyboard shortcut: `E` key when sequence selected
**Effort:** 6-8 hours
**Dependencies:** Need list of available effect classes
**Impact:** Essential for productive editing
---
### 1.2b Priority Editing UI ⭐ Priority: HIGH
**Goal:** Enable visual editing of sequence and effect priorities.
**Features:**
- **Sequence Priority**: Edit absolute priority (0-9 for scene, 10+ for post-processing)
- **Effect Priority Modifier**: Toggle between `+`, `=`, `-` modifiers
- **Visual Priority Indicators**: Color-code or label items by priority level
- **Z-order visualization**: Show stacking order visually
**UI Design:**
**For Sequences:**
```
Properties Panel:
┌─────────────────────────────┐
│ Sequence Priority │
│ ┌─────────────────────────┐ │
│ │ Priority: [0] ▲▼ │ │
│ └─────────────────────────┘ │
│ (0-9: Scene, 10+: Post-FX) │
└─────────────────────────────┘
Visual indicator on timeline:
[0] Sequence 1 (dark blue)
[1] Sequence 2 (medium blue)
[5] Sequence 3 (light blue)
```
**For Effects:**
```
Properties Panel:
┌─────────────────────────────┐
│ Effect Priority Modifier │
│ ┌─────────────────────────┐ │
│ │ ○ + Increment (normal) │ │
│ │ ○ = Same as previous │ │
│ │ ● - Decrement (bg) │ │
│ └─────────────────────────┘ │
│ Computed priority: -1 │
└─────────────────────────────┘
Visual indicator on timeline:
[-1] FlashCubeEffect (darker gray, background)
[0] FlashEffect (normal gray)
[1] FadeEffect (lighter gray)
```
**Implementation:**
```javascript
// Sequence priority editor
function renderSequencePriorityEditor(seq) {
return `