diff --git a/PlotLine.Tests/Browser/relationship-main-scope.cjs b/PlotLine.Tests/Browser/relationship-main-scope.cjs index be9c2d37..f88e038d 100644 --- a/PlotLine.Tests/Browser/relationship-main-scope.cjs +++ b/PlotLine.Tests/Browser/relationship-main-scope.cjs @@ -192,6 +192,25 @@ const { chromium } = require("playwright"), ); await p.locator("#rwEmptyFull").click(); await ready(); + assert( + await p.evaluate(() => { + const nodes = PlotDirectorRelationshipWorkspace.cy.nodes(":visible"), + bs = nodes.map((n) => n.boundingBox({ includeOverlays: false })); + return ( + nodes.length === 20 && + bs.every((a, i) => + bs + .slice(i + 1) + .every( + (b) => + Math.min(a.x2, b.x2) <= Math.max(a.x1, b.x1) || + Math.min(a.y2, b.y2) <= Math.max(a.y1, b.y1), + ), + ) + ); + }), + "Full cast from an empty view places each new member separately before any automatic arrangement", + ); await p.locator('.rw-menu[data-pwa-context="Layout"] > summary').click(); await p.locator("#rwLayout").selectOption("radial"); await p.locator("#rwCentreDialog[open]").waitFor(); diff --git a/PlotLine/wwwroot/js/relationship-main.js b/PlotLine/wwwroot/js/relationship-main.js index 1d843cdb..53fded99 100644 --- a/PlotLine/wwwroot/js/relationship-main.js +++ b/PlotLine/wwwroot/js/relationship-main.js @@ -323,8 +323,14 @@ } function freePosition(id, preferred) { const c = castById.get(id), - other = visible() - .filter((n) => n.data("characterID") !== id) + other = cy + .nodes() + .filter( + (n) => + n.data("characterID") !== id && + members.has(n.data("characterID")) && + positions.has(n.data("characterID")), + ) .map((n) => ({ id: n.data("characterID"), w: n.outerWidth(),