LeaVerou / rety

Record typing on one or more editors and replay it at will, to simulate live coding

Home Page:https://rety.verou.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Textarea does not scroll when needed

LeaVerou opened this issue · comments

When replaying edits, the textarea doesn't scroll so that the part edited is always visible.

There are two ways to address this:

  1. In Replayer, scroll to part currently being edited. No way to do this in the web platform. For textareas that don't wrap we can approximate by number of line breaks before caret, but it's hacky and unreliable.
  2. Record scrolling as an action. Since sometimes the speaker scrolls to show something, this would allow rety to more closely replicate these types of demos. But what to record? We don't want to just record a px offset, since the actions may be replayed on a completely diifferent textarea with different styling. For the same reason, recording percentage offset also wouldn't be helpful. Maybe something related to font size? I.e. scroll offset divided by line height (for vertical scroll) or em width (for horizontal scroll). Also, which scrolls to record? If we record every time the scroll event fires, that would be very noisy.