Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Merge the Layers Panel flyout branch (upstream/main 6d8cbac7 merged) into the Fill layers branch

abc2cbff5708361d94
diff --cc crates/engine/src/commands.rs
index 194c8bd72,d7b9e8740..8f1edea63
--- a/crates/engine/src/commands.rs
+++ b/crates/engine/src/commands.rs
@@@ -1066,10 -1056,9 +1061,10 @@@ fn build() -> Vec<CommandSpec>
|s, p| {
let a = color_param("layer.newFillLayer.gradient", p, "from", s.tools.foreground)?;
let b = color_param("layer.newFillLayer.gradient", p, "to", s.tools.background)?;
- let angle = f32_or(p, "angle", 90.0);
+ let angle = crate::gradient_fill_cmds::angle_param("layer.newFillLayer.gradient", p, 90.0)?;
let style = crate::layer_style::gradient_style(p.get("style").and_then(Value::as_str).unwrap_or("linear"));
let reverse = p.get("reverse").and_then(Value::as_bool).unwrap_or(false);
+ let default_mask = layer_panel_option(s, "useDefaultMasksOnFillLayers", true);
let id = s.edit("New Gradient Fill Layer", |doc, active| {
let fill = Fill::gradient(
vec![(0.0, Color::rgba(a[0], a[1], a[2], a[3])), (1.0, Color::rgba(b[0], b[1], b[2], b[3]))],
diff --cc crates/engine/src/pattern_cmds.rs
index c81d4145a,052ce2f41..95163d39f
--- a/crates/engine/src/pattern_cmds.rs
+++ b/crates/engine/src/pattern_cmds.rs
@@@ -311,14 -317,8 +317,14 @@@ pub(crate) fn placement(cmd: &str, p: &
/// The edit of `layer.newFillLayer.pattern`: a Pattern Fill layer of `pat` placed as `p` asks,
/// above `active`. The Pattern Fill dialog previews it on a copy of the document.
-pub(crate) fn insert_fill_layer(doc: &mut Document, active: &mut Option<photocraft_doc::LayerId>, pat: &Pattern, p: &Value) -> Result<photocraft_doc::LayerId> {
+pub(crate) fn insert_fill_layer(
+ doc: &mut Document,
+ active: &mut Option<photocraft_doc::LayerId>,
+ pat: &Pattern,
+ p: &Value,
+ default_mask: bool,
+) -> Result<photocraft_doc::LayerId> {
- let (scale, angle, link, phase) = placement(p);
+ let (scale, angle, link, phase) = placement("layer.newFillLayer.pattern", p)?;
ensure_in_doc(doc, pat);
let fill = Fill::Pattern { name: pat.name.clone(), scale, id: pat.id.clone(), angle, link, phase };
let mut l = Layer::new(doc.next_layer_name("Pattern Fill"), LayerContent::Fill(fill));