Offer a mask that is nothing but a hand

Every route to a layer began with a selection — a gradient, a band, a subject,
a category — and painting was reachable only by making one of those and
joining a painted part to it. So the answer to "brush a correction onto this
corner of the sky" was "add a radial gradient you do not want, then paint into
that", which is not an answer.

Paint sits beside Linear and Radial and makes a layer whose base is a brush.
It covers nothing until a stroke lands in it, so pressing it arms the brush
and shows the mask as well: a row that appeared and changed no pixel, with the
pointer still in "select", is indistinguishable from a button that did nothing.
This commit is contained in:
2026-09-10 20:28:09 +02:00
parent c045702a47
commit 76ad667fd6
3 changed files with 78 additions and 0 deletions
+31
View File
@@ -1010,6 +1010,37 @@ pub(crate) fn wire(
redraw(&w);
});
}
// TRACES: FR-DEV-19b
{
let weak = window.as_weak();
let session = session.clone();
let redraw = redraw.clone();
let rows = rows.clone();
window.global::<Masking>().on_add_brush(move || {
let Some(w) = weak.upgrade() else { return };
let made = session
.borrow_mut()
.as_mut()
.and_then(|s| s.add_brush_mask())
.is_some();
// Armed, and this is not a convenience: the layer covers no pixel
// until something is painted into it, so a press that made a row
// and left the pointer in "select" would be indistinguishable from
// a button that did nothing. The same reasoning as `on_part_added`
// below, and the tool's own handler turns the mask view on.
if made {
w.global::<Masking>().set_tool(1);
if let Some(s) = session.borrow_mut().as_mut() {
if s.mask_view() == 0 {
s.set_mask_view(1);
}
}
}
sync(&w, &session);
sync_rows(&w, &rows, &session);
redraw(&w);
});
}
// TRACES: FR-DEV-10
{
let weak = window.as_weak();