Skip to content

viewer: let the thermal inset be dragged about the video - #102

Merged
tridge merged 1 commit into
ArduPilot:masterfrom
tridge:pr-viewer-inset
Dec 2, 2026
Merged

tridge merged 1 commit into
ArduPilot:masterfrom
tridge:pr-viewer-inset

Conversation

@tridge

@tridge tridge commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Lets the raw thermal inset of the combined RGB and thermal view be moved to another place on the video.

What it does

  • Drag. The inset can be dragged anywhere on the video stage and is kept inside it. It stays under the pointer, including if the stage changes size during the drag, and goes to where the pointer is released.
  • Keyboard. With the inset focused by Tab, the arrow keys move it a step at a time. Enter and Space still switch to the thermal view. An arrow with a modifier key is left to the page.
  • Focus. After a pointer drag, focus goes to the video stage, so Space and the arrow keys are the page's again (play and pause, step frames).
  • Kept. Its place is held as a fraction of the room the stage has for it, so it stays put through a change of window size, and is saved in local storage for later visits. A saved value that is damaged or out of range falls back to the default corner.
  • Click. A click still switches to the thermal view. The click that ends a drag does not; that is judged by the events' own timestamps, and a touch drag, which has no click, does not swallow a later tap.
  • Touch and capture. A second finger does not take over a drag. A drag that is cancelled, or loses the pointer, puts the inset back where it was.
  • Layering. The download rows are now drawn above the inset, since it can be put where they are.

The drag logic is in a new src/ui/inset-drag.js; main.js wires it to the inset and re-places it when the stage or the inset changes size.

Testing

  • New tests/inset-drag.test.js: placement by fractions, a drag against a click, a second pointer, release beyond the last move, lost capture, a cancelled drag, a click that comes late or not at all, a resize and a hidden inset during a drag, the arrow keys, and damaged saved values. npm test passes (244 passed, 1 skipped) and prettier --check is clean.
  • By hand through Playwright, in Chrome and Firefox Nightly 162, on a live combined stream: drag to the upper left; Space after the drag (plays and pauses, stays in the combined view); drag past the corner (stays inside); reload (place kept); Tab to the inset then arrow keys (moves); a plain click (switches to thermal).

Not yet done

  • No browser spec in tests/browser for the inset; the browser check above was a one-off script.
  • Not tried on a touch screen. The touch behaviour above is covered by the unit test with simulated pointer events only.
  • Each arrow key press saves the place, including on key repeat.
  • A mouse drag whose release happens outside the browser (for example after switching windows) carries on until the next click.

@AP-Review

AP-Review commented Dec 2, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-12-02)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 214d9fcbe1.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/ap_cameragimbal/102/1.html#prAP_CameraGimbal-102

Reviewed at 214d9fc; the PR head has since moved to ef99cf6, which this review does not cover. The combined RGB and thermal stream, per-track indexing and the draggable inset look sound, and the unit tests, build and format check pass; two low-severity notes, both depending on SupportProxy behaviour that can't be checked from this repo.

Low

  • tools/viewer/README.md:88 a saved combined .mkv reopens on tracks[0] (local-source.js:16), so if the proxy lists the thermal TrackEntry first the file opens on thermal, not video. Qualify the sentence, or have LocalSource prefer the non-FFV1 track as LiveSource does.
Minor (1)
  • tools/viewer/src/media/matroska-live.js:351 within one named mux run a timestamp step back on the same connection stays in the same epoch, so pts go backwards and frameAt/frameBefore pick the wrong frame. This relies on the documented strictly-increasing contract; treating raw <= lastRaw on a non-fresh named connection as a new epoch, as the single-track path does, would be cheap hardening.

Not fully reviewed: commits after 214d9fc (head now ef99cf6); browser end-to-end playback was not exercised by any pass.

Head moved during review: observed ef99cf6f3df63c44e92c43eae88203a7243c2486. This review covers only 214d9fcbe15ddb85201b584e3a4e0b4dcda3099c; followup eligible.

The inset can be dragged anywhere on the video stage, or moved with the
arrow keys when it has the focus. Its place is kept as a fraction of the
room the stage has for it, so it holds through a change of window size,
and is saved for later visits. A click that ends a drag does not switch
to the thermal view.

The download rows are drawn above the inset, which can now be put where
they are.
@AP-Review

Copy link
Copy Markdown

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: ACCEPT

Reviewed at head 1c25f94a57.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/ap_cameragimbal/102/2.html#prAP_CameraGimbal-102

The draggable thermal inset looks sound: unit tests, build and format checks pass, and mouse, touch and keyboard dragging behaved correctly in headless Chromium. The repository's Playwright suite and full-app playback were not run.

Since the last review the PR has been rebased onto master, which now has the combined-stream work, so it is down to the single inset-drag commit. The two earlier notes are about master code this PR no longer touches.

Minor (2)
  • Saved combined .mkv reopen (still open, master follow-up): tools/viewer/src/media/local-source.js:16 opens on tracks[0], so a thermal-first file opens on thermal, unlike README.md:88-89.
  • Named mux clock step-back (still open, master follow-up): tools/viewer/src/media/matroska-live.js:349 keeps the same epoch, so pts can go backwards; optional hardening.

The earlier coverage and head-moved notes are closed, because this review covers the current head.

@tridge
tridge marked this pull request as ready for review December 2, 2026 05:28
@tridge
tridge merged commit 376119e into ArduPilot:master Dec 2, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants