1.7 KiB
Engine Zoom Helpers
(no submodules)
Purpose
The zoom.ts module bridges TimelineEngine zoom, selection, and loop public methods to the pure timeline-operations.ts and zoom.ts helpers. It manages internal state updates and event emission so the engine class stays focused on high-level orchestration.
Features
engineZoomIn/engineZoomOutstep through the zoom table and emitzoomChangeengineSetZoomLevelsnaps to the nearest table entryengineSetSelectionnormalises ranges and emitsselectionChangeengineSetLoopRegionupdates loop bounds and forwards to adapterengineSetLoopEnabledtoggles loop and forwards to adapter
Usage
These helpers are used internally by TimelineEngine. Consumers call engine.zoomIn() etc.
API Reference
| Export | Signature | Description |
|---|---|---|
engineZoomIn |
(deps) => void |
Zoom in |
engineZoomOut |
(deps) => void |
Zoom out |
engineSetZoomLevel |
(deps, samplesPerPixel) => void |
Set zoom |
engineSetSelection |
(deps, start, end) => void |
Set selection |
engineSetLoopRegion |
(deps, start, end) => void |
Set loop region |
engineSetLoopEnabled |
(deps, enabled) => void |
Toggle loop |
Implementation Notes
The ZoomDeps interface isolates the helpers from the engine class, making them testable in isolation. Loop changes are forwarded to the adapter immediately so the audio backend can update its loop markers. Selection changes are clamped to the current document duration so invalid ranges cannot be created. Zoom changes only affect the view and do not touch the arrangement, which is why they bypass the undo stack entirely.