-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Fixing ReferenceError: totalHeight is not defined throw by textAlign(… #5366
Conversation
…___, CENTER) and textAlign(___, BOTTOM)
🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already. And be sure to add yourself to the list of contributors on the readme page! |
Thanks for tagging me here, @outofambit ! It looks like I left these uninitialized variables in when refactoring the text wrapping :( This fix looks like it does eliminate the ReferenceError, but I'm digging in a little bit into #5146 to see if I missed something important about how As it is, only the first line is conforming to the vertical-alignment rule. I would assume also with text-align set to BOTTOM that we don't see the last line aligned with the bottom, but the first line. If you want to get rid of the error quickly and plan to release soon, this is a good fix, but I'm also happy to revisit the text wrapping function and see what got lost in re-implementation. |
Here is code screenshot of |
I had been struggling with this problem for a while. Thanks for coming up with a solution! Here are my thoughts: Presumably, the This value would have been used to draw the entire text across multiple lines at the specified position, not just a single line. I noticed that it is not easy to calculate the |
Yes, this would require a more in-depth solution, which would probably necessitate its own PR separate from this one. I thought I would have time to work on that when I commented 17 days ago but unfortunately this was not the case :(
I think that will be up to @outofambit to approve, I'm happy with @malviys solving the error in this PR and to open a new issue/follow-up PR to actually implement the correct vertical alignment. |
hey @lawreka @Snowman-s @malviys! thanks for the great conversation here. it seems like we should merge this PR to fix the immediate error and then follow up with more work to re-implement |
Fixing ReferenceError: totalHeight is not defined throw by textAlign(, CENTER) and textAlign(, BOTTOM)
Resolves #5360
Changes:
Removed undefine variable
totalHeight
from src/core/p5.Renderer.js causing ReferenceError while callingtextAlign_(, CENTER) and textAlign(__, BOTTOM)
PR Checklist
npm run lint
passes