Media · Capture and devices: recorder, camera, mic meter, device choice and 3D model viewer
ScreenRecorderControls holds a recording in one pill: Record, then a live dot and the time it has run beside pause or resume and stop, with mic and camera toggles. CameraPreview shows host frames in the camera's shape, or the camera off. MicLevelMeter lights segments up to the level, amber and red near the top, with tones shared from data_display. DeviceSelector picks a microphone, camera or speaker through Select, which may now be empty while shut. ModelViewer shows the host's frame for an orbit that a drag, the arrows, Command-scroll, + and - and a reset move; the orbit is seeded from the host so fast drags add up. The gallery draws a stone torus per orbit and frees each replaced frame. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
235f059c8e
commit
7f1cfe8c3d
20 files changed
+1541
-30
No files matched your search
@@ -39,6 +39,11 @@ fn tones(colors: &Palette) -> [Hsla; 3] {
|
||||
[colors.fg, colors.warning, colors.danger]
|
||||
}
|
||||
|
||||
/// A share's color against its limits: plain, amber past the first, red past the second.
|
||||
pub(crate) fn tone(share: f32, limits: (f32, f32), colors: &Palette) -> Hsla {
|
||||
tones(colors)[Level::of(share, thresholds(limits.0, limits.1)) as usize]
|
||||
}
|
||||
|
||||
fn thresholds(warn: f32, danger: f32) -> (f32, f32) {
|
||||
assert!(
|
||||
0.0 < warn && warn <= danger && danger <= 1.0,
|
||||
@@ -411,7 +416,17 @@ impl RenderOnce for UsageBar {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Level, UsageBar};
|
||||
use super::{Level, UsageBar, tone};
|
||||
use crate::theme::Palette;
|
||||
|
||||
#[test]
|
||||
fn a_tone_follows_the_share_past_each_limit() {
|
||||
let colors = Palette::light(false);
|
||||
let limits = (0.8, 0.95);
|
||||
assert_eq!(tone(0.5, limits, &colors), colors.fg);
|
||||
assert_eq!(tone(0.85, limits, &colors), colors.warning);
|
||||
assert_eq!(tone(0.97, limits, &colors), colors.danger);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parts_that_sum_to_the_total_fill_it_despite_float_error() {
|
||||
|
||||
@@ -27,6 +27,7 @@ pub use codes::{Barcode, BarcodeError, QrCode, QrError};
|
||||
pub use comparison::Comparison;
|
||||
pub use feed::{Activity, ActivityFeed};
|
||||
pub use gallery::Gallery;
|
||||
pub(crate) use measures::tone;
|
||||
pub use measures::{Gauge, Meter, UsageBar};
|
||||
pub use records::{DescriptionList, PropertyGrid, PropertyGroup};
|
||||
pub use spark::Sparkline;
|
||||
|
||||
Reference in new issue
Block a user