3 ms·
How do you get the textarea, or any other element, into a canvas?
by moron4hire 12y ago
How do you get the textarea, or any other element, into a canvas?
- brian_peiris 12y agoI don't. The textarea remains hidden (off screen) in the background. It has the user's focus, so when the user types, it's receiving keystrokes as usual. Simultaneously, the render loop simply reads the text and selection state (selectionStart, selectionEnd) from the text area and renders the textarea's text and selection cursor/selection-highlight onto a canvas.
- robertkrahn01 12y agoSame approach here. Except that I use the ace editor (http://ace.c9.io/ http://ace.c9.io/) as the backend. This has the nice advantage that you get full code editing capabilities in 3D.