mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-16 20:02:20 +02:00
feat(photo-editor): Ajax Image Editor client (Photoshop-parity tools)
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>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c74f475679
commit
5fac693c1c
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Workspace presets ("Window > Workspace").
|
||||
*
|
||||
* Each preset sets up the editor windows: which dock panels are shown, the
|
||||
* active dock tab and the right-panel width. Selecting one is a one-click
|
||||
* window layout switch.
|
||||
*/
|
||||
|
||||
import { PANEL_IDS } from './panel-visibility.js';
|
||||
|
||||
export const WORKSPACES = Object.freeze({
|
||||
essentials: Object.freeze({ label: 'Essentials', tab: 'layers', width: 300, panels: Object.freeze(['layers', 'options', 'swatches', 'gradients', 'adjustments', 'history', 'info']) }),
|
||||
photography: Object.freeze({ label: 'Photography', tab: 'histogram', width: 320, panels: Object.freeze(['layers', 'options', 'histogram', 'info', 'navigator', 'adjustments']) }),
|
||||
painting: Object.freeze({ label: 'Painting', tab: 'swatches', width: 300, panels: Object.freeze(['layers', 'options', 'swatches', 'gradients', 'patterns', 'character']) }),
|
||||
graphic: Object.freeze({ label: 'Graphic & Web', tab: 'options', width: 320, panels: Object.freeze(['layers', 'options', 'character', 'properties', 'adjustments', 'paths', 'info', 'history']) }),
|
||||
});
|
||||
|
||||
export function applyWorkspace(name, { dock = null, rightPanel = null, setPanelVisible = null, persistKey = 'ge-right-panel-width' } = {}) {
|
||||
const workspace = WORKSPACES[name];
|
||||
if (!workspace) return false;
|
||||
if (dock && typeof dock.show === 'function') dock.show(workspace.tab);
|
||||
if (rightPanel && Number.isFinite(workspace.width)) {
|
||||
rightPanel.style.width = `${workspace.width}px`;
|
||||
try {
|
||||
localStorage.setItem(persistKey, String(workspace.width));
|
||||
} catch (error) {
|
||||
/* storage unavailable — ignore */
|
||||
}
|
||||
}
|
||||
// Show exactly this preset's panels and hide the rest, so switching a
|
||||
// workspace visibly rearranges the window.
|
||||
if (typeof setPanelVisible === 'function' && Array.isArray(workspace.panels)) {
|
||||
const visible = new Set(workspace.panels);
|
||||
for (const id of PANEL_IDS) setPanelVisible(id, visible.has(id));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user