fix: ios text wrapping with 0 width rect (#2786)

This commit is contained in:
Niklas von Hertzen 2022-01-01 13:07:52 +08:00 committed by GitHub
parent 74696faf47
commit 0476d06515
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ export class Bounds {
} }
static fromDOMRectList(context: Context, domRectList: DOMRectList): Bounds { static fromDOMRectList(context: Context, domRectList: DOMRectList): Bounds {
const domRect = domRectList[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.x + context.windowBounds.left,