Expose PWA maximise on ribbon and reclaim canvas height

This commit is contained in:
Nick Beckley 2026-10-31 21:17:18 +00:00
parent fed3224f0d
commit 9294ee89d6
6 changed files with 28 additions and 6 deletions

View File

@ -51,3 +51,7 @@ Only in standalone mode, accounted contributions suppress the entire secondary t
Workspace commands explicitly select distinct icons from the existing SVG icon catalogue, including new diagram/navigation glyphs where no suitable icon existed. Layout and Display summaries declare their own icons rather than inheriting the first child command's icon. The shared form renderer also honours an explicitly declared field icon.
Display contains the original Book, Chapter, Scene and Character focus selectors directly, with simple stacked labels, network visibility and Update Map. The PWA uses an opt-in `data-pwa-fields="stacked"` presentation of the same source form: native select lists remain dropdowns even with hundreds of scenes, avoiding nested popup pickers. Browser presentation matches the earlier stacked panel. The intermediate Story point dialog has been removed. The colour key remains fixed below the right rail; neither Display presentation uses a scroll container. Browser tests verify selector visibility, binding to source fields, actual GET submission of book/chapter/scene, and non-scrolling desktop/mobile panels.
## PWA maximise correction
Maximise contributes a separate essential Workspace ribbon group, outside Display, so the command does not collapse into a dropdown. Browser placement is unchanged. The old PWA maximised bounds matched the already full-height normal workspace, making the state toggle appear ineffective. Maximising now temporarily hides the title and ribbon-heading rows while preserving the command row, allowing the existing header ResizeObserver to give the reclaimed height to the canvas. The same canonical class, Restore action and Escape handler restore the normal view; no native fullscreen or saved ribbon preference is involved. Browser tests assert direct command placement and a measurable canvas-height increase, as well as Restore and Escape.

View File

@ -27,7 +27,7 @@ const base='http://127.0.0.1:5238';
assert(await shell.locator('[data-help-open]').count(),'Help uses ribbon help');
assert.equal(await shell.locator('.relationship-map-legend-grid').count(),0,'legend removed from ribbon');
assert(await app.locator('.rw-rail .rw-colour-key').isVisible(),'colour key at bottom of right panel');
await command('Maximise workspace');
await shell.locator('.pd-context-group[aria-label="Display"] > details > summary').click();
const display=shell.locator('.pd-context-group[aria-label="Display"] > details > .pd-context-menu-content');
for (const label of ['Book','Chapter','Scene','Character focus']) assert(await display.getByLabel(label,{exact:true}).isVisible(), 'direct stacked selector '+label);
assert.equal(await display.locator('.pd-context-selector').count(),0,'ordinary select lists, no nested picker menus');
@ -42,7 +42,7 @@ const base='http://127.0.0.1:5238';
assert(await web.locator('.rw-display > .rw-menu-panel').evaluate(e=>e.scrollHeight<=e.clientHeight+1),'browser Display does not scroll');
const iconPaths=await shell.locator('button.pd-context-command').evaluateAll(nodes=>nodes.map(n=>n.querySelector('svg path')?.getAttribute('d')));
assert(iconPaths.every(Boolean),'every command has a relevant icon'); assert.equal(new Set(iconPaths).size,iconPaths.length,'command icons are distinct');
await command('Maximise workspace');
if (!(await display.locator('..').evaluate(e=>e.open))) await display.locator('..').locator(':scope > summary').click();
assert(await display.evaluate(e=>e.scrollHeight<=e.clientHeight+1 && e.scrollWidth<=e.clientWidth+1),'Display has no scrolling');
assert(await (await command('Update Map')).isVisible()); assert(await (await command('Maximise workspace')).isVisible());
const geometry=await app.locator('#rwApp').evaluate(e=>({top:e.getBoundingClientRect().top,board:document.getElementById('rwBoard').getBoundingClientRect().top,rows:getComputedStyle(e).gridTemplateRows.split(' ').length}));
@ -59,12 +59,25 @@ const base='http://127.0.0.1:5238';
await app.evaluate(()=>{window.__layouts=0;window.PlotDirectorRelationshipWorkspace.cy.on('layoutstop',()=>window.__layouts++);});
await (await command('Auto-arrange')).click();assert(await app.evaluate(()=>window.__layouts>0),'original auto-arrange handler');
await (await command('Characters')).click();assert(await app.locator('#rwBoard').evaluate(e=>e.classList.contains('palettes-hidden')));await (await command('Characters')).click();
await (await command('Maximise workspace')).click();assert(await app.locator('#rwApp').evaluate(e=>e.classList.contains('rw-maximised')));
const maximise=await command('Maximise workspace');
assert.equal(await maximise.locator('xpath=ancestor::details[@data-compact="true"]').count(),0,'Maximise is directly on ribbon, not in a dropdown');
assert.equal(await display.getByRole('button',{name:'Maximise workspace',exact:true}).count(),0);
const beforeMax=await app.locator('#relationshipMapGraph').boundingBox();
await maximise.click();assert(await app.locator('#rwApp').evaluate(e=>e.classList.contains('rw-maximised')));
await app.waitForFunction(()=>getComputedStyle(document.querySelector('.pd-titlebar')).display==='none');
await app.waitForFunction(height=>document.getElementById('relationshipMapGraph').getBoundingClientRect().height>height+30,beforeMax.height);
const afterMax=await app.locator('#relationshipMapGraph').boundingBox();
assert(afterMax.height>beforeMax.height+30,'PWA maximise measurably increases canvas height');
assert(await shell.isVisible(),'ribbon remains reachable while maximised');
await (await command('Restore workspace')).click();assert(!(await app.locator('#rwApp').evaluate(e=>e.classList.contains('rw-maximised'))));
await app.waitForFunction(()=>getComputedStyle(document.querySelector('.pd-titlebar')).display!=='none');
await (await command('Maximise workspace')).click();await app.keyboard.press('Escape');
assert(!(await app.locator('#rwApp').evaluate(e=>e.classList.contains('rw-maximised'))),'Escape restores PWA workspace');
await app.setViewportSize({width:390,height:900});await (await command('Characters')).click();assert(await app.locator('.rw-navigation').isVisible(),'mobile cast opens via existing ribbon overflow');
assert(await app.locator('.rw-toolbar').isHidden());
await command('Maximise workspace');
assert.equal(await (await command('Maximise workspace')).locator('xpath=ancestor::details[@data-compact="true"]').count(),0,'mobile Maximise stays on the ribbon');
if (!(await display.locator('..').evaluate(e=>e.open))) await display.locator('..').locator(':scope > summary').click();
assert(await display.evaluate(e=>e.scrollHeight<=e.clientHeight+1 && e.scrollWidth<=e.clientWidth+1),'mobile Display has no scrolling');
await app.route('**/RelationshipMap?**', route=>route.fulfill({contentType:'text/html',body:'Submitted fixture'}));
const submitted=app.waitForRequest(request=>new URL(request.url()).pathname==='/RelationshipMap');

View File

@ -33,7 +33,7 @@ For keyboard and touch editing, choose **Add relationship**, then select source
The **Relationship Timeline** shows the state after all changes up to the selected scene. Dots identify scenes with changes, and the selected scene is shown beside the timeline heading. **Initial** and **End** jump to the boundaries. Use the slider's arrow keys or **Previous change / Next change** to navigate without displaying hundreds of labels. **End** shows the state at the final scene. The current point supplies the editor's default scene.
Drag empty canvas to pan. Use **+ / −**, Ctrl/Cmd-wheel, or a two-finger pinch to zoom. The vertical canvas toolbar contains select, pan, fit, zoom and centre controls. **Auto-arrange** recalculates positions. **Layout → Reset layout** restores removed map characters and rearranges locally. **Layout → Remove focused from map** hides a node locally and does not delete the character or relationship. The maximise control expands the workspace within the application; click it again or press Escape to restore.
Drag empty canvas to pan. Use **+ / −**, Ctrl/Cmd-wheel, or a two-finger pinch to zoom. The vertical canvas toolbar contains select, pan, fit, zoom and centre controls. **Auto-arrange** recalculates positions. **Layout → Reset layout** restores removed map characters and rearranges locally. **Layout → Remove focused from map** hides a node locally and does not delete the character or relationship. The maximise control expands the workspace within the application; click it again or press Escape to restore. In the PWA it sits directly on the ribbon and temporarily hides the title and category-tab rows to give the canvas more height, while keeping the command row and Restore button available.
Installed PWA users can right-click palette characters, map characters, connections or canvas to access the existing application command menu. The same actions are available through buttons, with no right-click required. Select a connection to inspect its history or edit it at the timeline point. **Map / List** switches between workspace views of the same relationship state. The right rail switches between Supporting characters and contextual Details. Focusing a character shows their relationship count, connections, editing actions and history; selecting a connection shows its current state, notes and history.

View File

@ -59,7 +59,7 @@
</form>
</div></details>
<button type="button" data-pwa-context="Display" data-pwa-compact="true" id="rwMaximise" data-ribbon-icon="maximise" class="btn btn-outline-secondary btn-sm" aria-label="Maximise workspace" aria-pressed="false" title="Maximise workspace">⛶</button>
<button type="button" data-pwa-context="Workspace" data-pwa-essential="true" id="rwMaximise" data-ribbon-icon="maximise" class="btn btn-outline-secondary btn-sm" aria-label="Maximise workspace" aria-pressed="false" title="Maximise workspace">⛶</button>
</div>
</header>

View File

@ -153,3 +153,7 @@ body.rw-page [data-pwa-context-controls] .pd-context-form[data-pwa-fields="stack
body.rw-page [data-pwa-context-controls] .pd-context-form[data-pwa-fields="stacked"] .pd-context-select { width: 100%; max-width: none; height: 28px; }
body.rw-page [data-pwa-context-controls] .pd-context-form[data-pwa-fields="stacked"] .pd-context-field:has(input[type="checkbox"]) { flex-direction: row; align-items: center; padding: 4px 0; }
body.rw-page [data-pwa-context-controls] .pd-context-form[data-pwa-fields="stacked"] .pd-context-submit { flex-direction: row; justify-content: flex-start; gap: 8px; min-height: 32px; }
/* Maximise gains real canvas height while retaining the ribbon's Restore action. */
html[data-standalone="true"] body.rw-page:has(#rwApp.rw-maximised) .pd-application-header .pd-titlebar,
html[data-standalone="true"] body.rw-page:has(#rwApp.rw-maximised) .pd-application-header .pd-ribbon-heading { display: none; }

View File

@ -347,6 +347,7 @@
for (const region of contributions) {
if (region.parentElement?.closest('[data-pwa-header], [data-pwa-context]')) continue;
const label = region.dataset.pwaContext || region.dataset.pwaTools || 'Page tools';
if (region.dataset.pwaEssential === 'true') group(label).element.parentElement.dataset.essential = 'true';
if (region.dataset.pwaMenuIcon) group(label, 50, region.dataset.pwaCompact === 'true').icon = region.dataset.pwaMenuIcon;
if (region.matches('[data-pwa-help]')) { helpSource ||= region.querySelector(region.matches('h1') ? '[data-help-icon]' : 'h1 [data-help-icon]'); continue; }
const commands = region.matches('a, button') ? [region] : region.matches('[data-pwa-context]') ? [...region.querySelectorAll('a, button')] : [...region.querySelectorAll('a.btn, a.dropdown-item, button.btn, button.dropdown-item')];