@jbrowse/bandage-core 12.2.0 → 12.3.0
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/dist/bubbles/bubbleHalos.js +4 -4
- package/dist/bubbles/classifyBubble.js +3 -3
- package/dist/bubbles/superbubbles.js +5 -5
- package/dist/chunks/{chunk-7ZYQWUKD.js → chunk-43WVY2IG.js} +2 -2
- package/dist/chunks/{chunk-32X5SLOA.js → chunk-4MLSSW7H.js} +1 -1
- package/dist/chunks/{chunk-6BAMNWKI.js → chunk-72HYCU7V.js} +7 -2
- package/dist/chunks/{chunk-ACGRXI3X.js → chunk-BPCN2ABL.js} +1 -1
- package/dist/chunks/{chunk-G5LTLUVY.js → chunk-CCGLH4YP.js} +1 -1
- package/dist/chunks/{chunk-X3JNDRHT.js → chunk-CCZ7MGDQ.js} +2 -2
- package/dist/chunks/{chunk-GH6CJHBT.js → chunk-DG7MTZUT.js} +1 -1
- package/dist/chunks/{chunk-TXPRDEHX.js → chunk-EBWNXGPB.js} +1 -1
- package/dist/chunks/{chunk-FP2E5O4Q.js → chunk-FDO4NIPB.js} +12 -9
- package/dist/chunks/chunk-FGH4D6WT.js +35 -0
- package/dist/chunks/{chunk-DFN3KYYI.js → chunk-H5N3HE53.js} +1 -1
- package/dist/chunks/{chunk-JLQQPOBH.js → chunk-HYEZB573.js} +7 -4
- package/dist/chunks/{chunk-YT4DSIJQ.js → chunk-JJB3ONOY.js} +2 -2
- package/dist/chunks/{chunk-AGNOG54P.js → chunk-JT3PGUMA.js} +5 -1
- package/dist/chunks/{chunk-MLFMBFPB.js → chunk-K3U24X26.js} +1 -1
- package/dist/chunks/{chunk-WAJEI2TC.js → chunk-M67AFQ5W.js} +1 -1
- package/dist/chunks/{chunk-F7QWNJKL.js → chunk-MJ7ADOYX.js} +1 -1
- package/dist/chunks/{chunk-BUDUL6NW.js → chunk-O6T5LV3G.js} +1 -1
- package/dist/chunks/{chunk-D2RKPEQV.js → chunk-OPTHW6IZ.js} +1 -1
- package/dist/chunks/{chunk-CNWT3WQE.js → chunk-P4SVOOO6.js} +1 -1
- package/dist/chunks/{chunk-VVDGZMAD.js → chunk-RZEEABRP.js} +6 -6
- package/dist/chunks/{chunk-AB35TJST.js → chunk-S43IBA5Y.js} +14 -7
- package/dist/chunks/{chunk-RLLKCNGS.js → chunk-T6EWT5ET.js} +2 -2
- package/dist/chunks/{chunk-IWBPJI5X.js → chunk-T7KUCB3Y.js} +32 -26
- package/dist/chunks/{chunk-KLGWUY7Y.js → chunk-U6ILKBCW.js} +1 -1
- package/dist/chunks/{chunk-QZ6SK6PQ.js → chunk-UO5RFWLA.js} +1 -1
- package/dist/chunks/{chunk-RCIKILGF.js → chunk-XDTIBSTI.js} +1 -1
- package/dist/chunks/{chunk-YA3VYQH4.js → chunk-XF2NS52W.js} +1 -1
- package/dist/chunks/{chunk-K7FITUJ5.js → chunk-ZAKP7T6S.js} +1 -1
- package/dist/chunks/{chunk-HI5GLE7C.js → chunk-ZULVAGVE.js} +1 -1
- package/dist/cli/figure.js +20 -19
- package/dist/cli/fold.js +2 -1
- package/dist/figure.js +17 -16
- package/dist/figureData.js +16 -15
- package/dist/figureScene.js +11 -10
- package/dist/figureSettings.js +3 -2
- package/dist/graphLabels.js +2 -2
- package/dist/index.js +36 -33
- package/dist/labelLayout.js +5 -3
- package/dist/layout/forceCache.js +3 -2
- package/dist/layout/strayHandles.js +6 -0
- package/dist/layout/tubeMapLayout.js +4 -4
- package/dist/layout/walkRowDraw.js +5 -5
- package/dist/layout/walkStrip.js +6 -6
- package/dist/layoutModes.js +6 -5
- package/dist/overlayLabels.js +1 -1
- package/dist/pathColors.js +3 -3
- package/dist/pipeline.js +2 -1
- package/dist/referenceStrip.js +5 -5
- package/dist/renderer/GeometryBuilder.js +4 -4
- package/dist/tubeMap/axis.js +3 -3
- package/dist/tubeMap/bundle.js +5 -5
- package/dist/tubeMap/coarsen.js +5 -5
- package/dist/tubeMap/deviations.js +6 -6
- package/dist/tubeMap/genes.js +4 -4
- package/dist/tubeMap/nodeColors.js +5 -5
- package/dist/types/index.d.ts +1 -1
- package/dist/types/labelLayout.d.ts +7 -0
- package/dist/types/layout/strayHandles.d.ts +10 -0
- package/dist/types/layoutModes.d.ts +18 -9
- package/dist/types/overlayLabels.d.ts +1 -0
- package/dist/types/pipeline.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/viewport.js +3 -2
- package/dist/walkEncoding.js +5 -5
- package/dist/walkHighlight.js +6 -6
- package/dist/walkKey.js +3 -3
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bubbleHalos,
|
|
3
3
|
coversGraph
|
|
4
|
-
} from "../chunks/chunk-
|
|
5
|
-
import "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-MJ7ADOYX.js";
|
|
5
|
+
import "../chunks/chunk-U6ILKBCW.js";
|
|
6
6
|
import "../chunks/chunk-FX4RDMDN.js";
|
|
7
|
-
import "../chunks/chunk-
|
|
7
|
+
import "../chunks/chunk-OPTHW6IZ.js";
|
|
8
8
|
import "../chunks/chunk-HMXCN6PG.js";
|
|
9
|
-
import "../chunks/chunk-
|
|
9
|
+
import "../chunks/chunk-S43IBA5Y.js";
|
|
10
10
|
import "../chunks/chunk-HNNP5QUN.js";
|
|
11
11
|
import "../chunks/chunk-ALGYCMMH.js";
|
|
12
12
|
import "../chunks/chunk-H4UHV22B.js";
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
BUBBLE_KIND_NAMES,
|
|
4
4
|
bubbleSegmentIds,
|
|
5
5
|
classifyBubble
|
|
6
|
-
} from "../chunks/chunk-
|
|
6
|
+
} from "../chunks/chunk-U6ILKBCW.js";
|
|
7
7
|
import "../chunks/chunk-FX4RDMDN.js";
|
|
8
|
-
import "../chunks/chunk-
|
|
8
|
+
import "../chunks/chunk-OPTHW6IZ.js";
|
|
9
9
|
import "../chunks/chunk-HMXCN6PG.js";
|
|
10
|
-
import "../chunks/chunk-
|
|
10
|
+
import "../chunks/chunk-S43IBA5Y.js";
|
|
11
11
|
import "../chunks/chunk-HNNP5QUN.js";
|
|
12
12
|
import "../chunks/chunk-ALGYCMMH.js";
|
|
13
13
|
import "../chunks/chunk-H4UHV22B.js";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
graphBubbles,
|
|
3
3
|
superbubblesFromGraph
|
|
4
|
-
} from "../chunks/chunk-
|
|
5
|
-
import "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-T6EWT5ET.js";
|
|
5
|
+
import "../chunks/chunk-MJ7ADOYX.js";
|
|
6
6
|
import "../chunks/chunk-V6WSDZPL.js";
|
|
7
|
-
import "../chunks/chunk-
|
|
7
|
+
import "../chunks/chunk-U6ILKBCW.js";
|
|
8
8
|
import "../chunks/chunk-FX4RDMDN.js";
|
|
9
9
|
import "../chunks/chunk-RV6YKJA3.js";
|
|
10
10
|
import "../chunks/chunk-Q7OFBTBW.js";
|
|
11
11
|
import "../chunks/chunk-L4DBSRA2.js";
|
|
12
|
-
import "../chunks/chunk-
|
|
12
|
+
import "../chunks/chunk-OPTHW6IZ.js";
|
|
13
13
|
import "../chunks/chunk-HMXCN6PG.js";
|
|
14
|
-
import "../chunks/chunk-
|
|
14
|
+
import "../chunks/chunk-S43IBA5Y.js";
|
|
15
15
|
import "../chunks/chunk-HNNP5QUN.js";
|
|
16
16
|
import "../chunks/chunk-ALGYCMMH.js";
|
|
17
17
|
import "../chunks/chunk-H4UHV22B.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
REFERENCE_RAMP_ALT_CSS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XF2NS52W.js";
|
|
4
4
|
import {
|
|
5
5
|
RAMP_GRADIENT_CSS,
|
|
6
6
|
RAMP_GRADIENT_STOPS,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-VA5U4F23.js";
|
|
14
14
|
import {
|
|
15
15
|
LABEL_CHAR_PX
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-S43IBA5Y.js";
|
|
17
17
|
import {
|
|
18
18
|
ROW_HEIGHT_PX
|
|
19
19
|
} from "./chunk-CPMHA4W5.js";
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
graphLabels,
|
|
6
6
|
rowLabelBox
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-OPTHW6IZ.js";
|
|
8
8
|
import {
|
|
9
9
|
LABEL_CHAR_PX,
|
|
10
10
|
LABEL_PAD,
|
|
11
11
|
LABEL_PX,
|
|
12
12
|
occupancy,
|
|
13
13
|
placeLabels
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-S43IBA5Y.js";
|
|
15
15
|
|
|
16
16
|
// src/labelLayout.ts
|
|
17
17
|
var HALO_FACTOR = 3.4;
|
|
@@ -38,6 +38,7 @@ function geneLabelCandidates(pins, screen, contigThickness, nodesUnder) {
|
|
|
38
38
|
item: pin,
|
|
39
39
|
x,
|
|
40
40
|
y: y + contigThickness + GENE_PIN_DROP_PX,
|
|
41
|
+
flipY: y - contigThickness - GENE_PIN_DROP_PX + LABEL_PX,
|
|
41
42
|
text: note ? `${pin.gene.name} \xB7 ${note}` : pin.gene.name,
|
|
42
43
|
fallback: note ? `${pin.gene.name} \u2026` : void 0,
|
|
43
44
|
stack: GENE_STACK,
|
|
@@ -52,6 +53,9 @@ function geneLabelCandidates(pins, screen, contigThickness, nodesUnder) {
|
|
|
52
53
|
};
|
|
53
54
|
});
|
|
54
55
|
}
|
|
56
|
+
function geneLeader(label, pinY, contigThickness) {
|
|
57
|
+
return label.y > pinY ? { y1: label.y - LABEL_PX - 2, y2: pinY + contigThickness / 2 } : { y1: label.y + LABEL_PAD, y2: pinY - contigThickness / 2 };
|
|
58
|
+
}
|
|
55
59
|
function byExtent(items, extent) {
|
|
56
60
|
return [...items].sort((a, b) => extent(b) - extent(a));
|
|
57
61
|
}
|
|
@@ -157,5 +161,6 @@ export {
|
|
|
157
161
|
LEGEND_INSET_PX,
|
|
158
162
|
geneCoverageNote,
|
|
159
163
|
geneLabelCandidates,
|
|
164
|
+
geneLeader,
|
|
160
165
|
layoutLabels
|
|
161
166
|
};
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
boxesGenes,
|
|
4
4
|
rowPitch,
|
|
5
5
|
rowSpan
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-43WVY2IG.js";
|
|
7
7
|
import {
|
|
8
8
|
READOUT_ROOM,
|
|
9
9
|
longestBar
|
|
10
10
|
} from "./chunk-2GO2AG7A.js";
|
|
11
11
|
import {
|
|
12
12
|
LABEL_CHAR_PX
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-S43IBA5Y.js";
|
|
14
14
|
import {
|
|
15
15
|
pathOrigin
|
|
16
16
|
} from "./chunk-BRH73RCH.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-CO6RGQAD.js";
|
|
4
4
|
import {
|
|
5
5
|
layoutModeByValue
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HYEZB573.js";
|
|
7
7
|
import {
|
|
8
8
|
parseRegion
|
|
9
9
|
} from "./chunk-BGEAXWE7.js";
|
|
@@ -12,19 +12,19 @@ import {
|
|
|
12
12
|
} from "./chunk-HEYIAMTC.js";
|
|
13
13
|
import {
|
|
14
14
|
version
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-DG7MTZUT.js";
|
|
16
16
|
import {
|
|
17
17
|
axisScaleOf
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-UO5RFWLA.js";
|
|
19
19
|
import {
|
|
20
20
|
figureScene
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-RZEEABRP.js";
|
|
22
22
|
import {
|
|
23
23
|
fadedKey
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-JJB3ONOY.js";
|
|
25
25
|
import {
|
|
26
26
|
encodingStops
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-BPCN2ABL.js";
|
|
28
28
|
import {
|
|
29
29
|
laneSlideAt,
|
|
30
30
|
passesKey,
|
|
@@ -44,17 +44,18 @@ import {
|
|
|
44
44
|
} from "./chunk-XWH4LB56.js";
|
|
45
45
|
import {
|
|
46
46
|
FIGURE_DEFAULTS
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-CCGLH4YP.js";
|
|
48
48
|
import {
|
|
49
49
|
engineSettingsOf,
|
|
50
50
|
fitTransform,
|
|
51
51
|
forceLayout,
|
|
52
52
|
loadGraph
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-JT3PGUMA.js";
|
|
54
54
|
import {
|
|
55
55
|
referencePositions
|
|
56
56
|
} from "./chunk-L4DBSRA2.js";
|
|
57
57
|
import {
|
|
58
|
+
dashedDeletions,
|
|
58
59
|
deletionKey
|
|
59
60
|
} from "./chunk-ALGYCMMH.js";
|
|
60
61
|
import {
|
|
@@ -331,7 +332,9 @@ function figureData(graph, layout, o = {}) {
|
|
|
331
332
|
end: referenceRamp.start + referenceRamp.span
|
|
332
333
|
} : null,
|
|
333
334
|
deletions: drawnDeletions.shown.length,
|
|
334
|
-
deletionKey:
|
|
335
|
+
deletionKey: panels.some(
|
|
336
|
+
(p) => dashedDeletions(drawnDeletions.shown, p.highlight).length > 0
|
|
337
|
+
) ? deletionKey(referenceName) : null,
|
|
335
338
|
// what the key for the drawing a lift fades says
|
|
336
339
|
fadedKey: lift ? fadedKey(
|
|
337
340
|
graph,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/layout/strayHandles.ts
|
|
2
|
+
function withoutStrayHandles(graph) {
|
|
3
|
+
const paths = graph.paths ?? [];
|
|
4
|
+
const linked = /* @__PURE__ */ new Set();
|
|
5
|
+
const stray = /* @__PURE__ */ new Set();
|
|
6
|
+
if (paths.some((path) => path.abridged)) {
|
|
7
|
+
for (const { from, to } of graph.edges) {
|
|
8
|
+
linked.add(from);
|
|
9
|
+
linked.add(to);
|
|
10
|
+
}
|
|
11
|
+
for (const path of paths) {
|
|
12
|
+
if (path.abridged) {
|
|
13
|
+
for (const id of path.nodeIds) {
|
|
14
|
+
if (!linked.has(id)) {
|
|
15
|
+
stray.add(id);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (stray.size > 0) {
|
|
22
|
+
for (const path of paths) {
|
|
23
|
+
if (!path.abridged) {
|
|
24
|
+
for (const id of path.nodeIds) {
|
|
25
|
+
stray.delete(id);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return stray.size === 0 ? graph : { ...graph, nodes: graph.nodes.filter((node) => !stray.has(node.id)) };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
withoutStrayHandles
|
|
35
|
+
};
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
hasTubeMapPaths,
|
|
7
7
|
tubeMapLayout,
|
|
8
8
|
tubeMapReferenceLayout
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-K3U24X26.js";
|
|
10
10
|
import {
|
|
11
11
|
anchoredLayout
|
|
12
12
|
} from "./chunk-CNWAVRLF.js";
|
|
@@ -16,6 +16,9 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
walkRowLayout
|
|
18
18
|
} from "./chunk-2GO2AG7A.js";
|
|
19
|
+
import {
|
|
20
|
+
withoutStrayHandles
|
|
21
|
+
} from "./chunk-FGH4D6WT.js";
|
|
19
22
|
import {
|
|
20
23
|
isBackbone,
|
|
21
24
|
isOffReference
|
|
@@ -31,7 +34,7 @@ var LAYOUT_MODES = [
|
|
|
31
34
|
value: "auto",
|
|
32
35
|
label: "Anchored",
|
|
33
36
|
description: "x is reference bp, one row per stable rank. Needs rGFA tags or a reference path.",
|
|
34
|
-
run: anchoredLayout,
|
|
37
|
+
run: (graph, region) => anchoredLayout(withoutStrayHandles(graph), region),
|
|
35
38
|
cutMargins: true,
|
|
36
39
|
wholeWalks: false,
|
|
37
40
|
available: hasBackbone,
|
|
@@ -42,7 +45,7 @@ var LAYOUT_MODES = [
|
|
|
42
45
|
value: "samplerows",
|
|
43
46
|
label: "Sample rows",
|
|
44
47
|
description: "x is reference bp, one row per contributing assembly. Needs rGFA tags or a reference path.",
|
|
45
|
-
run: sampleRowLayout,
|
|
48
|
+
run: (graph, region, keepRows) => sampleRowLayout(withoutStrayHandles(graph), region, keepRows),
|
|
46
49
|
cutMargins: true,
|
|
47
50
|
wholeWalks: false,
|
|
48
51
|
available: hasAlleles,
|
|
@@ -64,7 +67,7 @@ var LAYOUT_MODES = [
|
|
|
64
67
|
value: "ordered",
|
|
65
68
|
label: "Ordered",
|
|
66
69
|
description: "x is reference order, not bp: every node gets room, bubbles read as lenses. Needs rGFA tags or a reference path.",
|
|
67
|
-
run: orderedLayout,
|
|
70
|
+
run: (graph) => orderedLayout(withoutStrayHandles(graph)),
|
|
68
71
|
cutMargins: false,
|
|
69
72
|
wholeWalks: false,
|
|
70
73
|
available: hasBackbone,
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
encodedColor,
|
|
3
3
|
resolveEncoding,
|
|
4
4
|
splitFamilies
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BPCN2ABL.js";
|
|
6
6
|
import {
|
|
7
7
|
rampFraction
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XF2NS52W.js";
|
|
9
9
|
import {
|
|
10
10
|
gapParts
|
|
11
11
|
} from "./chunk-VA5U4F23.js";
|
|
@@ -18,6 +18,9 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
parseGFA
|
|
20
20
|
} from "./chunk-CFXXFHRK.js";
|
|
21
|
+
import {
|
|
22
|
+
withoutStrayHandles
|
|
23
|
+
} from "./chunk-FGH4D6WT.js";
|
|
21
24
|
import {
|
|
22
25
|
graphFromTables
|
|
23
26
|
} from "./chunk-4FPEQQFT.js";
|
|
@@ -121,7 +124,8 @@ function engineKey(graph, settings) {
|
|
|
121
124
|
graph.referencePath ?? ""
|
|
122
125
|
].join("|");
|
|
123
126
|
}
|
|
124
|
-
async function forceLayout(
|
|
127
|
+
async function forceLayout(cut, settings, engine) {
|
|
128
|
+
const graph = withoutStrayHandles(cut);
|
|
125
129
|
const spread = spreadFor(settings.bubbleSpread);
|
|
126
130
|
const { shown: deletions, hidden: dropped } = deletionDrawing(
|
|
127
131
|
graph,
|
|
@@ -4,27 +4,27 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
facetLifts,
|
|
6
6
|
walkLift
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JJB3ONOY.js";
|
|
8
8
|
import {
|
|
9
9
|
buildGeometry,
|
|
10
10
|
computeReferenceRamp
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-XF2NS52W.js";
|
|
12
12
|
import {
|
|
13
13
|
walkKey
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XDTIBSTI.js";
|
|
15
15
|
import {
|
|
16
16
|
walkRowsExtent
|
|
17
17
|
} from "./chunk-2GO2AG7A.js";
|
|
18
18
|
import {
|
|
19
19
|
pathLegend,
|
|
20
20
|
walkLabelsOf
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-ZULVAGVE.js";
|
|
22
22
|
import {
|
|
23
23
|
FIGURE_DEFAULTS
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-CCGLH4YP.js";
|
|
25
25
|
import {
|
|
26
26
|
drawingBounds
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-JT3PGUMA.js";
|
|
28
28
|
import {
|
|
29
29
|
referenceLabel
|
|
30
30
|
} from "./chunk-5ORP7EFJ.js";
|
|
@@ -27,11 +27,11 @@ function occupancy(frame, reserved = []) {
|
|
|
27
27
|
function placeLabels(candidates, frame, take) {
|
|
28
28
|
const out = [];
|
|
29
29
|
const row = LABEL_PX + LABEL_PAD * 2;
|
|
30
|
-
const
|
|
30
|
+
const stackFrom = (c, text, from, direction) => {
|
|
31
31
|
const w = labelWidth(text);
|
|
32
|
-
|
|
32
|
+
let crowded = false;
|
|
33
33
|
for (let tries = 0; tries <= (c.stack ?? 0); tries++) {
|
|
34
|
-
const y =
|
|
34
|
+
const y = from + direction * tries * row;
|
|
35
35
|
const box = {
|
|
36
36
|
x0: c.x - w / 2,
|
|
37
37
|
x1: c.x + w / 2,
|
|
@@ -39,13 +39,20 @@ function placeLabels(candidates, frame, take) {
|
|
|
39
39
|
y1: y + LABEL_PAD
|
|
40
40
|
};
|
|
41
41
|
if (offFrame(box, frame)) {
|
|
42
|
-
|
|
42
|
+
break;
|
|
43
43
|
}
|
|
44
|
-
if (insideFrame(box, frame) && (c.fits?.(box) ?? true)
|
|
45
|
-
|
|
44
|
+
if (insideFrame(box, frame) && (c.fits?.(box) ?? true)) {
|
|
45
|
+
if (take(box)) {
|
|
46
|
+
return { placed: { ...c, text, y, w }, crowded };
|
|
47
|
+
}
|
|
48
|
+
crowded = true;
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
|
-
return void 0;
|
|
51
|
+
return { placed: void 0, crowded };
|
|
52
|
+
};
|
|
53
|
+
const place = (c, text) => {
|
|
54
|
+
const first = stackFrom(c, text, c.y, c.y > frame.height / 2 ? -1 : 1);
|
|
55
|
+
return first.placed ?? (c.flipY === void 0 || first.crowded ? void 0 : stackFrom(c, text, c.flipY, c.flipY < c.y ? -1 : 1).placed);
|
|
49
56
|
};
|
|
50
57
|
for (const c of candidates) {
|
|
51
58
|
const placed = place(c, c.text) ?? (c.fallback === void 0 ? void 0 : place(c, c.fallback));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
coversGraph
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MJ7ADOYX.js";
|
|
4
4
|
import {
|
|
5
5
|
bubblesFromGraph,
|
|
6
6
|
derivedBubble,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-V6WSDZPL.js";
|
|
11
11
|
import {
|
|
12
12
|
bubbleSegmentIds
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-U6ILKBCW.js";
|
|
14
14
|
import {
|
|
15
15
|
bubbleSubgraph
|
|
16
16
|
} from "./chunk-RV6YKJA3.js";
|