@coderline/alphatab 1.3.0-alpha.422 → 1.3.0-alpha.424
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alphaTab.js +60 -23
- package/dist/alphaTab.min.js +2 -2
- package/dist/alphaTab.min.mjs +2 -2
- package/dist/alphaTab.mjs +60 -23
- package/package.json +1 -1
package/dist/alphaTab.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* alphaTab v1.3.0-alpha.
|
|
2
|
+
* alphaTab v1.3.0-alpha.424 (develop, build 424)
|
|
3
3
|
*
|
|
4
4
|
* Copyright © 2022, Daniel Kuschny and Contributors, All rights reserved.
|
|
5
5
|
*
|
|
@@ -25922,52 +25922,89 @@
|
|
|
25922
25922
|
}
|
|
25923
25923
|
}, 5000);
|
|
25924
25924
|
Logger.debug('Font', `Start checking for font availablility: ${this._families.join(', ')}`);
|
|
25925
|
-
let errorHandler = () => {
|
|
25925
|
+
let errorHandler = (e) => {
|
|
25926
25926
|
if (this._families.length > 1) {
|
|
25927
|
-
Logger.debug('Font', `[${this._families[0]}] Loading Failed, switching to ${this._families[1]}
|
|
25927
|
+
Logger.debug('Font', `[${this._families[0]}] Loading Failed, switching to ${this._families[1]}`, e);
|
|
25928
25928
|
this._families.shift();
|
|
25929
25929
|
window.setTimeout(() => {
|
|
25930
|
+
// tslint:disable-next-line: no-floating-promises
|
|
25930
25931
|
checkFont();
|
|
25931
25932
|
}, 0);
|
|
25932
25933
|
}
|
|
25933
25934
|
else {
|
|
25934
|
-
Logger.error('Font', `[${this._originalFamilies.join(',')}] Loading Failed, rendering cannot start
|
|
25935
|
+
Logger.error('Font', `[${this._originalFamilies.join(',')}] Loading Failed, rendering cannot start`, e);
|
|
25935
25936
|
window.clearInterval(failCounterId);
|
|
25937
|
+
debugger;
|
|
25936
25938
|
}
|
|
25937
25939
|
};
|
|
25938
25940
|
let successHandler = (font) => {
|
|
25939
|
-
Logger.debug('
|
|
25941
|
+
Logger.debug('Font', `[${font}] Font API signaled available`);
|
|
25940
25942
|
this.isFontLoaded = true;
|
|
25941
25943
|
window.clearInterval(failCounterId);
|
|
25942
25944
|
this.fontLoaded.trigger(this._families[0]);
|
|
25943
25945
|
};
|
|
25944
|
-
let checkFont = () => {
|
|
25946
|
+
let checkFont = async () => {
|
|
25945
25947
|
// Fast Path: check if one of the specified fonts is already available.
|
|
25946
25948
|
for (const font of this._families) {
|
|
25947
|
-
if (
|
|
25949
|
+
if (await this.isFontAvailable(font, false)) {
|
|
25948
25950
|
successHandler(font);
|
|
25949
25951
|
return;
|
|
25950
25952
|
}
|
|
25951
25953
|
}
|
|
25952
25954
|
// Slow path: Wait for fonts to be loaded sequentially
|
|
25953
|
-
|
|
25954
|
-
|
|
25955
|
-
|
|
25956
|
-
|
|
25957
|
-
|
|
25958
|
-
|
|
25959
|
-
|
|
25960
|
-
|
|
25961
|
-
|
|
25962
|
-
|
|
25963
|
-
|
|
25964
|
-
errorHandler();
|
|
25965
|
-
}
|
|
25955
|
+
try {
|
|
25956
|
+
await document.fonts.load(`1em ${this._families[0]}`);
|
|
25957
|
+
}
|
|
25958
|
+
catch (e) {
|
|
25959
|
+
errorHandler(e);
|
|
25960
|
+
}
|
|
25961
|
+
Logger.debug('Font', `[${this._families[0]}] Font API signaled loaded`);
|
|
25962
|
+
if (await this.isFontAvailable(this._families[0], true)) {
|
|
25963
|
+
successHandler(this._families[0]);
|
|
25964
|
+
}
|
|
25965
|
+
else {
|
|
25966
|
+
errorHandler('Font not available');
|
|
25967
|
+
}
|
|
25968
|
+
return true;
|
|
25966
25969
|
};
|
|
25967
25970
|
document.fonts.ready.then(() => {
|
|
25971
|
+
// tslint:disable-next-line: no-floating-promises
|
|
25968
25972
|
checkFont();
|
|
25969
25973
|
});
|
|
25970
25974
|
}
|
|
25975
|
+
isFontAvailable(family, advancedCheck) {
|
|
25976
|
+
return new Promise(resolve => {
|
|
25977
|
+
// In some very rare occasions Chrome reports false for the font.
|
|
25978
|
+
// in this case we try to force some refresh and reload by creating an element with this font.
|
|
25979
|
+
const fontString = '1em ' + family;
|
|
25980
|
+
if (document.fonts.check(fontString)) {
|
|
25981
|
+
resolve(true);
|
|
25982
|
+
}
|
|
25983
|
+
else if (advancedCheck) {
|
|
25984
|
+
Logger.debug('Font', `Font ${family} not available, creating test element to trigger load`);
|
|
25985
|
+
const testElement = document.createElement('div');
|
|
25986
|
+
testElement.style.font = fontString;
|
|
25987
|
+
testElement.style.opacity = '0';
|
|
25988
|
+
testElement.style.position = 'absolute';
|
|
25989
|
+
testElement.style.top = '0';
|
|
25990
|
+
testElement.style.left = '0';
|
|
25991
|
+
testElement.innerText = `Trigger ${family} load`;
|
|
25992
|
+
document.body.appendChild(testElement);
|
|
25993
|
+
setTimeout(() => {
|
|
25994
|
+
document.body.removeChild(testElement);
|
|
25995
|
+
if (document.fonts.check(fontString)) {
|
|
25996
|
+
resolve(true);
|
|
25997
|
+
}
|
|
25998
|
+
else {
|
|
25999
|
+
resolve(false);
|
|
26000
|
+
}
|
|
26001
|
+
}, 200);
|
|
26002
|
+
}
|
|
26003
|
+
else {
|
|
26004
|
+
resolve(false);
|
|
26005
|
+
}
|
|
26006
|
+
});
|
|
26007
|
+
}
|
|
25971
26008
|
}
|
|
25972
26009
|
|
|
25973
26010
|
/**
|
|
@@ -27387,7 +27424,7 @@
|
|
|
27387
27424
|
if (this._api.settings.core.enableLazyLoading) {
|
|
27388
27425
|
this._intersectionObserver.unobserve(canvasElement.lastChild);
|
|
27389
27426
|
}
|
|
27390
|
-
canvasElement.removeChild(canvasElement.
|
|
27427
|
+
canvasElement.removeChild(canvasElement.lastElementChild);
|
|
27391
27428
|
}
|
|
27392
27429
|
}
|
|
27393
27430
|
else {
|
|
@@ -41387,8 +41424,8 @@
|
|
|
41387
41424
|
// </auto-generated>
|
|
41388
41425
|
class VersionInfo {
|
|
41389
41426
|
}
|
|
41390
|
-
VersionInfo.version = '1.3.0-alpha.
|
|
41391
|
-
VersionInfo.date = '2022-10-
|
|
41427
|
+
VersionInfo.version = '1.3.0-alpha.424';
|
|
41428
|
+
VersionInfo.date = '2022-10-17T01:10:24.242Z';
|
|
41392
41429
|
|
|
41393
41430
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
41394
41431
|
__proto__: null,
|