Pick a new asset from category submenus in the + menu
The + menu was one long list in two groups, placeable types and library ones. That split is no longer wanted. The menu now lists the categories of the asset panel, and each opens its types beside it, so a new asset is filed where the panel shows it. - Menu learns submenus: an entry with submenu instead of onSelect opens a second Menu right of the first, or left of it where the canvas ends. Its first entry lines up with the row that opened it. - A submenu opens on hover or click. Resting on another entry swaps or closes it after 150 ms, so a pointer cutting across the rows on its way into a submenu does not lose it. - The row of an open submenu stays lit, and a triangle pointing right marks every such row. - A submenu has no backdrop and no Escape of its own. Popup takes a backdrop option for that. The first menu's backdrop and Escape close the whole stack, and picking an entry does the same. - assetMenuCategories replaces assetMenuGroups and takes categories and their order from ASSET_GROUPS. The types are sorted by label. - New test hooks __gm.menuSubmenus() and __gm.addMenuCategory(). pickAssetType opens the category first, so the modules that pick a type through it need no change of their own. Modules 04, 10, 47, 48, 53 and 54 open the category themselves where they read the menu. Tests: - Unit asset-menu: 4 green - e2e 04: ALL PASSED, 63 checks. New: categories in panel order, each type once and sorted, submenu placement, hover swaps the submenu, picking closes menu and submenu - Gate: CHECK EXIT 0, 261 files, 4040 tests - The other modules that use the + menu did not run here Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5e09ba9a50
commit
a848cf8469
16 files changed
+320
-131
No files matched your search
@@ -202,12 +202,15 @@ export async function clickDocumentTab(t, doc) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Picks an asset type from the already-open `+` menu. Since #43 the menu may grow to the height of
|
||||
* the canvas, and since the Instrument (#331) its last entries can sit below the fold of this
|
||||
* window (`Texture` in step 12). `locate` refuses a row scrolled out of its list, so the first look is `find`,
|
||||
* and a hit outside the menu (the centre tab "Texture") counts as a miss.
|
||||
* Picks an asset type from the already-open `+` menu: first its category, which opens the types of
|
||||
* that category beside the menu, then the type in there. A submenu could still outgrow a short
|
||||
* window, and `locate` refuses a row scrolled out of its list, so the first look is `find`, and a
|
||||
* hit outside the submenu (the centre tab "Texture") counts as a miss.
|
||||
*/
|
||||
export async function pickAssetType(t, label) {
|
||||
const category = await t.json(`__gm.addMenuCategory(${JSON.stringify(label)})`);
|
||||
if (!category) throw new Error(`no category of the + menu holds "${label}"`);
|
||||
await t.clickText(category);
|
||||
const box = await t.json('__gm.overlayRect()');
|
||||
let p = await t.find(label, true);
|
||||
let scrolled = false;
|
||||
|
||||
Reference in new issue
Block a user