fix: Properties x and y of BoundingRect is undefined in old browser (#2797)

This commit is contained in:
MoyuScript 2022-01-23 00:18:49 +08:00 committed by GitHub
parent 67c5e8dec4
commit e587a82dca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,8 +20,8 @@ export class Bounds {
const domRect = Array.from(domRectList).find((rect) => rect.width !== 0); const domRect = Array.from(domRectList).find((rect) => rect.width !== 0);
return domRect return domRect
? new Bounds( ? new Bounds(
domRect.x + context.windowBounds.left, domRect.left + context.windowBounds.left,
domRect.y + context.windowBounds.top, domRect.top + context.windowBounds.top,
domRect.width, domRect.width,
domRect.height domRect.height
) )