mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-22 15:14:11 -04:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2173abe048 |
No files matched your search
@@ -930,7 +930,13 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
for id in ids {
|
||||
let l = doc.layer_mut(id).ok_or(EngineError::NoLayer(id))?;
|
||||
l.effects = fx.clone();
|
||||
l.blend = style.blend;
|
||||
// Pass Through is a group's mode: a group's style pastes onto other layers as
|
||||
// Normal, as a merged group's Pass Through becomes Normal.
|
||||
l.blend = if style.blend == photocraft_color::BlendMode::PassThrough && !l.is_group() {
|
||||
photocraft_color::BlendMode::Normal
|
||||
} else {
|
||||
style.blend
|
||||
};
|
||||
l.fill_opacity = style.fill;
|
||||
l.advanced = style.advanced;
|
||||
l.blend_if = blend_if.clone();
|
||||
|
||||
@@ -432,8 +432,8 @@ pub struct Session {
|
||||
coalesce_request: Option<String>,
|
||||
/// Pixels copied with Edit › Copy / Cut (shared by all documents, like Photoshop).
|
||||
pub clipboard: Option<edit_cmds::Clip>,
|
||||
/// Layer › Layer Style › Copy Layer Style: effects, blend mode, fill opacity and the Advanced
|
||||
/// Blending switches.
|
||||
/// Layer › Layer Style › Copy Layer Style: the effects and the Blending Options
|
||||
/// ([`CopiedStyle`]: blend mode, fill opacity, Advanced Blending, Blend If, channels).
|
||||
pub style_clipboard: Option<CopiedStyle>,
|
||||
/// Shape path context menu: copied vector fill and stroke styles.
|
||||
pub path_fill_clipboard: Option<photocraft_doc::Fill>,
|
||||
|
||||
@@ -97,3 +97,19 @@ fn several_layers_align_to_an_active_selection() {
|
||||
assert_eq!(x0, 40, "layer {id} aligned to the selection's left edge");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_groups_pass_through_pastes_onto_a_pixel_layer_as_normal() {
|
||||
let mut s = Session::new();
|
||||
let (a, _) = new_doc(&mut s, "rgb");
|
||||
let g = s.execute("layer.new.group", json!({})).unwrap()["layer"].as_u64().unwrap();
|
||||
assert_eq!(layer(&s, g).blend, photocraft_color::BlendMode::PassThrough);
|
||||
s.execute("layer.layerStyle.copyLayerStyle", json!({"layer": g})).unwrap();
|
||||
s.execute("layer.layerStyle.pasteLayerStyle", json!({"layer": a})).unwrap();
|
||||
assert_eq!(layer(&s, a).blend, photocraft_color::BlendMode::Normal, "Pass Through isn't a pixel layer's mode");
|
||||
// Onto another group it stays Pass Through.
|
||||
let g2 = s.execute("layer.new.group", json!({})).unwrap()["layer"].as_u64().unwrap();
|
||||
s.execute("layer.setProps", json!({"layer": g2, "blend": "Multiply"})).unwrap();
|
||||
s.execute("layer.layerStyle.pasteLayerStyle", json!({"layer": g2})).unwrap();
|
||||
assert_eq!(layer(&s, g2).blend, photocraft_color::BlendMode::PassThrough);
|
||||
}
|
||||
Reference in new issue
Block a user