feat: Enhance brush settings and add new layer paste functionality

- Added brush color variant and variant amount settings to the brush panel.
- Introduced a checkbox for color variant and a slider for variant amount in the brush settings.
- Implemented "Paste as New Layer" functionality, allowing users to paste clipboard images directly onto a new layer.
- Updated menus to include the new paste option with a shortcut.
- Improved layer panel iconography by replacing text buttons with SVG icons for visibility and lock toggles.
- Created new SVG assets for closed eye and watercolor icons.
- Enhanced history panel to provide richer descriptions for brush strokes and vector shape modifications.
- Fixed the issue where the first brush stroke was missing from the history panel.
This commit is contained in:
2026-07-21 17:40:41 +03:00
parent e5d899d72d
commit 7b4073e55b
18 changed files with 1732 additions and 173 deletions
+20 -3
View File
@@ -62,16 +62,28 @@ pub struct PendingHistoryItem {
}
impl Engine {
/// Returns true if at least one background-thread history snapshot is still
/// waiting to be committed to the document history.
///
/// This is used by the GUI to decide whether to schedule an additional
/// delayed `commit_pending_history` poll after a brush stroke ends.
pub fn has_pending_history(&self) -> bool {
!self.pending_history.lock().unwrap().is_empty()
}
/// Commit any pending history items computed in the background thread.
/// This should be polled on the UI thread.
///
/// Also recycles returned buffers back into the engine's pool to avoid
/// allocations on subsequent strokes.
pub fn commit_pending_history(&mut self) {
///
/// Returns `true` if at least one pending snapshot was committed on this
/// call, `false` if the queue was empty.
pub fn commit_pending_history(&mut self) -> bool {
let items = {
let mut pending = self.pending_history.lock().unwrap();
if pending.is_empty() {
return;
return false;
}
std::mem::take(&mut *pending)
};
@@ -106,6 +118,7 @@ impl Engine {
);
}
}
true
}
/// Begin a new brush stroke on the given layer.
@@ -259,6 +272,7 @@ impl Engine {
None
};
let style = self.current_tip.style;
let bounds = self.last_stroke_bounds;
let pending_history = self.pending_history.clone();
@@ -275,7 +289,10 @@ impl Engine {
bounds: None,
before_shapes,
after_shapes,
description: "Brush Stroke".to_string(),
description: format!(
"Brush Stroke ({})",
crate::stroke_brush::brush_style_label(style)
),
return_before: None,
return_after: None,
};