feat: apply defaultTrackHeight and defaultZoom settings
- Modified createTrack and createTrackFromBuffer to accept height parameter - Updated useMultiTrack to pass height when creating tracks - Applied settings.ui.defaultTrackHeight when adding new tracks - Applied settings.editor.defaultZoom for initial zoom state - Removed duplicate useSettings hook declaration in AudioEditor - New tracks now use configured default height from settings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ export function generateTrackId(): string {
|
||||
/**
|
||||
* Create a new empty track
|
||||
*/
|
||||
export function createTrack(name?: string, color?: TrackColor): Track {
|
||||
export function createTrack(name?: string, color?: TrackColor, height?: number): Track {
|
||||
const colors: TrackColor[] = ['blue', 'green', 'purple', 'orange', 'pink', 'indigo', 'yellow', 'red'];
|
||||
const randomColor = colors[Math.floor(Math.random() * colors.length)];
|
||||
|
||||
@@ -30,7 +30,7 @@ export function createTrack(name?: string, color?: TrackColor): Track {
|
||||
id: trackId,
|
||||
name: trackName,
|
||||
color: TRACK_COLORS[color || randomColor],
|
||||
height: DEFAULT_TRACK_HEIGHT,
|
||||
height: height ?? DEFAULT_TRACK_HEIGHT,
|
||||
audioBuffer: null,
|
||||
volume: 0.8,
|
||||
pan: 0,
|
||||
@@ -70,11 +70,12 @@ export function createTrack(name?: string, color?: TrackColor): Track {
|
||||
export function createTrackFromBuffer(
|
||||
buffer: AudioBuffer,
|
||||
name?: string,
|
||||
color?: TrackColor
|
||||
color?: TrackColor,
|
||||
height?: number
|
||||
): Track {
|
||||
// Ensure name is a string before passing to createTrack
|
||||
const trackName = typeof name === 'string' && name.trim() ? name.trim() : undefined;
|
||||
const track = createTrack(trackName, color);
|
||||
const track = createTrack(trackName, color, height);
|
||||
track.audioBuffer = buffer;
|
||||
return track;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user