Skip to content

Read hover and click values at the frame on screen - #736

Open
Kayvan-Zahiri wants to merge 1 commit into
gallantlab:mainfrom
Kayvan-Zahiri:fix/readout-active-frame
Open

Read hover and click values at the frame on screen#736
Kayvan-Zahiri wants to merge 1 commit into
gallantlab:mainfrom
Kayvan-Zahiri:fix/readout-active-frame

Conversation

@Kayvan-Zahiri

@Kayvan-Zahiri Kayvan-Zahiri commented Sep 10, 2026

Copy link
Copy Markdown

Fixes #636.

The hover and click readouts indexed verts[0] and textures[0], so once a movie moved past its first frame they kept showing frame 0's values.

DataView.frameIndex() works out the frame on screen the same way setFrame does, and both handlers now read that frame through a small frameValues helper. It reports the sample at floor(frame). During playback the shaders blend toward the next frame by framemix; for vertex data the NaN mask is taken from floor(frame), so that sample is the one consistent with what gets masked. While a frame's buffer is still loading (volume mosaics arrive one at a time) the helper returns null and the readout hides, where indexing it directly would throw.

test_picked_value_follows_movie_frame clicks the brain at frames 0, 2 and 1 for a Vertex and a Volume movie where frame k holds k. On main it fails with (2, '0.00'); here it passes. The volume comparison has a small tolerance because volume floats are decoded through a 2D canvas, and its premultiplied alpha rounds the low bytes: 1.0 comes back as 1.015625. That happens on main too, for every frame, and this PR doesn't change it. The hover path shares the helper, but the test only drives the click path, since the headless harness talks to the viewer over the websocket and doesn't send mouse events.

One thing I left alone: a picked value still updates only on the next click, not as the movie plays.

The readouts indexed verts[0] and textures[0], so once a movie advanced
they kept showing frame 0. Add DataView.frameIndex(), read the value at
that frame, and hide the readout while the frame is still loading.

Fixes gallantlab#636
@Kayvan-Zahiri
Kayvan-Zahiri force-pushed the fix/readout-active-frame branch from a2e3aad to fa130cd Compare September 10, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebGL viewer hover/click readout reads frame 0 regardless of active movie frame

1 participant