~/talk

Building Text Containers in Canvas

Talkat React Alicante 2023 · 2023-09-28..09-30· [react, web-performance, web-platform]
slides:none on file

Shows how a canvas text container is implemented end to end: identify targets with hitbox testing using pointerdown/pointerup distance to avoid click false positives, represent bindings with boundTextElementID so text follows moves/copies, implement a wordwrap algorithm that mimics browser behavior and render it in canvas, compare DOM/hybrid/canvas measurements and observe measureText is ~90% faster, and speed up layout further with character-width caching yielding roughly 85–95% improvement.

AI-written summary · about

  1. 0:00Text containers in Canvas
  2. 1:52What are text containers
  3. 3:15Requirements for text containers
  4. 4:39Designing elements in Canvas
  5. 6:43Hitbox testing for containers
  6. 8:31Demo: container selection
  7. 13:10Attaching text to containers
  8. 13:52Text-container relationships
  9. 17:04Text as container property
  10. 17:47Text within container bounds
  11. 19:11Canvas vs DOM text wrapping
  12. 20:36Implementing word wrap
  13. 23:06Measuring text in Canvas
  14. 25:50DOM text measurements
  15. 26:34Hybrid measurements approach
  16. 27:58DOM vs Canvas performance
  17. 29:41Pure Canvas text measurements
  18. 31:47Performance for text wrapping
  19. 34:35Key takeaways
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.