@@ -74,10 +74,12 @@ export class LayoutEngineFactory {
7474
7575export class RenderEngineFactory {
7676 public readonly supportsWorkers : boolean ;
77+ public readonly supportsDomHighlighting : boolean ;
7778 public readonly createCanvas : ( ) => ICanvas ;
7879
79- public constructor ( supportsWorkers : boolean , canvas : ( ) => ICanvas ) {
80+ public constructor ( supportsWorkers : boolean , supportsDomHighlighting : boolean , canvas : ( ) => ICanvas ) {
8081 this . supportsWorkers = supportsWorkers ;
82+ this . supportsDomHighlighting = supportsDomHighlighting ;
8183 this . createCanvas = canvas ;
8284 }
8385}
@@ -423,15 +425,15 @@ export class Environment {
423425 const renderEngines = new Map < string , RenderEngineFactory > ( ) ;
424426 renderEngines . set (
425427 'svg' ,
426- new RenderEngineFactory ( true , ( ) => {
428+ new RenderEngineFactory ( true , true , ( ) => {
427429 return new CssFontSvgCanvas ( ) ;
428430 } )
429431 ) ;
430432 renderEngines . set ( 'default' , renderEngines . get ( 'svg' ) ! ) ;
431433
432434 renderEngines . set (
433435 'skia' ,
434- new RenderEngineFactory ( false , ( ) => {
436+ new RenderEngineFactory ( false , false , ( ) => {
435437 return new SkiaCanvas ( ) ;
436438 } )
437439 ) ;
@@ -442,11 +444,11 @@ export class Environment {
442444
443445 /**
444446 * Enables the usage of alphaSkia as rendering backend.
445- * @param musicFontData The raw binary data of the music font.
447+ * @param musicFontData The raw binary data of the music font.
446448 * @param alphaSkia The alphaSkia module.
447449 */
448450 public static enableAlphaSkia ( musicFontData : ArrayBuffer , alphaSkia : unknown ) {
449- SkiaCanvas . enable ( musicFontData , alphaSkia )
451+ SkiaCanvas . enable ( musicFontData , alphaSkia ) ;
450452 }
451453
452454 /**
@@ -456,9 +458,7 @@ export class Environment {
456458 * @param fontInfo If provided the font info provided overrules
457459 * @returns The font info under which the font was registered.
458460 */
459- public static registerAlphaSkiaCustomFont (
460- fontData : Uint8Array ,
461- fontInfo ?: Font | undefined ) : Font {
461+ public static registerAlphaSkiaCustomFont ( fontData : Uint8Array , fontInfo ?: Font | undefined ) : Font {
462462 return SkiaCanvas . registerFont ( fontData , fontInfo ) ;
463463 }
464464
@@ -469,7 +469,7 @@ export class Environment {
469469 private static createPlatformSpecificRenderEngines ( renderEngines : Map < string , RenderEngineFactory > ) {
470470 renderEngines . set (
471471 'html5' ,
472- new RenderEngineFactory ( false , ( ) => {
472+ new RenderEngineFactory ( false , false , ( ) => {
473473 return new Html5Canvas ( ) ;
474474 } )
475475 ) ;
@@ -485,7 +485,7 @@ export class Environment {
485485 new TripletFeelEffectInfo ( ) ,
486486 new MarkerEffectInfo ( ) ,
487487 new TextEffectInfo ( ) ,
488- new ChordsEffectInfo ( ) ,
488+ new ChordsEffectInfo ( )
489489 ] ) ,
490490 new SlashBarRendererFactory ( ) ,
491491 new EffectBarRendererFactory ( 'score-effects' , [
@@ -535,8 +535,8 @@ export class Environment {
535535 new TripletFeelEffectInfo ( ) ,
536536 new MarkerEffectInfo ( ) ,
537537 new TextEffectInfo ( ) ,
538- new ChordsEffectInfo ( ) ,
539- ] ) ,
538+ new ChordsEffectInfo ( )
539+ ] ) ,
540540 new SlashBarRendererFactory ( ) ,
541541 new EffectBarRendererFactory ( 'score-effects' , [
542542 new FermataEffectInfo ( ) ,
@@ -632,15 +632,12 @@ export class Environment {
632632 createWebWorker : ( settings : Settings ) => Worker ,
633633 createAudioWorklet : ( context : AudioContext , settings : Settings ) => Promise < void >
634634 ) {
635- if ( Environment . isRunningInWorker || Environment . isRunningInAudioWorklet ) {
635+ if ( Environment . isRunningInWorker || Environment . isRunningInAudioWorklet ) {
636636 return ;
637637 }
638-
638+
639639 // browser polyfills
640- if (
641- Environment . webPlatform === WebPlatform . Browser ||
642- Environment . webPlatform === WebPlatform . BrowserModule
643- ) {
640+ if ( Environment . webPlatform === WebPlatform . Browser || Environment . webPlatform === WebPlatform . BrowserModule ) {
644641 Environment . registerJQueryPlugin ( ) ;
645642 Environment . HighDpiFactor = window . devicePixelRatio ;
646643 // ResizeObserver API does not yet exist so long on Safari (only start 2020 with iOS Safari 13.7 and Desktop 13.1)
@@ -660,7 +657,9 @@ export class Environment {
660657 this . append ( ...nodes ) ;
661658 } ;
662659 ( Document . prototype as Document ) . replaceChildren = ( Element . prototype as Element ) . replaceChildren ;
663- ( DocumentFragment . prototype as DocumentFragment ) . replaceChildren = ( Element . prototype as Element ) . replaceChildren ;
660+ ( DocumentFragment . prototype as DocumentFragment ) . replaceChildren = (
661+ Element . prototype as Element
662+ ) . replaceChildren ;
664663 }
665664 if ( ! ( 'replaceAll' in String . prototype ) ) {
666665 ( String . prototype as any ) . replaceAll = function ( str : string , newStr : string ) {
@@ -676,19 +675,24 @@ export class Environment {
676675 /**
677676 * @target web
678677 */
679- public static get alphaTabWorker ( ) : any { return this . globalThis . Worker }
678+ public static get alphaTabWorker ( ) : any {
679+ return this . globalThis . Worker ;
680+ }
680681
681682 /**
682683 * @target web
683684 */
684685 public static initializeWorker ( ) {
685686 if ( ! Environment . isRunningInWorker ) {
686- throw new AlphaTabError ( AlphaTabErrorType . General , "Not running in worker, cannot run worker initialization" ) ;
687+ throw new AlphaTabError (
688+ AlphaTabErrorType . General ,
689+ 'Not running in worker, cannot run worker initialization'
690+ ) ;
687691 }
688692 AlphaTabWebWorker . init ( ) ;
689693 AlphaSynthWebWorker . init ( ) ;
690694 Environment . createWebWorker = _ => {
691- throw new AlphaTabError ( AlphaTabErrorType . General , " Nested workers are not supported" ) ;
695+ throw new AlphaTabError ( AlphaTabErrorType . General , ' Nested workers are not supported' ) ;
692696 } ;
693697 }
694698
@@ -697,7 +701,10 @@ export class Environment {
697701 */
698702 public static initializeAudioWorklet ( ) {
699703 if ( ! Environment . isRunningInAudioWorklet ) {
700- throw new AlphaTabError ( AlphaTabErrorType . General , "Not running in audio worklet, cannot run worklet initialization" ) ;
704+ throw new AlphaTabError (
705+ AlphaTabErrorType . General ,
706+ 'Not running in audio worklet, cannot run worklet initialization'
707+ ) ;
701708 }
702709 AlphaSynthWebWorklet . init ( ) ;
703710 }
@@ -761,4 +768,4 @@ export class Environment {
761768
762769 return WebPlatform . Browser ;
763770 }
764- }
771+ }
0 commit comments