mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-16 03:42:20 +02:00
Photoshop-parity editor client: layers, selection/masking, brushes,
smart filters, LUT import, Quick Edit, mobile gestures, workspaces,
batch operations, and the service-worker versioning (v978->v1006).
Source: vendor/photocraft (ad1cff44) photo-editor client files, merged
onto upstream/dev (a8c147b2). Conflict resolution documented in
pr_work/A_conflicts.md; editor files taken from vendor/photocraft
(upstream's editor is an earlier snapshot of the same feature).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
/**
|
|
* Photoshop-style nested flyout menus for the editor topbar.
|
|
*
|
|
* A `.ge-menu-parent` row reveals its sibling `.ge-submenu` panel. Hover is
|
|
* handled in CSS; this wires the click toggle (and aligns the flyout with the
|
|
* clicked row). The children stay in the same menu subtree, so the existing
|
|
* delegated `[data-*-action]` handlers keep firing.
|
|
*
|
|
* Shared by the Image / Filter / Selection menus (wire-topbar-menus.js) and
|
|
* the Window > Workspace submenu (wire-extra-menus.js).
|
|
*/
|
|
export function wireSubmenuToggles(menu) {
|
|
menu.addEventListener('click', (e) => {
|
|
const parent = e.target.closest('.ge-menu-parent');
|
|
if (!parent) return;
|
|
e.stopPropagation();
|
|
const willOpen = !parent.classList.contains('open');
|
|
menu.querySelectorAll('.ge-menu-parent.open').forEach((other) => {
|
|
if (other === parent) return;
|
|
other.classList.remove('open');
|
|
other.setAttribute('aria-expanded', 'false');
|
|
});
|
|
parent.classList.toggle('open', willOpen);
|
|
parent.setAttribute('aria-expanded', String(willOpen));
|
|
if (willOpen) {
|
|
// Align the flyout with the clicked row rather than the menu top.
|
|
const panel = parent.nextElementSibling;
|
|
if (panel && panel.classList.contains('ge-submenu')) {
|
|
panel.style.top = parent.offsetTop + 'px';
|
|
}
|
|
}
|
|
});
|
|
}
|