MOBILE-4470 ddmarker: Fix regression caused by MOBILE-3403

main
Dani Palou 2024-06-12 11:17:10 +02:00
parent 186164ac4e
commit ce56d9dd2f
1 changed files with 6 additions and 1 deletions

View File

@ -20,6 +20,8 @@ import { CoreLogger } from '@singletons/logger';
import { AddonQtypeDdMarkerQuestionData } from '../component/ddmarker';
import { AddonQtypeDdMarkerGraphicsApi } from './graphics_api';
import { CoreUtils } from '@services/utils/utils';
import { CoreDirectivesRegistry } from '@singletons/directives-registry';
import { CoreExternalContentDirective } from '@directives/external-content';
/**
* Class to make a question of ddmarker type work.
@ -678,7 +680,7 @@ export class AddonQtypeDdMarkerQuestion {
/**
* Wait for the background image to be loaded.
*/
pollForImageLoad(): void {
async pollForImageLoad(): Promise<void> {
if (this.afterImageLoadDone) {
// Already treated.
return;
@ -689,6 +691,9 @@ export class AddonQtypeDdMarkerQuestion {
return;
}
// Wait for external-content to finish, otherwise the image doesn't have a src and the calculations are wrong.
await CoreDirectivesRegistry.waitDirectivesReady(bgImg, undefined, CoreExternalContentDirective);
if (!bgImg.src && this.imgSrc) {
bgImg.src = this.imgSrc;
}