@quolu/lattice 0.12.32 → 0.12.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/todo-gantt-layout.mjs +15 -6
package/package.json
CHANGED
|
@@ -416,9 +416,15 @@ export function layoutTodoGantt(readModel, chainProjection, options = {}) {
|
|
|
416
416
|
const layers = orderLayers(nodes, wave, incoming, outgoing);
|
|
417
417
|
// A ToDo with no registered dependency has nothing to line up with. Laying
|
|
418
418
|
// every one of them out in a single row makes the canvas as wide as the plan
|
|
419
|
-
// is old — real stores have hundreds — so they wrap into a block
|
|
420
|
-
//
|
|
421
|
-
//
|
|
419
|
+
// is old — real stores have hundreds — so they wrap into a block of rows.
|
|
420
|
+
//
|
|
421
|
+
// That block goes ABOVE the wired ToDos of its stage. Below them it used to be
|
|
422
|
+
// pierced: a wired card's port descends from its own bottom edge to the routing
|
|
423
|
+
// band under the whole stage, straight through whatever independent card had
|
|
424
|
+
// wrapped into the same column, and the hidden half of that line read as a
|
|
425
|
+
// dependency the plan does not have. Independent ToDos carry no edge, so they
|
|
426
|
+
// have no incoming one either and always land in stage 0, which nothing ever
|
|
427
|
+
// arrives into — putting them on top leaves no line to cross them.
|
|
422
428
|
const wired = new Set();
|
|
423
429
|
for (const edge of edges) { wired.add(edge.from); wired.add(edge.to); }
|
|
424
430
|
const transversePosition = new Map();
|
|
@@ -427,12 +433,15 @@ export function layoutTodoGantt(readModel, chainProjection, options = {}) {
|
|
|
427
433
|
for (const layer of layers) {
|
|
428
434
|
const connected = layer.filter((key) => wired.has(key));
|
|
429
435
|
const loose = layer.filter((key) => !wired.has(key));
|
|
430
|
-
connected.forEach((key, index) => { transversePosition.set(key, index); stageRow.set(key, 0); });
|
|
431
436
|
const columns = Math.max(LOOSE_COLUMNS_MINIMUM, connected.length);
|
|
432
|
-
const
|
|
437
|
+
const looseRows = loose.length === 0 ? 0 : Math.ceil(loose.length / columns);
|
|
433
438
|
loose.forEach((key, index) => {
|
|
434
439
|
transversePosition.set(key, index % columns);
|
|
435
|
-
stageRow.set(key,
|
|
440
|
+
stageRow.set(key, Math.floor(index / columns));
|
|
441
|
+
});
|
|
442
|
+
connected.forEach((key, index) => {
|
|
443
|
+
transversePosition.set(key, index);
|
|
444
|
+
stageRow.set(key, looseRows);
|
|
436
445
|
});
|
|
437
446
|
stageRowCount.push(Math.max(0, ...layer.map((key) => stageRow.get(key))) + 1);
|
|
438
447
|
}
|