MOBILE-3814 core: Use waitForResizeDone on onWindowResize listener
parent
f31ee78cfb
commit
fd1e5ee0eb
|
@ -360,7 +360,7 @@ export class AddonQtypeDdImageOrTextQuestion {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.resizeListener = CoreDomUtils.onWindowResize(() => {
|
this.resizeListener = CoreDomUtils.onWindowResize(() => {
|
||||||
this.windowResized();
|
this.repositionDragsForQuestion();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,15 +679,6 @@ export class AddonQtypeDdImageOrTextQuestion {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Window resized.
|
|
||||||
*/
|
|
||||||
async windowResized(): Promise<void> {
|
|
||||||
await CoreDomUtils.waitForResizeDone();
|
|
||||||
|
|
||||||
this.repositionDragsForQuestion();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -611,7 +611,7 @@ export class AddonQtypeDdMarkerQuestion {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.resizeListener = CoreDomUtils.onWindowResize(() => {
|
this.resizeListener = CoreDomUtils.onWindowResize(() => {
|
||||||
this.windowResized();
|
this.redrawDragsAndDrops();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,15 +879,6 @@ export class AddonQtypeDdMarkerQuestion {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Window resized.
|
|
||||||
*/
|
|
||||||
async windowResized(): Promise<void> {
|
|
||||||
await CoreDomUtils.waitForResizeDone();
|
|
||||||
|
|
||||||
this.redrawDragsAndDrops();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -212,7 +212,7 @@ export class AddonQtypeDdwtosQuestion {
|
||||||
this.positionDragItems();
|
this.positionDragItems();
|
||||||
|
|
||||||
this.resizeListener = CoreDomUtils.onWindowResize(() => {
|
this.resizeListener = CoreDomUtils.onWindowResize(() => {
|
||||||
this.windowResized();
|
this.positionDragItems();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,15 +513,6 @@ export class AddonQtypeDdwtosQuestion {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Window resized.
|
|
||||||
*/
|
|
||||||
async windowResized(): Promise<void> {
|
|
||||||
await CoreDomUtils.waitForResizeDone();
|
|
||||||
|
|
||||||
this.positionDragItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -276,7 +276,9 @@ export class CoreDomUtilsProvider {
|
||||||
* @return Event observer to call off when finished.
|
* @return Event observer to call off when finished.
|
||||||
*/
|
*/
|
||||||
onWindowResize(resizeFunction: (ev?: Event) => void, debounceDelay = 20): CoreEventObserver {
|
onWindowResize(resizeFunction: (ev?: Event) => void, debounceDelay = 20): CoreEventObserver {
|
||||||
const resizeListener = CoreUtils.debounce((ev?: Event) => {
|
const resizeListener = CoreUtils.debounce(async (ev?: Event) => {
|
||||||
|
await this.waitForResizeDone();
|
||||||
|
|
||||||
resizeFunction(ev);
|
resizeFunction(ev);
|
||||||
}, debounceDelay);
|
}, debounceDelay);
|
||||||
|
|
||||||
|
@ -2153,6 +2155,7 @@ export class CoreDomUtilsProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In iOS the resize event is triggered before the window size changes. Wait for the size to change.
|
* In iOS the resize event is triggered before the window size changes. Wait for the size to change.
|
||||||
|
* Use of this function is discouraged. Please use onWindowResize to check window resize event.
|
||||||
*
|
*
|
||||||
* @param windowWidth Initial window width.
|
* @param windowWidth Initial window width.
|
||||||
* @param windowHeight Initial window height.
|
* @param windowHeight Initial window height.
|
||||||
|
|
Loading…
Reference in New Issue