roost-im / roost-client

The official client for Roost.
MIT License
1 stars 6 forks source link

Saving positions within panes (scroll position) #67

Open dovej opened 10 years ago

dovej commented 10 years ago

This is an enhancement that goes beyond the scope of https://github.com/roost-im/roost-client/issues/59

As it stands, you can save your position in a pane by selecting a message with the arrow keys. It is not possible to do this on mobile devices without a keyboard. Maybe we want to have messages selected if you tap them? Probably not, because it takes up more space and the notion of the cursor is otherwise meaningless on mobile. However, this suggests that we may want to devise a method for saving scroll position that takes over when no message is selected. This would be complicated, I imagine.

jrafidi commented 10 years ago

The logic might look something like this:

Whenever the user scrolls, have a handler throttled for 0.5-1 second that finds the closest message to the top. It then saves that as a "soft position" for that pane, and if the "hard position" selected by keyboard or tap is sufficiently removed from view/scroll area, it clears it out. When we rebuild a pane, we check first for a hard position, followed by a soft position, and position/scroll accordingly.

This gets annoying when we consider that this saved position affects the backend calls to rebuild the messages in the pane, but I think it is doable.