fixed ScreenDprListener never being fired

This commit is contained in:
Eugene Pankov
2020-05-02 16:20:46 +02:00
parent 939de5d151
commit 40a09d7412
+4 -2
View File
@@ -44,12 +44,14 @@ export class ScreenDprMonitor extends Disposable {
}
private _updateDpr(): void {
if (!this._resolutionMediaMatchList || !this._outerListener) {
if (!this._outerListener) {
return;
}
// Clear listeners for old DPR
this._resolutionMediaMatchList.removeListener(this._outerListener);
if (this._resolutionMediaMatchList) {
this._resolutionMediaMatchList.removeListener(this._outerListener);
}
// Add listeners for new DPR
this._currentDevicePixelRatio = window.devicePixelRatio;