-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix exceptions for empty lines #4436
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -764,6 +764,9 @@ export const calculateTextDimensions: ( | |
let cheight = 0; | ||
const dim = { width: 0, height: 0, lineHeight: 0 }; | ||
for (const line of lines) { | ||
if (!line) { | ||
continue; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although this fixes the symptom, it doesn't solve the root cause of the issue. Maybe, if we replace the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense! I end up with zero-width spaces as they don't occupy horizontal space and won't be collapsed inside DOM elements. |
||
const textObj = getTextObj(); | ||
textObj.text = line; | ||
const textElem = drawSimpleText(g, textObj) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.