Hacker News new | past | comments | ask | show | jobs | submit login

Maybe it’s just me, but I don’t think showing a string on screen requires React or any other view library.

I’d probably paint it on canvas and then overlay an invisible plaintext node to allow selection.




The player has other UI parts, mainly the control bar with current time, progress/seek bar, full-screen toggle etc. Of course it could be built with plain JS but a small library like Solid.js does the job well.

The terminal lines with (colored) text definitely don't need a view library if you just want to display it, true. Canvas would be way more efficient here, and it's not out of the question for the terminal part in the future. One thing that using DOM (spans here) gives for free is copy-paste. Like you mentioned it could be solved by overlaying a text element on top of canvas (on mousedown, or when paused) or custom implementing copy-paste for canvas with mousedown/mousemove/mouseup, but that's all extra work, and as I mentioned in the blog terminal emulation was the bottleneck, not rendering.


But that just means you have to manage both the text (what React/SolidJS are already doing) and a canvas, which means your twice the work for no good reason.


If you made a library that does this I'm sure it would be welcome competition!


Yeah but how can you quickly re-render the plaintext node in sync with the canvas? How are you doing font rendering? How are you handling things like accessibility and interactive controls?

I feel like you may not be seeing the whole picture / problem domain.


People work with what they know and I'm sure they'd love to see a similar implementation done with the method you suggest. It's open source and hugs and thumbs up all around here :)




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: