The following request is intended to be a github “feature request” but, as you know, such proposals should be actionable, so I first want to bounce it here.
Is your feature request related to a problem? Please describe.
Over the years, I’ve consistently hit situations where I want to programmatically know if someting - a tiddler or something within the tiddler body - is in the viewport or not.
Some use cases
A basic application would be an indicator in the sidebar lists to indicate which title is currently seen in viewport (this is sometimes hard to discern - like with browser tabs, I keep many tiddlers open at the same time. I understand different personality types behave differently in this regard.)
A more ambitious application would be a kodemo type storyview/layout.
A third, and more general example, would be a kind of lazy-loading that triggers from scrolling to a tiddler, or to show some css effect from its start state - this is very common when scrolling web pages but unclear how to achieve with TW.
A general enough implementation could perhaps even be used for “synched editor+ouput scrolling” seen on some dev sites. Considering how TW widget calls and their output often take up totally differently sized vertical real estate, this would be particularly useful in the editor preview display.
Describe the solution you’d like
A dynamic variable, comparable to currentTiddler
but with the title of the single tiddler or other element that occupies a certain y-position in the viewport (e.g the top-of-scroll position).
…And/or a widget(?) that triggers when scrolled into view, so that the user can position and encapsulate stuff at arbritrary positions within the tiddler body.
Describe alternatives you’ve considered
@felixhayashi created the HotZone plugin. While HotZone does feature the dynamic variable mentioned above, it only does so for tiddler titles, not arbitrary elements within the body. And, overall, the requested functionality is IMO general enough to be a native feature in TW. Especially as a plugin creator, it is not practical to have to rely on and refer to, other plugins when creating new public plugins.