Painting UX: unified color/brush tools, tablet buttons, layer opacity
Addresses a batch of issues found during a painting test. Tools - Paint bucket used the background color unconditionally. It now picks FG/BG like the brush does, via a shared Color: [FG][BG] row that every color-using tool renders (brush, bucket, eyedropper). - The eyedropper previously inferred its target swatch from active_color_mode, which was only ever set as a side effect of opening a color picker — so where a sample landed depended on invisible state. It now has an explicit toggle, and active_color_mode is gone. - Effect brushes (dodge/burn, sponge, blur, smudge, clone, heal, pattern) were stuck on a hardcoded Gaussian dab. Replaced ~20 flat per-tool fields with a BrushKind -> BrushSlot model: every dab-painting tool now owns its size/strength/hardness/spacing, its .myb preset, and its FG/BG choice, and gets the full brush library. base_settings already flowed into the dab engine independently of blend_mode, so this needed no core or WGSL changes. Cursors - Rebuilt around three kinds instead of "icon = cursor": System (real OS cursor for Select/Transform), Precise (glyph with a real tip, e.g. pencil/pipette), and Badge (crosshair marks the click point, glyph sits to its bottom-right) for icons with no focus point. - Cursors are now OS-composited via egui::CursorImage rather than painted into the scene, so they no longer lag the pointer. Glyphs are rasterized from egui's font atlas using epaint's own placement maths, so they land where painter.text put them. Drops the SVG cursor rasterization path. Tablet - The Wayland backend never handled zwp_tablet_tool_v2 Button events, so stylus barrel buttons were silently dropped. Both Wayland and X11 now emit them, with actions bound in Preferences (Pan/Eyedropper/Eraser). A pan-bound button suppresses the tool the way Alt+drag does, since the pen tip is still down while panning. Also adds middle-mouse panning. Timeline - Raster layers had no opacity control; the slider always drove volume, which is meaningless on them. The layer row is now three tiers, and each layer only shows controls that apply to it: Vector/Video get both volume and opacity (they can hold movie clips with audio), Raster/Text get opacity, Audio gets volume. Mute/solo are hidden where there's no audio. - Layer toggles use Lucide icons with tooltips, and gain a visibility (eye) toggle. LayerProperty::Visible already existed but was only reachable from the info panel. - Below 1.5x the layer-header width, the track area is dropped and the headers take the full pane. Panes - Color picker popups closed on any click (including on their own hue slider) and would not close on a drag — so drawing on the stage left one open. Shared color_swatch widget closes on a press outside instead. - Stage header gains undo/redo buttons for tablet use, and taller targets. - Toolbar is real egui layout (horizontal_wrapped) instead of absolute rect math, so it scrolls when the pane is too short. - Tools with no SVG icon use Lucide glyphs instead of a TODO placeholder.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
use super::{BrushParams, RasterToolDef, RasterToolSettings};
|
||||
use eframe::egui;
|
||||
use super::{BrushKind, RasterToolDef};
|
||||
use lightningbeam_core::raster_layer::RasterBlendMode;
|
||||
|
||||
pub struct PaintTool;
|
||||
@@ -8,17 +7,7 @@ pub static PAINT: PaintTool = PaintTool;
|
||||
impl RasterToolDef for PaintTool {
|
||||
fn blend_mode(&self) -> RasterBlendMode { RasterBlendMode::Normal }
|
||||
fn header_label(&self) -> &'static str { "Brush" }
|
||||
fn brush_params(&self, s: &RasterToolSettings) -> BrushParams {
|
||||
let mut base_settings = s.active_brush_settings.clone();
|
||||
base_settings.elliptical_dab_angle += s.brush_angle_offset;
|
||||
BrushParams {
|
||||
base_settings,
|
||||
radius: s.brush_radius,
|
||||
opacity: s.brush_opacity,
|
||||
hardness: s.brush_hardness,
|
||||
spacing: s.brush_spacing,
|
||||
}
|
||||
}
|
||||
fn tool_params(&self, _s: &RasterToolSettings) -> [f32; 4] { [0.0; 4] }
|
||||
fn render_ui(&self, _ui: &mut egui::Ui, _s: &mut RasterToolSettings) {}
|
||||
fn brush_kind(&self) -> BrushKind { BrushKind::Paint }
|
||||
fn tool_params(&self, _s: &super::RasterToolSettings) -> [f32; 4] { [0.0; 4] }
|
||||
fn uses_color(&self) -> bool { true }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user