Layers: right-clicking a layer-mask thumbnail opens the mask menu (fixes #4575) (#4605)

Co-authored-by: Brandon Thomas <[email protected]>
This commit is contained in:
Marco ArnulfoandBrandon Thomas authored and GitHub committed 2026-10-13 01:15:13 -04:00
1 parent 93397b08c6
commit 4eb8ca25bd
22 files changed
+160 -3

No files matched your search

+3
View File
@@ -859,6 +859,9 @@
Appearance Vzhled
Appearance (Layer Style) Vzhled (styl vrstvy)
Apply Layer Mask Použít masku vrstvy
Add Mask to Selection Přidat masku do výběru
Subtract Mask from Selection Odečíst masku od výběru
Intersect Mask with Selection Průnik masky s výběrem
Apply Per Tip Použít pro každý hrot
Apply next selected layer comp Použít další vybranou kompozici vrstev
Apply previous selected layer comp Použít předchozí vybranou kompozici vrstev
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -837,6 +837,9 @@
Appearance Erscheinungsbild
Appearance (Layer Style) Erscheinungsbild (Ebenenstil)
Apply Layer Mask Ebenenmaske anwenden
Add Mask to Selection Maske zur Auswahl hinzufügen
Subtract Mask from Selection Maske von Auswahl subtrahieren
Intersect Mask with Selection Schnittmenge von Maske und Auswahl
Apply Per Tip Pro Pinselspitze anwenden
Apply next selected layer comp Nächste ausgewählte Ebenenkomposition anwenden
Apply previous selected layer comp Vorherige ausgewählte Ebenenkomposition anwenden
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -262,6 +262,9 @@
Add Layer Mask Προσθήκη μάσκας επιπέδου
Always use pressure for opacity Πάντα χρήση πίεσης για την αδιαφάνεια
Apply Layer Mask Εφαρμογή μάσκας επιπέδου
Add Mask to Selection Προσθήκη μάσκας στην επιλογή
Subtract Mask from Selection Αφαίρεση μάσκας από την επιλογή
Intersect Mask with Selection Τομή μάσκας με την επιλογή
Brush Preset picker Επιλογή προεπιλογής πινέλου
Brush Reconstruct Options Επιλογές πινέλου επαναφοράς
Brush Tool Options Επιλογές πινέλου (Brush Tool)
1 # Greek (el) PhotoCraft interface catalog.
262
263
264
265
266
267
268
269
270
+3
View File
@@ -846,6 +846,9 @@
Appearance Apariencia
Appearance (Layer Style) Apariencia (estilo de capa)
Apply Layer Mask Aplicar máscara de capa
Add Mask to Selection Añadir máscara a la selección
Subtract Mask from Selection Restar máscara de la selección
Intersect Mask with Selection Intersecar máscara con la selección
Apply Per Tip Aplicar por punta
Apply next selected layer comp Aplicar la composición de capa seleccionada siguiente
Apply previous selected layer comp Aplicar la composición de capa seleccionada anterior
Can't render this file because it contains an unexpected character in line 4 and column 47.
+3
View File
@@ -834,6 +834,9 @@
Appearance Apparence
Appearance (Layer Style) Apparence (style de calque)
Apply Layer Mask Appliquer le masque de calque
Add Mask to Selection Ajouter le masque à la sélection
Subtract Mask from Selection Soustraire le masque de la sélection
Intersect Mask with Selection Intersection du masque et de la sélection
Apply Per Tip Appliquer par pointe
Apply next selected layer comp Appliquer la composition de calques sélectionnée suivante
Apply previous selected layer comp Appliquer la composition de calques sélectionnée précédente
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -444,6 +444,9 @@
Appearance Megjelenés
Apply Data Set Adatkészlet alkalmazása
Apply Layer Mask Rétegmaszk alkalmazása
Add Mask to Selection Maszk hozzáadása a kijelöléshez
Subtract Mask from Selection Maszk kivonása a kijelölésből
Intersect Mask with Selection Maszk metszése a kijelöléssel
Artboard Guides Rajztábla-segédvonalak
Artboards to Files Rajztáblák fájlokba
Artboards to PDF Rajztáblák PDF-be
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -828,6 +828,9 @@
Appearance Tampilan
Appearance (Layer Style) Tampilan (Gaya Layer)
Apply Layer Mask Terapkan Mask Layer
Add Mask to Selection Tambahkan Mask ke Seleksi
Subtract Mask from Selection Kurangi Mask dari Seleksi
Intersect Mask with Selection Iriskan Mask dengan Seleksi
Apply Per Tip Terapkan Per Ujung
Apply next selected layer comp Terapkan layer comp terpilih berikutnya
Apply previous selected layer comp Terapkan layer comp terpilih sebelumnya
Can't render this file because it contains an unexpected character in line 4 and column 47.
+3
View File
@@ -843,6 +843,9 @@
Appearance Aspetto
Appearance (Layer Style) Aspetto (stile livello)
Apply Layer Mask Applica maschera di livello
Add Mask to Selection Aggiungi maschera alla selezione
Subtract Mask from Selection Sottrai maschera dalla selezione
Intersect Mask with Selection Interseca maschera con la selezione
Apply Per Tip Applica per punta
Apply next selected layer comp Applica composizione livelli successiva selezionata
Apply previous selected layer comp Applica composizione livelli precedente selezionata
1 # Italian (it) catalog. Columns, separated by a TAB: context <TAB> source <TAB> translation
843
844
845
846
847
848
849
850
851
+3
View File
@@ -847,6 +847,9 @@
Appearance 外観
Appearance (Layer Style) 外観 (レイヤースタイル)
Apply Layer Mask レイヤーマスクを適用
Add Mask to Selection マスクを選択範囲に追加
Subtract Mask from Selection 選択範囲からマスクを削除
Intersect Mask with Selection 選択範囲とマスクの共通範囲
Apply Per Tip 先端ごとに適用
Apply next selected layer comp 次のレイヤーカンプを適用
Apply previous selected layer comp 前のレイヤーカンプを適用
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -819,6 +819,9 @@
Appearance 모양새
Appearance (Layer Style) 모양새(레이어 스타일)
Apply Layer Mask 레이어 마스크 적용
Add Mask to Selection 선택 영역에 마스크 추가
Subtract Mask from Selection 선택 영역에서 마스크 빼기
Intersect Mask with Selection 마스크와 선택 영역 교차
Apply Per Tip 끝당 적용
Apply next selected layer comp 선택한 다음 레이어 구성 요소 적용
Apply previous selected layer comp 선택한 이전 레이어 구성 요소 적용
1 # Korean (ko) catalog. UTF-8: context<TAB>English source<TAB>translation.
819
820
821
822
823
824
825
826
827
+3
View File
@@ -826,6 +826,9 @@
Appearance Weergave
Appearance (Layer Style) Weergave (laagstijl)
Apply Layer Mask Laagmasker toepassen
Add Mask to Selection Masker aan selectie toevoegen
Subtract Mask from Selection Masker van selectie aftrekken
Intersect Mask with Selection Masker met selectie laten snijden
Apply Per Tip Per punt toepassen
Apply next selected layer comp Volgende geselecteerde laagcompositie toepassen
Apply previous selected layer comp Vorige geselecteerde laagcompositie toepassen
Can't render this file because it contains an unexpected character in line 8 and column 34.
+3
View File
@@ -845,6 +845,9 @@
Appearance Wygląd
Appearance (Layer Style) Wygląd (styl warstwy)
Apply Layer Mask Zastosuj maskę warstwy
Add Mask to Selection Dodaj maskę do zaznaczenia
Subtract Mask from Selection Odejmij maskę od zaznaczenia
Intersect Mask with Selection Część wspólna maski i zaznaczenia
Apply Per Tip Zastosuj dla każdego odcisku
Apply next selected layer comp Zastosuj następną zaznaczoną kompozycję warstw
Apply previous selected layer comp Zastosuj poprzednią zaznaczoną kompozycję warstw
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -828,6 +828,9 @@
Appearance Aparência
Appearance (Layer Style) Aparência (estilo de camada)
Apply Layer Mask Aplicar máscara de camada
Add Mask to Selection Adicionar máscara à seleção
Subtract Mask from Selection Subtrair máscara da seleção
Intersect Mask with Selection Fazer interseção da máscara com a seleção
Apply Per Tip Aplicar por ponta
Apply next selected layer comp Aplicar a próxima composição de camadas selecionada
Apply previous selected layer comp Aplicar a composição de camadas selecionada anterior
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -206,6 +206,9 @@
Enable Layer Mask Включить маску слоя
Disable Layer Mask Отключить маску слоя
Apply Layer Mask Применить маску слоя
Add Mask to Selection Добавить маску к выделению
Subtract Mask from Selection Вычесть маску из выделения
Intersect Mask with Selection Пересечь маску с выделением
Link Layer Mask Связать маску слоя
Unlink Layer Mask Отвязать маску слоя
Vector Mask Векторная маска
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -821,6 +821,9 @@
Appearance Görünüm
Appearance (Layer Style) Görünüm (Katman Stili)
Apply Layer Mask Katman Maskesini Uygula
Add Mask to Selection Maskeyi Seçime Ekle
Subtract Mask from Selection Maskeyi Seçimden Çıkar
Intersect Mask with Selection Maskeyi Seçimle Kesiştir
Apply Per Tip İpucu Başına Uygula
Apply next selected layer comp Sonraki seçilen katman kompozisyonunu uygula
Apply previous selected layer comp Önceki seçilen katman kompozisyonunu uygula
Can't render this file because it contains an unexpected character in line 8 and column 34.
+3
View File
@@ -193,6 +193,9 @@
Enable Layer Mask Увімкнути маску шару
Disable Layer Mask Вимкнути маску шару
Apply Layer Mask Застосувати маску шару
Add Mask to Selection Додати маску до виділення
Subtract Mask from Selection Відняти маску від виділення
Intersect Mask with Selection Перетнути маску з виділенням
Link Layer Mask Зв'язати маску шару
Unlink Layer Mask Відв'язати маску шару
Vector Mask Векторна маска
1 # Ukrainian (uk) catalog. UTF-8: context<TAB>English source<TAB>translation.
193
194
195
196
197
198
199
200
201
+3
View File
@@ -948,6 +948,9 @@
Duplicate Layers… Nhân bản các lớp…
Add Layer Mask Thêm mặt nạ lớp
Apply Layer Mask Áp dụng mặt nạ lớp
Add Mask to Selection Thêm mặt nạ vào vùng chọn
Subtract Mask from Selection Trừ mặt nạ khỏi vùng chọn
Intersect Mask with Selection Giao mặt nạ với vùng chọn
Delete Layer Mask Xóa mặt nạ lớp
Disable Layer Mask Tắt mặt nạ lớp
Release Clipping Mask Nhả mặt nạ cắt
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -848,6 +848,9 @@
Appearance 外观
Appearance (Layer Style) 外观(图层样式)
Apply Layer Mask 应用图层蒙版
Add Mask to Selection 添加蒙版到选区
Subtract Mask from Selection 从选区中减去蒙版
Intersect Mask with Selection 蒙版与选区交叉
Apply Per Tip 应用于每个笔尖
Apply next selected layer comp 应用下一个选中的图层复合
Apply previous selected layer comp 应用上一个选中的图层复合
1 # Simplified Chinese (zh-hans) catalog. UTF-8, TAB-separated columns:
848
849
850
851
852
853
854
855
856
+3
View File
@@ -851,6 +851,9 @@
Appearance 外觀
Appearance (Layer Style) 外觀 (圖層樣式)
Apply Layer Mask 套用圖層遮色片
Add Mask to Selection 增加遮色片至選取範圍
Subtract Mask from Selection 從選取範圍中減去遮色片
Intersect Mask with Selection 遮色片與選取範圍相交
Apply Per Tip 依筆尖套用
Apply next selected layer comp 套用下一個選取的圖層構圖
Apply previous selected layer comp 套用上一個選取的圖層構圖
Can't render this file because it contains an unexpected character in line 6 and column 47.
+89
View File
@@ -157,6 +157,41 @@ pub fn show(app: &crate::PhotocraftApp, ui: &mut egui::Ui, l: &Layer, on_set: bo
})
}
/// The menu of `l`'s layer-mask thumbnail (#4575), in Photoshop's order. It acts on `l`, which it
/// selects first like the row menu. Photoshop's Mask Options… (the overlay colour) has no
/// command yet, so it is left out.
pub fn show_mask(app: &crate::PhotocraftApp, ui: &mut egui::Ui, l: &Layer, actions: &mut Vec<(String, Value)>) {
let Some(mask) = &l.mask else { return };
crate::widgets::menu_scroll(ui, |ui| {
ui.set_min_width(220.0);
let edits = vec![
Some((tl!(mask_toggle_label(mask.enabled)), "layer.layerMask.enabled")),
Some((tl!("Delete Layer Mask"), "layer.layerMask.delete")),
Some((tl!("Apply Layer Mask"), "layer.layerMask.apply")),
];
items(app, ui, l, false, edits, actions);
ui.separator();
// ⌘⇧-, ⌘⌥- and ⌘⇧⌥-clicking the thumbnail, as menu items.
let loads =
[(tl!("Add Mask to Selection"), "add"), (tl!("Subtract Mask from Selection"), "subtract"), (tl!("Intersect Mask with Selection"), "intersect")];
for (label, operation) in loads {
if ui.button(label).clicked() {
actions.push(("layer.select".into(), json!({"layer": l.id.0})));
actions.push(("select.loadSelection".into(), json!({"channel": "mask", "layer": l.id.0, "operation": operation})));
ui.close();
}
}
ui.separator();
if ui.add_enabled(crate::menus::is_enabled(app, "select.selectAndMask"), egui::Button::new(tl!("Select and Mask…"))).clicked() {
// Like double-clicking the thumbnail with that preference on: it refines the mask.
actions.push(("layer.select".into(), json!({"layer": l.id.0})));
actions.push(("ui.maskTarget".into(), json!(true)));
actions.push(("select.selectAndMask".into(), Value::Null));
ui.close();
}
});
}
/// Render the layer style menu of `l`'s effect rows ([`effects_entries`]); the actions select `l`
/// first when it isn't the active layer.
pub fn show_effects(app: &crate::PhotocraftApp, ui: &mut egui::Ui, l: &Layer, actions: &mut Vec<(String, Value)>) {
@@ -434,6 +469,60 @@ mod tests {
}
}
/// #4575: right-clicking a layer-mask thumbnail opens Photoshop's mask menu, not the layer
/// menu, and its selection items load the clicked layer's mask (not the active layer's).
#[test]
fn mask_thumbnail_context_menu_acts_on_the_clicked_mask() {
use crate::PhotocraftApp;
use egui::{Event, Modifiers, PointerButton, Pos2, vec2};
use egui_kittest::{Harness, kittest::Queryable};
fn click(h: &mut Harness<'_, PhotocraftApp>, at: Pos2, button: PointerButton) {
h.hover_at(at);
h.step();
for pressed in [true, false] {
h.event(Event::PointerButton { pos: at, button, pressed, modifiers: Modifiers::NONE });
h.step();
}
h.run_steps(3);
}
let mut s = photocraft_engine::Session::new();
s.execute("file.new", json!({"width": 100, "height": 60})).unwrap();
s.execute("layer.new.layer", json!({"name": "Masked"})).unwrap();
s.execute("select.rect", json!({"x": 60, "y": 0, "width": 40, "height": 60})).unwrap();
s.execute("layer.layerMask.revealSelection", json!({})).unwrap();
let masked = s.active().unwrap().active_layer.unwrap();
// Another layer is active, and the selection doesn't overlap the mask.
s.execute("layer.new.layer", json!({"name": "Other active layer"})).unwrap();
s.execute("select.rect", json!({"x": 0, "y": 0, "width": 20, "height": 60})).unwrap();
let mut h = Harness::builder().with_size(vec2(1440.0, 900.0)).with_step_dt(1.0 / 60.0).with_max_steps(64).build_eframe(move |cc| {
PhotocraftApp::setup_context(&cc.egui_ctx, Default::default());
PhotocraftApp::new(s, crate::Services::default())
});
let ctx = h.ctx.clone();
let (req, _rx) = crate::control::ControlRequest::new("ui.set", json!({"dock": {"collapsed": ["color", "properties", "history", "navigator"]}}));
crate::control::handle(h.state_mut(), &ctx, &req);
h.run_steps(8);
let (thumbs, _) = crate::mask_thumbs_ui::recorded(&h.ctx, masked.0).expect("mask thumbnail drawn");
let at = thumbs.iter().find(|(k, _)| *k == crate::mask_thumbs_ui::MaskKind::Pixel).unwrap().1.center();
click(&mut h, at, PointerButton::Secondary);
assert!(h.query_by_label("Blending Options…").is_none(), "the mask menu, not the layer menu");
for item in
["Disable Layer Mask", "Delete Layer Mask", "Apply Layer Mask", "Subtract Mask from Selection", "Intersect Mask with Selection", "Select and Mask…"]
{
h.get_by_label(item);
}
let at = h.get_by_label("Add Mask to Selection").rect().center();
click(&mut h, at, PointerButton::Primary);
let st = h.state().session.active().unwrap();
assert_eq!(st.active_layer, Some(masked));
let sel = st.doc.selection.as_ref().expect("a selection");
assert!(sel.sample_channel(10, 30, 0) > 0.99, "the selection is kept");
assert!(sel.sample_channel(80, 30, 0) > 0.99, "the clicked layer's mask is added");
assert!(sel.sample_channel(40, 30, 0) < 0.01, "nothing else is selected");
}
#[test]
fn a_long_layer_menu_stays_inside_a_short_window_and_scrolls() {
let mut s = photocraft_engine::Session::new();
+11 -1
View File
@@ -2890,10 +2890,20 @@ fn layer_row(
if let Some(done) = crate::layer_row_ui::rename_field(ui, l.id.0, edit_rect) {
actions.push(done);
}
// The visibility icon has its own color menu; elsewhere use the full layer menu.
// The visibility icon has its own color menu, and the layer-mask thumbnail its mask menu
// (#4575); elsewhere use the full layer menu.
let on_mask_id = ui.id().with(("mask-menu", l.id.0));
if resp.secondary_clicked() {
let on_mask = resp.interact_pointer_pos().and_then(|p| masks.hit(p)) == Some(crate::mask_thumbs_ui::MaskKind::Pixel);
ctx.data_mut(|d| d.insert_temp(on_mask_id, on_mask));
}
if !eye_resp.secondary_clicked() && !eye_resp.context_menu_opened() {
resp.context_menu(|ui| {
crate::widgets::style_spectrum_popup_menu(ui);
if ui.ctx().data(|d| d.get_temp::<bool>(on_mask_id)).unwrap_or(false) {
crate::layer_menu_ui::show_mask(app, ui, l, actions);
return;
}
// Right-clicking inside a multi-selection keeps it and acts on every selected layer.
let on_set = row.multi && selected;
if crate::layer_menu_ui::show(app, ui, l, on_set, actions)
+3 -2
View File
@@ -1,6 +1,6 @@
# Context-menu parity contract
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-10 · **Change:** trivial (status line and revision history added; linked from ui-parity.md) · **Target:** Adobe Photoshop 2026
> **Last reviewed:** 2026-10-13 · **Last updated:** 2026-10-13 · **Change:** minor (layer-mask thumbnail menu, #4575) · **Target:** Adobe Photoshop 2026
Status: implementation contract, updated 2026-10-09. Scope: canvas, document tabs, and panels. “Right-click” means a secondary pointer click; macOS Control-click should also open the same menu where the platform sends a context-menu gesture. Photoshop changes a context menu with the active tool, selection, and panel item. Adobe documents that principle but does not publish a complete current menu catalog. **Documented** means an Adobe source explicitly names the gesture or action. **Inferred** means a PhotoCraft design target or an item known from a main menu whose presence in a Photoshop context menu still needs a current-product capture. Do not present inferred rows as exact Photoshop menus. [Adobe: panels and menus](https://helpx.adobe.com/photoshop/using/panels-menus.html), [Adobe: shortcuts and context menus](https://helpx.adobe.com/sa_en/photoshop/using/customizing-keyboard-shortcuts.html).
@@ -77,7 +77,7 @@ Photoshop's Generative Fill and Delete and Fill Selection rows are left out: Pho
| Surface / target | Desired options and state | PhotoCraft now | Source and confidence |
|---|---|---|---|
| Layers panel row | Blending Options, Duplicate/Delete, Group, export, convert/rasterize, mask, clipping, link, style copy/paste/clear, merge/flatten, Rename; filter by layer kind and selection | Implemented in layer_menu_ui.rs; item enablement uses menu commands | PhotoCraft inventory. Adobe documents layer rename/delete, color tagging, rasterization, and flattening [here](https://helpx.adobe.com/photoshop/using/layers.html); exact combined ordering **inferred** without a live capture |
| Layers panel color label / thumbnail / mask thumbnail / effect row | Color label; context actions specific to hit icon | Generic row on some targets; inspect before extending | Adobe explicitly documents right-click on layer/group to assign a color ([layers](https://helpx.adobe.com/photoshop/using/layers.html)); other icon menus need capture |
| Layers panel color label / thumbnail / mask thumbnail / effect row | Color label; context actions specific to hit icon | Layer-mask thumbnail: Disable/Delete/Apply Layer Mask, Add/Subtract/Intersect Mask with Selection, Select and Mask… (layer_menu_ui.rs `show_mask`, #4575; Mask Options… missing). Generic row on the other targets; inspect before extending | Adobe explicitly documents right-click on layer/group to assign a color ([layers](https://helpx.adobe.com/photoshop/using/layers.html)); other icon menus need capture |
| Channels panel row | Duplicate/Delete/Rename, channel display and overlay color, spot conversion; new/split/merge | Implemented in channels_panel.rs | PhotoCraft inventory; exact Photoshop order **inferred** |
| Brushes and preset panels | Rename/Delete brush or group, export selected brushes, view/reset preset choices | Rename/Delete, and preset group/item menus exist | Adobe explicitly documents Export Selected Brushes from brush/group right-click ([brushes](https://helpx.adobe.com/photoshop/desktop/apply-painting-techniques/brushes-presets/create-brush-set-painting-options.html)); Photoshop pop-up-panel rename/delete/reset/view options are [documented](https://helpx.adobe.com/photoshop/using/panels-menus.html), though some are panel-button menus |
| Paths, History, Actions, Swatches, Gradients, Patterns, Styles, Libraries, Properties | Target-specific duplicate/delete/rename and panel operations where a panel exists | Paths row menu added in this PR; other panels need audit | **Inferred** catalog; record a Photoshop capture before claiming parity |
@@ -100,6 +100,7 @@ Each slice needs pure model tests (including every item dispatching a known comm
| Date | Change | Summary |
|---|---|---|
| 2026-10-13 | minor | Layer-mask thumbnail menu (#4575) |
| 2026-10-10 | trivial | Status line, revision history |
| 2026-10-09 | minor | Selection canvas reference and tool matrix updates |
| 2026-10-07 | minor | Pen canvas reference capture |