Skip to content

Commit 15c8fd8

Browse files
committed
Require a usable local card before preserving a scoped crop
1 parent 12b65d2 commit 15c8fd8

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

‎autoform_cli/assets/blueprint-dag.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,10 +1289,10 @@
12891289
if (anchor || !data._scopeOverview) center(anchor || nodes[0], readableFloor);
12901290
else {
12911291
var free = freeArea(), start = (free.top || 0) + 12, end = (free.top || 0) + free.band - 12;
1292-
var usable = nodes.some(function (node) { var box = screen(node);
1292+
var usable = nodes.some(function (node) { if (node.kind === "boundary") return false; var box = screen(node);
12931293
return box.x >= free.left + 12 && box.x + box.w <= free.right - 12 && box.y >= start && box.y + box.h <= end;
12941294
});
1295-
// Keep useful padded coverage; a first external boundary is not an
1295+
// Keep useful local coverage; a first external boundary is not an
12961296
// instruction to push the mathematical overview off the viewport.
12971297
if (!usable) center(nodes.find(function (node) { return node._overviewGroup; }) ||
12981298
nodes.find(function (node) { return node.kind !== "boundary"; }) || nodes[0], readableFloor);

‎autoform_cli/assets/blueprint-explorer.min.js‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tests/test_integrated_phone_tabstop.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,14 @@ def test_scoped_crop_without_any_usable_card_falls_back_to_a_local_group_not_bou
183183
const box=screen(data.nodes[1]);assert(Math.abs(box.x+box.w/2-dom$stage.clientWidth/2)<1e-8);
184184
assert(!usable(data.nodes[0]),'The first boundary must not displace the fallback group');
185185
""")
186+
187+
188+
def test_scoped_crop_with_only_a_usable_boundary_still_frames_a_local_group() -> None:
189+
_run(_SCOPED_CROP + r"""
190+
dom$stage={clientWidth:390,clientHeight:560};data.nodes=data.nodes.slice(0,2);ui$active=data.nodes;
191+
const boxes=new Map([[data.nodes[0].id,{x:0,y:0,w:196,h:100}],
192+
[data.nodes[1].id,{x:1000,y:1000,w:264,h:148}]]);
193+
world=node=>boxes.get(node.id);fit();assert(ui$readableCrop);
194+
assert(usable(data.nodes[1]),'A fully contained external boundary is not a usable local overview');
195+
const box=screen(data.nodes[1]);assert(Math.abs(box.x+box.w/2-dom$stage.clientWidth/2)<1e-8);
196+
""")

0 commit comments

Comments
 (0)