Since: 0.9.4

resize

Description

This event is fired when alphaTab was resized and is about to rerender the music notation. Before the re-rendering on resize the settings will be updated in the related components. This means that any changes to the layout options or other display settings are considered. This allows to implement scenarios where maybe the scale or the layout mode dynamically changes along the resizing.

resize.net

Types

function(e)JavaScript
Action<ResizeEventArgs>.net

Parameters

ParametersTypeSummary
args.netAlphaTab.ResizeEventArgsThe information about the resize event.
argsJavaScriptalphaTab.ResizeEventArgsThe information about the resize event.

ResizeEventArgs Properties

ParametersTypeSummary
oldWidthJavaScriptintThe size before the resizing happened.
OldWidth.netintThe size before the resizing happened.
newWidthJavaScriptintThe size after the resize was complete.
NewWidth.netintThe size after the resize was complete.
settingsJavaScriptAlphaTab.SettingsThe settings currently used for rendering.
Settings.netAlphaTab.SettingsThe settings currently used for rendering.

Examples

const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
api.resize.on((args) => {
args.settings.scale = args.newWidth > 1300
? 1.5
: (args.newWidth > 800) ? 1.3 : 1;
});