diff --git a/ui/dr-ui/src/masks_ui.rs b/ui/dr-ui/src/masks_ui.rs index 7667894..457733f 100644 --- a/ui/dr-ui/src/masks_ui.rs +++ b/ui/dr-ui/src/masks_ui.rs @@ -421,10 +421,26 @@ pub(crate) fn wire( session: &Rc>>, rows: &Rc>, redraw: &Rc, +) { + wire_segment(window, session, rows, redraw); + wire_mask_refine(window, session, rows, redraw); + wire_gradient_drag(window, session, redraw); + wire_region_select(window, session, rows, redraw); + wire_stack(window, session, rows, redraw); + wire_edge_treatment(window, session, redraw); + wire_layers_paint(window, session, rows, redraw); + wire_layers_parts(window, session, rows, redraw); +} + +/// --- computing the region map ----------------------------------------- +fn wire_segment( + window: &AppWindow, + session: &Rc>>, + rows: &Rc>, + redraw: &Rc, ) { let running: Rc> = Rc::default(); - // --- computing the region map ----------------------------------------- { let weak = window.as_weak(); let session = session.clone(); @@ -468,13 +484,20 @@ pub(crate) fn wire( watch(&w, id, rx, &session, &rows, &redraw, &running); }); } +} - // --- refining one subject's mask --------------------------------------- - // - // Its own `Running` slot rather than sharing the segmentation one: the - // two answer different questions (the whole frame's subjects versus one - // already-found instance) and there is no reason a refine in flight - // should block a fresh "Find subjects", or the reverse. +/// --- refining one subject's mask --------------------------------------- +/// +/// Its own `Running` slot rather than sharing the segmentation one: the +/// two answer different questions (the whole frame's subjects versus one +/// already-found instance) and there is no reason a refine in flight +/// should block a fresh "Find subjects", or the reverse. +fn wire_mask_refine( + window: &AppWindow, + session: &Rc>>, + rows: &Rc>, + redraw: &Rc, +) { let refining: Rc> = Rc::default(); { let weak = window.as_weak(); @@ -511,16 +534,22 @@ pub(crate) fn wire( watch_refine(&w, session_id, rx, &session, &rows, &redraw, &running); }); } +} - // --- dragging a gradient on the photograph ---------------------------- - // - // The geometry the gesture started from, held for its duration. - // - // **A drag is applied to where the mask was when the press landed**, not - // to where it was one frame ago. Accumulating frame by frame would let the - // clamps compound — a radius dragged past its limit and back would not - // return to where it started — and would make the result depend on how - // many events the pointer happened to deliver. +/// --- dragging a gradient on the photograph ---------------------------- +/// +/// The geometry the gesture started from, held for its duration. +/// +/// **A drag is applied to where the mask was when the press landed**, not +/// to where it was one frame ago. Accumulating frame by frame would let the +/// clamps compound — a radius dragged past its limit and back would not +/// return to where it started — and would make the result depend on how +/// many events the pointer happened to deliver. +fn wire_gradient_drag( + window: &AppWindow, + session: &Rc>>, + redraw: &Rc, +) { let dragging: Rc>> = Rc::new(RefCell::new(None)); { let weak = window.as_weak(); @@ -571,8 +600,15 @@ pub(crate) fn wire( } }); } +} - // --- selecting on the photograph -------------------------------------- +/// --- selecting on the photograph -------------------------------------- +fn wire_region_select( + window: &AppWindow, + session: &Rc>>, + rows: &Rc>, + redraw: &Rc, +) { { let weak = window.as_weak(); let session = session.clone(); @@ -596,8 +632,15 @@ pub(crate) fn wire( redraw(&w); }); } +} - // --- the stack --------------------------------------------------------- +/// --- the stack --------------------------------------------------------- +fn wire_stack( + window: &AppWindow, + session: &Rc>>, + rows: &Rc>, + redraw: &Rc, +) { { let weak = window.as_weak(); let session = session.clone(); @@ -724,12 +767,18 @@ pub(crate) fn wire( redraw(&w); }); } +} - // --- the edge treatment ------------------------------------------------- - // - // All four read one distance field, so all four are live: nothing here - // rebuilds anything except a compound morphology, which `develop` keys on - // separately. +/// --- the edge treatment ------------------------------------------------- +/// +/// All four read one distance field, so all four are live: nothing here +/// rebuilds anything except a compound morphology, which `develop` keys on +/// separately. +fn wire_edge_treatment( + window: &AppWindow, + session: &Rc>>, + redraw: &Rc, +) { { let weak = window.as_weak(); let session = session.clone(); @@ -853,13 +902,20 @@ pub(crate) fn wire( redraw(&w); }); } +} - // --- adding layers ------------------------------------------------------ - // TRACES: FR-DEV-19b - // Painting. Three handlers for one gesture, and the middle one runs per - // pointer report — so it does the least it can: map the point, record it, - // redraw. No sync, because nothing the panel shows changes while a finger - // is down, and rebuilding eight rows a frame is how a brush starts to lag. +/// --- adding layers ------------------------------------------------------ +/// TRACES: FR-DEV-19b +/// Painting. Three handlers for one gesture, and the middle one runs per +/// pointer report — so it does the least it can: map the point, record it, +/// redraw. No sync, because nothing the panel shows changes while a finger +/// is down, and rebuilding eight rows a frame is how a brush starts to lag. +fn wire_layers_paint( + window: &AppWindow, + session: &Rc>>, + rows: &Rc>, + redraw: &Rc, +) { { let weak = window.as_weak(); let session = session.clone(); @@ -1014,6 +1070,16 @@ pub(crate) fn wire( redraw(&w); }); } +} + +/// Parts of the active mask, and the buttons that add a new layer — +/// gradient, brush, range, category or subject. +fn wire_layers_parts( + window: &AppWindow, + session: &Rc>>, + rows: &Rc>, + redraw: &Rc, +) { // TRACES: FR-DEV-19a { let weak = window.as_weak();