Display & View
Control the visual presentation of the score
Methods
fullscreen()
Toggle fullscreen mode Switches the embed in or out of fullscreen mode. When in fullscreen, the embed expands to fill the entire screen, providing an immersive view of the score.
fullscreen(active: boolean): Promise<void>
Parameters:
active
-boolean
Returns: Promise<void>
Throws:
Error
- If fullscreen mode cannot be toggled (e.g., browser restrictions)
Examples:
// Enter fullscreen mode
await embed.fullscreen(true);
// Exit fullscreen mode
await embed.fullscreen(false);
Note: Fullscreen requests may require user interaction due to browser policies
print()
Print the score Opens the browser's print dialog to print the currently loaded score. The score is formatted for optimal printing with proper page breaks and sizing.
print(): Promise<void>
Returns: Promise<void>
Throws:
Error
- If no score is loaded or printing cannot be initiated
Examples:
// Print the current score
await embed.print();
Note: The actual printing is controlled by the browser's print dialog
getZoom()
Get the current zoom ratio Retrieves the current zoom level of the score display. The zoom level affects how large the notation appears on screen.
getZoom(): Promise<number>
Returns: Promise<number>
Throws:
Error
- If the zoom level cannot be retrieved
Example:
const embed = new Embed('container', config);
const zoom = await embed.getZoom();
console.log(zoom);
See also:
setZoom()
- Set the zoom levelgetAutoZoom()
- Check if auto-zoom is enabled
setZoom()
Set the zoom ratio Sets a specific zoom level for the score display. Setting a manual zoom level automatically disables auto-zoom mode.
setZoom(zoom: number): Promise<number>
Parameters:
zoom
-number
Returns: Promise<number>
Throws:
Error
- If the zoom value is outside the valid range
Examples:
// Set zoom to 150%
await embed.setZoom(1.5);
See also:
getZoom()
- Get current zoom levelsetAutoZoom()
- Enable automatic zoom
getAutoZoom()
Get the auto-zoom status Checks whether auto-zoom mode is currently enabled. When auto-zoom is active, the score automatically adjusts its zoom level to fit the available space.
getAutoZoom(): Promise<boolean>
Returns: Promise<boolean>
Throws:
Error
- If the status cannot be retrieved
Example:
const embed = new Embed('container', config);
const autoZoom = await embed.getAutoZoom();
console.log(autoZoom);
See also:
setAutoZoom()
- Enable or disable auto-zoom
setAutoZoom()
Enable or disable auto-zoom Controls the auto-zoom feature. When enabled, the score automatically adjusts its zoom level to fit the available container width. When disabled, the zoom level remains fixed at the last set value.
setAutoZoom(state: boolean): Promise<boolean>
Parameters:
state
-boolean
Returns: Promise<boolean>
Throws:
Error
- If auto-zoom cannot be toggled
Examples:
// Enable auto-zoom
await embed.setAutoZoom(true);
See also:
getAutoZoom()
- Check current auto-zoom statussetZoom()
- Set a specific zoom level