default to [0, 0] when sourceFrame is not found
This commit is contained in:
parent
c171503d77
commit
559033f0a6
@ -80,7 +80,10 @@ class FrameOffsetForwarder {
|
||||
sourceFrame = frame;
|
||||
break;
|
||||
}
|
||||
if (sourceFrame === null) { return; }
|
||||
if (sourceFrame === null) {
|
||||
this._forwardFrameOffsetOrigin(null, uniqueId);
|
||||
return;
|
||||
}
|
||||
|
||||
const [forwardedX, forwardedY] = offset;
|
||||
const {x, y} = sourceFrame.getBoundingClientRect();
|
||||
|
@ -138,7 +138,8 @@ class PopupProxy {
|
||||
this._frameOffsetPromise = this._getFrameOffset();
|
||||
if (firstRun) {
|
||||
try {
|
||||
this._frameOffset = await this._frameOffsetPromise;
|
||||
const offset = await this._frameOffsetPromise;
|
||||
this._frameOffset = offset !== null ? offset : [0, 0];
|
||||
this._frameOffsetUpdatedAt = Date.now();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@ -146,7 +147,7 @@ class PopupProxy {
|
||||
this._frameOffsetPromise = null;
|
||||
} else {
|
||||
this._frameOffsetPromise.then((offset) => {
|
||||
this._frameOffset = offset;
|
||||
this._frameOffset = offset !== null ? offset : [0, 0];
|
||||
this._frameOffsetUpdatedAt = Date.now();
|
||||
this._frameOffsetPromise = null;
|
||||
}, (e) => {
|
||||
|
Loading…
Reference in New Issue
Block a user