Skip to content

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.

typescript
fullscreen(active: boolean): Promise<void>

Parameters:

  • active - boolean

Returns: Promise<void>

Throws:

  • Error - If fullscreen mode cannot be toggled (e.g., browser restrictions)

Examples:

typescript
// Enter fullscreen mode
await embed.fullscreen(true);
typescript
// 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.

typescript
print(): Promise<void>

Returns: Promise<void>

Throws:

  • Error - If no score is loaded or printing cannot be initiated

Examples:

typescript
// 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.

typescript
getZoom(): Promise<number>

Returns: Promise<number>

Throws:

  • Error - If the zoom level cannot be retrieved

Example:

typescript
const embed = new Embed('container', config);
const zoom = await embed.getZoom();
console.log(zoom);

See also:


setZoom()

Set the zoom ratio Sets a specific zoom level for the score display. Setting a manual zoom level automatically disables auto-zoom mode.

typescript
setZoom(zoom: number): Promise<number>

Parameters:

  • zoom - number

Returns: Promise<number>

Throws:

  • Error - If the zoom value is outside the valid range

Examples:

typescript
// Set zoom to 150%
await embed.setZoom(1.5);

See also:


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.

typescript
getAutoZoom(): Promise<boolean>

Returns: Promise<boolean>

Throws:

  • Error - If the status cannot be retrieved

Example:

typescript
const embed = new Embed('container', config);
const autoZoom = await embed.getAutoZoom();
console.log(autoZoom);

See also:


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.

typescript
setAutoZoom(state: boolean): Promise<boolean>

Parameters:

  • state - boolean

Returns: Promise<boolean>

Throws:

  • Error - If auto-zoom cannot be toggled

Examples:

typescript
// Enable auto-zoom
await embed.setAutoZoom(true);

See also:


Copyright © Tutteo Limited