mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Co-authored-by: Brandon Thomas <[email protected]>
This commit is contained in:
1 parent
6b6a9234d1
commit
adaebc084d
2 files changed
+20
-1
No files matched your search
@@ -1226,7 +1226,12 @@ fn target(s: &mut Session, t: ChannelTarget) {
|
||||
let v = &mut st.channel_view;
|
||||
v.target = t;
|
||||
match t {
|
||||
ChannelTarget::Composite | ChannelTarget::LayerMask | ChannelTarget::VectorMask => v.color_hidden.clear(),
|
||||
// Like clicking RGB in Photoshop: the alpha overlays go away with their eyes.
|
||||
ChannelTarget::Composite => {
|
||||
v.color_hidden.clear();
|
||||
v.alpha_visible.clear();
|
||||
}
|
||||
ChannelTarget::LayerMask | ChannelTarget::VectorMask => v.color_hidden.clear(),
|
||||
ChannelTarget::Color(k) => {
|
||||
v.color_hidden = (0..colors).map(|c| c != k).collect();
|
||||
v.alpha_visible.clear();
|
||||
|
||||
@@ -218,6 +218,20 @@ fn deleting_a_channel_remaps_all_surviving_eyes_and_targets() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn targeting_the_composite_hides_the_alpha_overlay() {
|
||||
for (cmd, params) in [("channel.target", json!({"channel": "composite"})), ("channel.target.composite", json!({}))] {
|
||||
let mut s = session();
|
||||
s.execute("channel.new", json!({})).unwrap();
|
||||
assert!(s.active().unwrap().channel_view.alpha_shown(0));
|
||||
s.execute(cmd, params).unwrap();
|
||||
let st = s.active().unwrap();
|
||||
assert_eq!(st.channel_view.visible_colors(3), 3, "{cmd}");
|
||||
assert!(!st.channel_view.alpha_shown(0), "{cmd}: the alpha eye turns off");
|
||||
assert!(st.channel_view.is_plain(&st.doc), "{cmd}: no overlay left on the image (#4538)");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_colour_channel_can_hide_while_alpha_stays() {
|
||||
let mut s = session();
|
||||
|
||||
Reference in new issue
Block a user