fix(studio): 统一 Box/Mini 箭头网格与强度着色

This commit is contained in:
ykcheungab
2026-10-10 16:07:26 +08:00
parent 48de5b74e6
commit f94b51e2de
4 changed files with 47 additions and 12 deletions
@@ -23,7 +23,7 @@ FLOW_IDLE_HEX = "#8A93A6"
#: BGR grey used for depth samples that carry no value.
NO_DEPTH_BGR = (0x8A, 0x8A, 0x8A)
#: The fixed flow-magnitude colour range, in **uv pixels of displacement**.
#: Finger's fixed flow-magnitude colour range, in **uv pixels of displacement**.
#:
#: The colour of an arrow is a statement about its magnitude, so it has to be the same
#: statement from one frame to the next: a per-frame range makes the same magnitude a
@@ -34,6 +34,8 @@ NO_DEPTH_BGR = (0x8A, 0x8A, 0x8A)
#: where the arrow itself does. A pane that offers the operator a colour range owns this
#: value and passes it as ``magnitude_range`` to :func:`draw_arrow_display`.
FLOW_MAGNITUDE_RANGE: tuple[float, float] = (0.0, 2.0)
#: Box/Mini use a 2 px activation floor, so their fixed range extends to 8 px.
BOX_FLOW_MAGNITUDE_RANGE: tuple[float, float] = (0.0, 8.0)
#: Whether an inactive sample is drawn as a quiet dot. **On**, which is the decided
#: display behaviour: a sample below the display threshold is a statement about the
@@ -498,8 +500,10 @@ def draw_arrow_display(
finger style falls back to the finger defaults and box style to :func:`sdk_box_policy`.
``magnitude_range`` fixes the colour scale, in the same unit as ``flow_on_px``
(uv pixels of displacement); the default is :data:`FLOW_MAGNITUDE_RANGE` and a
settings model that owns the range passes its own here. ``per_frame_colour`` opts
(uv pixels of displacement). The default is :data:`FLOW_MAGNITUDE_RANGE` for
finger and :data:`BOX_FLOW_MAGNITUDE_RANGE` for box/mini; their different
sampling floors need different fixed ranges to retain intensity contrast.
A settings model that owns the range passes its own here. ``per_frame_colour`` opts
back in to normalising every frame against its own maximum, which makes one
magnitude a different colour from one frame to the next.
@@ -570,7 +574,11 @@ def draw_arrow_display(
policy=selected,
colormap=colormap,
below_threshold_color=tuple(draw_kw["below_threshold_color"]),
magnitude_range=magnitude_range,
magnitude_range=(
magnitude_range
if magnitude_range is not None
else FLOW_MAGNITUDE_RANGE if finger else BOX_FLOW_MAGNITUDE_RANGE
),
per_frame_colour=per_frame_colour,
# Read here rather than as a parameter default: the module constant is
# the display decision, and a caller that flips it (a build, a test)