// The brush's own physics, shared by FX's two tools: HEAL copies a patch of the // photo over what it paints, MOSAIC hides what it paints, and both lay circular // spots from the same gesture — a circle that rides the cursor, a stroke laid // down as the pointer travels, and a wheel that sizes it. What a spot MEANS is // each tool's own business (heal.ts, mosaic.ts); how big it is and how far apart // a stroke lays them is this file's. // // The bounds are fractions of the photo's width. Past BRUSH_MAX_R a spot is a // quarter of the frame — a repair would be borrowing a patch from off the // photo, and a mosaic block would be enormous — and below BRUSH_MIN_R the circle // is finer than the pixels it is drawn on at preview scale, which is a size the // user cannot see well enough to aim. export const BRUSH_MIN_R = 0.003; export const BRUSH_MAX_R = 0.25; // How far apart a drag lays its spots, in radii: any closer and the run is the // same spot written twice, which is work for nothing. export const BRUSH_SPACING = 0.6; // The brush radius after a wheel notch. Multiplicative, so the brush grows by // the same proportion wherever it starts, and bounded as above — a trackpad's // small deltas and a mouse's 100px notch are then the same gesture at two // speeds. export function wheelBrushR(r: number, deltaY: number): number { const next = r * Math.exp(-deltaY * 0.0015); return next < BRUSH_MIN_R ? BRUSH_MIN_R : next > BRUSH_MAX_R ? BRUSH_MAX_R : next; }