~/talk

Building Text Containers in Canvas

Talkat DevFest Ahmedabad 2023 · on Sunday, 2023-12-17· [web-platform, web-performance]
slides:none on file

Shows how text and shape stay as separate elements but link via containerId/boundTextId, uses hitbox testing to pick targets, and renders typing with an off-DOM textarea then a custom word-wrap algorithm for Canvas because Canvas has no multiline support. Compares DOM sizing, hybrid and pure-canvas.measureText approaches, finds canvas measurement plus caching and per-character caching gives 85–95% faster runs, and explains binary-search breakpoints and why pure canvas lets rendering work in Node and in Excalidraw.

AI-written summary · about

  1. 0:00Introduction and event context
  2. 1:06Speaker introduction and Excal Draw
  3. 3:17What is a text container
  4. 4:23Requirements for text containers
  5. 6:09JSON structure for canvas elements
  6. 7:13UI for attaching text to containers
  7. 10:28Hitbox testing for container selection
  8. 14:50Linking text and container elements
  9. 16:12Replicating actions to text elements
  10. 19:27Keeping text inside container bounds
  11. 21:36Canvas text wrapping challenges
  12. 24:50Measuring text dimensions in canvas
  13. 27:15DOM measurement approach
  14. 28:40Hybrid measurement approach
  15. 31:51Pure canvas measurement approach
  16. 34:18Performance optimizations
  17. 36:45Key takeaways and conclusion
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.