Hello et bonjour!
I am some weeks in with heaps.io and making good progress.
Docs, community (passive) and source code helped me a lot to figure things out myself.
But now I have a problem which I am not sure how to tackle it.
Sorry for the wall of text…
Its hard to describe in fewer words.
So I made my own scrollable widget using h2d.Mask
and it works fine for now.
Within this I have children to render. Say a scrollable list of text items.
Now I attach an h2d.Interactive
for each item, so when user clicks on it something will happen.
For debugging purposes I added a background color, so I can see whats going on.
I defined the mask with a height of 300px.
All Interactive
that get a y-coordinate < 300px get rendered/are active.
So at 290px it is still active, because its partial visible.
Now the problem:
If I scroll down it doesn’t update in a way, that the now (possible) visible Interactive
get active.
I checked with vs code that the object are there and they have valid coordinates.
I tried re-adding to parent and reattaching as EventTarget.
I skipped through Mask
, Interactive
, SceneEvents
to figure it out, but no luck so far.
How do I activate those Interactives
beyond y=300, when they come in visible range?
Should this happen automatically, or do I need to update/trigger something?
Is this even the right way to do it?
I checked Mask.scrollBounds and it its null
. Thats okay?
A workaround on one occassion was to put a single Interactive
on either mask or its parent and calculate the list position with the help of mask.scrollY
.
While this doesn’t sound so bad for fixed-sized items, there may be other situations and so
I would like to know what I am doing wrong here.
Thanks in advance!
Mike