Read hover and click values at the frame on screen - #736
Open
Kayvan-Zahiri wants to merge 1 commit into
Open
Conversation
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
force-pushed
the
fix/readout-active-frame
branch
from
September 10, 2026 23:05
a2e3aad to
fa130cd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #636.
The hover and click readouts indexed
verts[0]andtextures[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 waysetFramedoes, and both handlers now read that frame through a smallframeValueshelper. It reports the sample atfloor(frame). During playback the shaders blend toward the next frame byframemix; for vertex data the NaN mask is taken fromfloor(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_frameclicks 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.