mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-04 05:18:19 +00:00
Minor Tooling and UI Improvements (#1314)
* [wip]fix: disable fill and gradient tools on bmp images - aims to fix #1161 * [wip]fix: disable gradient tool for bmp images * fix: disable gradient tool for bitmap images - fixes https://github.com/GraphiteEditor/Graphite/issues/1161 * [wip]fix: disable menu bar elements if no open document * [WIP]feat: render certain menubar elements if document is open * fix: conditional menu bar rendering fixes - update menu bar on certain document actions - fix menu bar order on rendering all elements * refactor: change conditional menu elements property - use existing 'disabled' property * feat: render menu dropdown items conditionally * fix: revert formatter whitespace changes * refactor: improve variable naming and message usage - name menu bar bool flag better - use SendLayout message and remove unneeded calls
This commit is contained in:
parent
173398ad55
commit
9c2520111d
7 changed files with 137 additions and 78 deletions
|
@ -63,7 +63,7 @@
|
|||
// New fields in `MenuListEntry`
|
||||
shortcutRequiresLock: entry.shortcut ? shortcutRequiresLock(entry.shortcut.keys) : undefined,
|
||||
value: undefined,
|
||||
disabled: undefined,
|
||||
disabled: entry.disabled ?? undefined,
|
||||
font: undefined,
|
||||
ref: undefined,
|
||||
});
|
||||
|
|
|
@ -774,6 +774,7 @@ type MenuEntryCommon = {
|
|||
export type MenuBarEntry = MenuEntryCommon & {
|
||||
action: Widget;
|
||||
children?: MenuBarEntry[][];
|
||||
disabled?: boolean,
|
||||
};
|
||||
|
||||
// An entry in the all-encompassing MenuList component which defines all types of menus ranging from `MenuBarInput` to `DropdownInput` widgets
|
||||
|
@ -1300,6 +1301,7 @@ function createMenuLayoutRecursive(children: any[][]): MenuBarEntry[][] {
|
|||
...entry,
|
||||
action: hoistWidgetHolders([entry.action])[0],
|
||||
children: entry.children ? createMenuLayoutRecursive(entry.children) : undefined,
|
||||
disabled: entry.disabled ?? false,
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue