@knowvah/dot-engine 2.0.2 → 2.2.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/async/render-async.d.ts.map +1 -1
- package/dist/common/arith.d.ts +6 -0
- package/dist/common/arith.d.ts.map +1 -1
- package/dist/common/libm-hypot.d.ts +3 -0
- package/dist/common/libm-hypot.d.ts.map +1 -0
- package/dist/common/poly-sizing.d.ts.map +1 -1
- package/dist/common/textmeasure-factory.d.ts +2 -1
- package/dist/common/textmeasure-factory.d.ts.map +1 -1
- package/dist/common/textmeasure.d.ts +1 -1
- package/dist/common/textmeasure.d.ts.map +1 -1
- package/dist/index.js +97 -59
- package/dist/index.js.map +4 -4
- package/dist/layout/dot/splines-label.d.ts.map +1 -1
- package/dist/layout/fdp/derive.d.ts.map +1 -1
- package/dist/layout/fdp/fdp-model.d.ts +4 -4
- package/dist/layout/fdp/normalize.d.ts.map +1 -1
- package/dist/layout/fdp/tlayout-init.d.ts.map +1 -1
- package/dist/layout/fdp/tlayout-parms.d.ts +4 -1
- package/dist/layout/fdp/tlayout-parms.d.ts.map +1 -1
- package/dist/layout/fdp/tlayout.d.ts +3 -4
- package/dist/layout/fdp/tlayout.d.ts.map +1 -1
- package/dist/layout/fdp/xlayout.d.ts.map +1 -1
- package/dist/render.js +95 -57
- package/dist/render.js.map +4 -4
- package/package.json +1 -1
- package/src/async/render-async.ts +6 -3
- package/src/common/arith.ts +9 -0
- package/src/common/libm-hypot.ts +40 -0
- package/src/common/poly-sizing.ts +12 -11
- package/src/common/textmeasure-factory.ts +20 -1
- package/src/common/textmeasure.ts +1 -1
- package/src/layout/dot/splines-label.ts +2 -1
- package/src/layout/fdp/derive.ts +5 -2
- package/src/layout/fdp/fdp-model.ts +4 -4
- package/src/layout/fdp/normalize.ts +2 -1
- package/src/layout/fdp/tlayout-init.ts +8 -6
- package/src/layout/fdp/tlayout-parms.ts +5 -2
- package/src/layout/fdp/tlayout.ts +18 -17
- package/src/layout/fdp/xlayout.ts +26 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"splines-label.d.ts","sourceRoot":"","sources":["../../../src/layout/dot/splines-label.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"splines-label.d.ts","sourceRoot":"","sources":["../../../src/layout/dot/splines-label.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAWxD,oDAAoD;AACpD,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,GAAG,EAAE,OAAO,CAAC;CACd;AAMD,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAMjE;AAED,kDAAkD;AAClD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAI/D;AAED,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAIvD;AAOD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,CAW1C;AAOD,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,CAO5C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAe9C;AAOD,yFAAyF;AACzF,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,kGAAkG;AAClG,eAAO,MAAM,gBAAgB,MAAM,CAAC;AA8EpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAM/D;AAyED,4DAA4D;AAC5D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,GAAG,IAAI,CActD;AAOD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAQrD;AAiCD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAK9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/derive.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/derive.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAyB3C,oEAAoE;AACpE,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,KAAK,EAAE,KAAK,CAAC;IACb,kEAAkE;IAClE,SAAS,EAAE,OAAO,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,6CAA6C;IAC7C,IAAI,EAAE,OAAO,kBAAkB,EAAE,QAAQ,CAAC;CAC3C;AAMD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAM1D;AAwLD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,KAAK,GAAG,IAAI,CAiBrE"}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* fdp engine data model — gdata, dndata, bport_t, xparams, and the
|
|
3
3
|
* accessor macros of the C private interface.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Matches Graphviz after 15.0.0 (fdpParms.Mlimit lives in
|
|
6
|
+
* tlayout-parms.ts).
|
|
7
7
|
*
|
|
8
|
-
* @see lib/fdpgen/fdp.h
|
|
9
|
-
* @see lib/fdpgen/xlayout.h
|
|
8
|
+
* @see lib/fdpgen/fdp.h
|
|
9
|
+
* @see lib/fdpgen/xlayout.h
|
|
10
10
|
*/
|
|
11
11
|
import type { Graph } from '../../model/graph.js';
|
|
12
12
|
import type { Node } from '../../model/node.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/normalize.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/normalize.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AA0ClD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,CA6B3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tlayout-init.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/tlayout-init.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"tlayout-init.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/tlayout-init.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAGjD,OAAO,EACL,KAAK,KAAK,EAMX,MAAM,gBAAgB,CAAC;AA6KxB;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,IAAI,GAAG,KAAK,CA0BjE"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @see lib/fdpgen/tlayout.c (15.0.0) — parms_t, fdp_initParams,
|
|
9
9
|
* init_params, cool, reset_params
|
|
10
|
-
* @see lib/common/globals.c
|
|
10
|
+
* @see lib/common/globals.c — fdpParms defaults
|
|
11
11
|
*/
|
|
12
12
|
import type { Graph } from '../../model/graph.js';
|
|
13
13
|
import { type XParams } from './fdp-model.js';
|
|
@@ -36,6 +36,9 @@ export declare const fdpParms: {
|
|
|
36
36
|
Tfact: number;
|
|
37
37
|
K: number;
|
|
38
38
|
T0: number;
|
|
39
|
+
/** Distance beyond which repulsion is 0; HUGE_VAL unless `dot -Lm` (no library
|
|
40
|
+
* equivalent). @see lib/fdpgen/fdp.h:fdpParms_s.Mlimit */
|
|
41
|
+
Mlimit: number;
|
|
39
42
|
};
|
|
40
43
|
/** @see lib/fdpgen/tlayout.c:parms_t */
|
|
41
44
|
export interface TParms {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tlayout-parms.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/tlayout-parms.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,gBAAgB,CAAC;AAM1D,0CAA0C;AAC1C,eAAO,MAAM,SAAS,MAAM,CAAC;AAU7B,0CAA0C;AAC1C,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,6CAA6C;AAC7C,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,4CAA4C;AAC5C,eAAO,MAAM,WAAW,IAAI,CAAC;AAQ7B;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"tlayout-parms.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/tlayout-parms.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,gBAAgB,CAAC;AAM1D,0CAA0C;AAC1C,eAAO,MAAM,SAAS,MAAM,CAAC;AAU7B,0CAA0C;AAC1C,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,6CAA6C;AAC7C,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,4CAA4C;AAC5C,eAAO,MAAM,WAAW,IAAI,CAAC;AAQ7B;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;IASnB;+DAC2D;;CAE5D,CAAC;AAMF,wCAAwC;AACxC,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,+EAA+E;AAC/E,eAAO,MAAM,KAAK,EAAE,MAInB,CAAC;AAEF,8DAA8D;AAC9D,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtC;AAED,6CAA6C;AAC7C,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAMD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACxB,CAAC,EAAE,KAAK,EACR,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACzB,MAAM,CAaR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,MAAM,GACX;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAOhC;AAMD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAsB5C;AAeD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CA2B3D"}
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* fdp initial layout — grid-accelerated Fruchterman–Reingold on point
|
|
3
3
|
* nodes with boundary ports.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* (
|
|
7
|
-
* 15.0.0 output, so neither is ported.
|
|
5
|
+
* Repulsion follows Graphviz after 15.0.0: doRep takes the hypot distance
|
|
6
|
+
* (the host libm's, see libm-hypot.ts) and honours the Mlimit cutoff.
|
|
8
7
|
*
|
|
9
8
|
* All math is double precision (unlike neato's float32 stress kernel).
|
|
10
9
|
* Force-accumulation order is load-bearing: node iteration is the
|
|
@@ -14,7 +13,7 @@
|
|
|
14
13
|
* Parameter state lives in tlayout-parms.ts; initial placement in
|
|
15
14
|
* tlayout-init.ts.
|
|
16
15
|
*
|
|
17
|
-
* @see lib/fdpgen/tlayout.c
|
|
16
|
+
* @see lib/fdpgen/tlayout.c
|
|
18
17
|
*/
|
|
19
18
|
import type { Graph } from '../../model/graph.js';
|
|
20
19
|
import { type XParams } from './fdp-model.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tlayout.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/tlayout.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"tlayout.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/tlayout.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAMlD,OAAO,EAEL,KAAK,OAAO,EAMb,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAM/G;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,IAAI;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAQpE;AA+ND;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAyBxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xlayout.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/xlayout.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAKlD,OAAO,EACL,KAAK,OAAO,EAKb,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"xlayout.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/xlayout.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAKlD,OAAO,EACL,KAAK,OAAO,EAKb,MAAM,gBAAgB,CAAC;AA2QxB;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAMxD"}
|
package/dist/render.js
CHANGED
|
@@ -5426,6 +5426,15 @@ function adviseHostFaithful() {
|
|
|
5426
5426
|
"@knowvah/dot-engine: measuring text with built-in metrics (kerning/shaping not applied). For host-faithful sizing matching the rendering font, install `canvas` and call setTextMeasurer(new CanvasTextMeasurer(createCanvas(0,0).getContext('2d'))). Silence with GV_FONT_QUIET=1.\n"
|
|
5427
5427
|
);
|
|
5428
5428
|
}
|
|
5429
|
+
function offscreenMeasurer() {
|
|
5430
|
+
if (typeof OffscreenCanvas === "undefined") return void 0;
|
|
5431
|
+
try {
|
|
5432
|
+
const ctx2d = new OffscreenCanvas(0, 0).getContext("2d");
|
|
5433
|
+
return ctx2d ? new CanvasTextMeasurer(ctx2d) : void 0;
|
|
5434
|
+
} catch {
|
|
5435
|
+
return void 0;
|
|
5436
|
+
}
|
|
5437
|
+
}
|
|
5429
5438
|
function createMeasurer() {
|
|
5430
5439
|
if (override) return override;
|
|
5431
5440
|
const forced = envMeasurer();
|
|
@@ -5437,6 +5446,9 @@ function createMeasurer() {
|
|
|
5437
5446
|
if (ctx2d) return new CanvasTextMeasurer(ctx2d);
|
|
5438
5447
|
} catch {
|
|
5439
5448
|
}
|
|
5449
|
+
} else {
|
|
5450
|
+
const offscreen = offscreenMeasurer();
|
|
5451
|
+
if (offscreen) return offscreen;
|
|
5440
5452
|
}
|
|
5441
5453
|
adviseHostFaithful();
|
|
5442
5454
|
return new EstimateTextMeasurer();
|
|
@@ -10493,6 +10505,32 @@ function fms(a, b, c) {
|
|
|
10493
10505
|
return fma(-a, b, c);
|
|
10494
10506
|
}
|
|
10495
10507
|
|
|
10508
|
+
// src/common/arith.ts
|
|
10509
|
+
function cround(v) {
|
|
10510
|
+
return v >= 0 ? Math.floor(v + 0.5) : Math.ceil(v - 0.5);
|
|
10511
|
+
}
|
|
10512
|
+
function RADIANS(deg) {
|
|
10513
|
+
return deg / 180 * Math.PI;
|
|
10514
|
+
}
|
|
10515
|
+
|
|
10516
|
+
// src/common/libm-hypot.ts
|
|
10517
|
+
var BIG = 2 ** 500;
|
|
10518
|
+
var SMALL2 = 2 ** -500;
|
|
10519
|
+
var SCALE_UP = 2 ** 600;
|
|
10520
|
+
var SCALE_DOWN = 2 ** -600;
|
|
10521
|
+
function libmHypot(a, b) {
|
|
10522
|
+
if (a === Infinity || a === -Infinity || b === Infinity || b === -Infinity) return Infinity;
|
|
10523
|
+
let x = Math.abs(a);
|
|
10524
|
+
let y = Math.abs(b);
|
|
10525
|
+
if (x < y) [x, y] = [y, x];
|
|
10526
|
+
if (x > BIG) return core(x * SCALE_DOWN, y * SCALE_DOWN) * SCALE_UP;
|
|
10527
|
+
if (x < SMALL2) return core(x * SCALE_UP, y * SCALE_UP) * SCALE_DOWN;
|
|
10528
|
+
return core(x, y);
|
|
10529
|
+
}
|
|
10530
|
+
function core(x, y) {
|
|
10531
|
+
return Math.sqrt(fma(y, y, x * x));
|
|
10532
|
+
}
|
|
10533
|
+
|
|
10496
10534
|
// src/common/poly-sizing.ts
|
|
10497
10535
|
var GAP = 4;
|
|
10498
10536
|
var XPAD = 4 * GAP;
|
|
@@ -10580,16 +10618,16 @@ function ellipsePeripheryBB(bb, peripheries, penwidth, hasOutline) {
|
|
|
10580
10618
|
return { bb: b, outline };
|
|
10581
10619
|
}
|
|
10582
10620
|
function transformUnitVertex(R2, g, c, bb) {
|
|
10583
|
-
const D = { x: R2.x
|
|
10584
|
-
const alpha = g.orientation
|
|
10585
|
-
const r =
|
|
10621
|
+
const D = { x: fma(R2.x, fma(R2.y, c.gdistortion, c.skewdist), R2.y * c.gskew), y: R2.y };
|
|
10622
|
+
const alpha = RADIANS(g.orientation) + Math.atan2(D.y, D.x);
|
|
10623
|
+
const r = libmHypot(D.x, D.y);
|
|
10586
10624
|
return { x: r * Math.cos(alpha) * bb.x, y: r * Math.sin(alpha) * bb.y };
|
|
10587
10625
|
}
|
|
10588
10626
|
function polygonVertices(bb, g, isBox3) {
|
|
10589
10627
|
const sectorangle = 2 * Math.PI / g.sides;
|
|
10590
10628
|
const sidelength = Math.sin(sectorangle / 2);
|
|
10591
10629
|
const c = {
|
|
10592
|
-
skewdist:
|
|
10630
|
+
skewdist: libmHypot(Math.abs(g.distortion) + Math.abs(g.skew), 1),
|
|
10593
10631
|
gdistortion: g.distortion * SQRT2 / Math.cos(sectorangle / 2),
|
|
10594
10632
|
gskew: g.skew / 2
|
|
10595
10633
|
};
|
|
@@ -16758,11 +16796,6 @@ function initEdgeLabels(e, g, measurer) {
|
|
|
16758
16796
|
if (hasEnd) applyEndLabels(e, g, measurer);
|
|
16759
16797
|
}
|
|
16760
16798
|
|
|
16761
|
-
// src/common/arith.ts
|
|
16762
|
-
function cround(v) {
|
|
16763
|
-
return v >= 0 ? Math.floor(v + 0.5) : Math.ceil(v - 0.5);
|
|
16764
|
-
}
|
|
16765
|
-
|
|
16766
16799
|
// src/common/graph-init.ts
|
|
16767
16800
|
var RANKDIR_TB = 0;
|
|
16768
16801
|
var RANKDIR_LR = 1;
|
|
@@ -21469,7 +21502,7 @@ function feasibleTree(ctx) {
|
|
|
21469
21502
|
|
|
21470
21503
|
// src/util/bsd-qsort.ts
|
|
21471
21504
|
var THRESH = 7;
|
|
21472
|
-
var
|
|
21505
|
+
var BIG2 = 40;
|
|
21473
21506
|
function swap(arr, i, j) {
|
|
21474
21507
|
const t = arr[i];
|
|
21475
21508
|
arr[i] = arr[j];
|
|
@@ -21495,7 +21528,7 @@ function choosePivot(arr, lo, n, cmp) {
|
|
|
21495
21528
|
let pm = lo + (n >> 1);
|
|
21496
21529
|
let pl = lo;
|
|
21497
21530
|
let pn = lo + (n - 1);
|
|
21498
|
-
if (n >
|
|
21531
|
+
if (n > BIG2) {
|
|
21499
21532
|
const d = n >> 3;
|
|
21500
21533
|
pl = med3(arr, pl, pl + d, pl + 2 * d, cmp);
|
|
21501
21534
|
pm = med3(arr, pm - d, pm, pm + d, cmp);
|
|
@@ -28895,7 +28928,7 @@ function applyPortlabelPos(e, headP) {
|
|
|
28895
28928
|
}
|
|
28896
28929
|
function writePortlabelPos(l, pe, pf, angleStr, distanceStr) {
|
|
28897
28930
|
const angleDeg = lateDouble(angleStr, PORT_LABEL_ANGLE, -180);
|
|
28898
|
-
const angle = Math.atan2(pf.y - pe.y, pf.x - pe.x) +
|
|
28931
|
+
const angle = Math.atan2(pf.y - pe.y, pf.x - pe.x) + RADIANS(angleDeg);
|
|
28899
28932
|
const distMult = lateDouble(distanceStr || void 0, 1, 0);
|
|
28900
28933
|
const dist4 = PORT_LABEL_DISTANCE * distMult;
|
|
28901
28934
|
l.pos.x = pe.x + dist4 * Math.cos(angle);
|
|
@@ -31819,7 +31852,7 @@ function addLoop(sg, cp, dp, sp) {
|
|
|
31819
31852
|
var MARGIN = 36;
|
|
31820
31853
|
var delta = 1;
|
|
31821
31854
|
var mu = 500;
|
|
31822
|
-
var
|
|
31855
|
+
var BIG3 = 16384;
|
|
31823
31856
|
function chanSz(w) {
|
|
31824
31857
|
return (w - 3) / 2;
|
|
31825
31858
|
}
|
|
@@ -31839,7 +31872,7 @@ function updateWt(ep, sz) {
|
|
|
31839
31872
|
ep.cnt++;
|
|
31840
31873
|
if (ep.cnt > sz) {
|
|
31841
31874
|
ep.cnt = 0;
|
|
31842
|
-
ep.weight +=
|
|
31875
|
+
ep.weight += BIG3;
|
|
31843
31876
|
}
|
|
31844
31877
|
}
|
|
31845
31878
|
function updateWts(g, cp, ep) {
|
|
@@ -31897,12 +31930,12 @@ function createSEdges(cp, g) {
|
|
|
31897
31930
|
let vwt = delta * (bb.UR.y - bb.LL.y);
|
|
31898
31931
|
let wt = (hwt + vwt) / 2 + mu;
|
|
31899
31932
|
if (isSmall(bb.UR.y - bb.LL.y) && !(cp.flags & MZ_SMALLV)) {
|
|
31900
|
-
hwt =
|
|
31901
|
-
wt =
|
|
31933
|
+
hwt = BIG3;
|
|
31934
|
+
wt = BIG3;
|
|
31902
31935
|
}
|
|
31903
31936
|
if (isSmall(bb.UR.x - bb.LL.x) && !(cp.flags & MZ_SMALLH)) {
|
|
31904
|
-
vwt =
|
|
31905
|
-
wt =
|
|
31937
|
+
vwt = BIG3;
|
|
31938
|
+
wt = BIG3;
|
|
31906
31939
|
}
|
|
31907
31940
|
const L2 = cp.sides[M_LEFT];
|
|
31908
31941
|
const T2 = cp.sides[M_TOP];
|
|
@@ -37507,7 +37540,7 @@ function raySeg2(v, w, a, b) {
|
|
|
37507
37540
|
}
|
|
37508
37541
|
return wind(v, a, w) * wind(v, a, b) >= 0;
|
|
37509
37542
|
}
|
|
37510
|
-
var
|
|
37543
|
+
var SMALL3 = 1e-10;
|
|
37511
37544
|
function raySegIntersect(v, w, a, b) {
|
|
37512
37545
|
if (!raySeg2(v, w, a, b)) return null;
|
|
37513
37546
|
const mv = { x: w.x - v.x, y: w.y - v.y };
|
|
@@ -37515,7 +37548,7 @@ function raySegIntersect(v, w, a, b) {
|
|
|
37515
37548
|
const ln = { x: -lv.y, y: lv.x };
|
|
37516
37549
|
const lc = -(ln.x * a.x + ln.y * a.y);
|
|
37517
37550
|
const dt = ln.x * mv.x + ln.y * mv.y;
|
|
37518
|
-
if (Math.abs(dt) <
|
|
37551
|
+
if (Math.abs(dt) < SMALL3) return null;
|
|
37519
37552
|
const s = (ln.x * v.x + ln.y * v.y + lc) / dt;
|
|
37520
37553
|
return { x: v.x - s * mv.x, y: v.y - s * mv.y };
|
|
37521
37554
|
}
|
|
@@ -41782,7 +41815,7 @@ function angleSet(g) {
|
|
|
41782
41815
|
if (a === void 0 || a === "") return null;
|
|
41783
41816
|
const ang = parseAngle2(a);
|
|
41784
41817
|
if (ang === null) return null;
|
|
41785
|
-
return wrapDegrees(ang)
|
|
41818
|
+
return RADIANS(wrapDegrees(ang));
|
|
41786
41819
|
}
|
|
41787
41820
|
function parseAngle2(a) {
|
|
41788
41821
|
const m = /^\s*[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/.exec(a);
|
|
@@ -44231,7 +44264,10 @@ var fdpParms = {
|
|
|
44231
44264
|
C: 0,
|
|
44232
44265
|
Tfact: 1,
|
|
44233
44266
|
K: -1,
|
|
44234
|
-
T0: -1
|
|
44267
|
+
T0: -1,
|
|
44268
|
+
/** Distance beyond which repulsion is 0; HUGE_VAL unless `dot -Lm` (no library
|
|
44269
|
+
* equivalent). @see lib/fdpgen/fdp.h:fdpParms_s.Mlimit */
|
|
44270
|
+
Mlimit: Infinity
|
|
44235
44271
|
};
|
|
44236
44272
|
var parms = {
|
|
44237
44273
|
useGrid: 0,
|
|
@@ -44559,8 +44595,8 @@ function placeByNeighbors(g, np, ctr) {
|
|
|
44559
44595
|
np.info.pos[0] = p.x;
|
|
44560
44596
|
np.info.pos[1] = p.y;
|
|
44561
44597
|
} else if (cnt === 1) {
|
|
44562
|
-
np.info.pos[0] = 0.98
|
|
44563
|
-
np.info.pos[1] = 0.9
|
|
44598
|
+
np.info.pos[0] = fma(0.98, p.x, 0.1 * ctr.x);
|
|
44599
|
+
np.info.pos[1] = fma(0.9, p.y, 0.1 * ctr.y);
|
|
44564
44600
|
} else {
|
|
44565
44601
|
const angle = Math.PI * 2 * drand48();
|
|
44566
44602
|
const radius = 0.9 * drand48();
|
|
@@ -44576,8 +44612,8 @@ function averagePlacedNeighbors(g, np, p) {
|
|
|
44576
44612
|
const op = ep.head === np ? ep.tail : ep.head;
|
|
44577
44613
|
if (!hasPos3(op)) continue;
|
|
44578
44614
|
if (cnt) {
|
|
44579
|
-
p.x = (p.x
|
|
44580
|
-
p.y = (p.y
|
|
44615
|
+
p.x = fma(p.x, cnt, op.info.pos[0]) / (cnt + 1);
|
|
44616
|
+
p.y = fma(p.y, cnt, op.info.pos[1]) / (cnt + 1);
|
|
44581
44617
|
} else {
|
|
44582
44618
|
p.x = op.info.pos[0];
|
|
44583
44619
|
p.y = op.info.pos[1];
|
|
@@ -44639,8 +44675,8 @@ function sizeBoundary(width, height) {
|
|
|
44639
44675
|
function placeWithPorts(g, pp, ctr) {
|
|
44640
44676
|
for (const port of pp) {
|
|
44641
44677
|
const np = port.n;
|
|
44642
|
-
np.info.pos[0] = parms.Wd
|
|
44643
|
-
np.info.pos[1] = parms.Ht
|
|
44678
|
+
np.info.pos[0] = fma(parms.Wd, Math.cos(port.alpha), ctr.x);
|
|
44679
|
+
np.info.pos[1] = fma(parms.Ht, Math.sin(port.alpha), ctr.y);
|
|
44644
44680
|
dndata(np).pinned = P_SET;
|
|
44645
44681
|
}
|
|
44646
44682
|
for (const np of g.nodes.values()) {
|
|
@@ -44702,19 +44738,20 @@ function coincidentDelta() {
|
|
|
44702
44738
|
} while (xdelta === 0 && ydelta === 0);
|
|
44703
44739
|
return { xdelta, ydelta };
|
|
44704
44740
|
}
|
|
44705
|
-
function doRep(p, q, xdelta, ydelta,
|
|
44741
|
+
function doRep(p, q, xdelta, ydelta, dist4) {
|
|
44706
44742
|
let force;
|
|
44707
|
-
if (
|
|
44743
|
+
if (!(dist4 > 0)) {
|
|
44708
44744
|
const d = coincidentDelta();
|
|
44709
44745
|
xdelta = d.xdelta;
|
|
44710
44746
|
ydelta = d.ydelta;
|
|
44711
|
-
|
|
44747
|
+
dist4 = libmHypot(xdelta, ydelta);
|
|
44712
44748
|
}
|
|
44713
|
-
if (
|
|
44714
|
-
|
|
44715
|
-
|
|
44749
|
+
if (dist4 > fdpParms.Mlimit) {
|
|
44750
|
+
force = 0;
|
|
44751
|
+
} else if (parms.useNew) {
|
|
44752
|
+
force = parms.K * parms.K / (dist4 * dist4 * dist4);
|
|
44716
44753
|
} else {
|
|
44717
|
-
force = parms.K * parms.K /
|
|
44754
|
+
force = parms.K * parms.K / (dist4 * dist4);
|
|
44718
44755
|
}
|
|
44719
44756
|
if (isPort(p) && isPort(q)) force *= 10;
|
|
44720
44757
|
const dq = disp(q);
|
|
@@ -44727,7 +44764,7 @@ function doRep(p, q, xdelta, ydelta, dist22) {
|
|
|
44727
44764
|
function applyRep(p, q) {
|
|
44728
44765
|
const xdelta = q.info.pos[0] - p.info.pos[0];
|
|
44729
44766
|
const ydelta = q.info.pos[1] - p.info.pos[1];
|
|
44730
|
-
doRep(p, q, xdelta, ydelta,
|
|
44767
|
+
doRep(p, q, xdelta, ydelta, libmHypot(xdelta, ydelta));
|
|
44731
44768
|
}
|
|
44732
44769
|
function doNeighbor(grid2, i, j, nodes) {
|
|
44733
44770
|
const cellp = grid2.find(i, j);
|
|
@@ -44736,8 +44773,8 @@ function doNeighbor(grid2, i, j, nodes) {
|
|
|
44736
44773
|
for (const q of cellp.nodes) {
|
|
44737
44774
|
const xdelta = q.info.pos[0] - p.info.pos[0];
|
|
44738
44775
|
const ydelta = q.info.pos[1] - p.info.pos[1];
|
|
44739
|
-
const
|
|
44740
|
-
if (
|
|
44776
|
+
const dist4 = libmHypot(xdelta, ydelta);
|
|
44777
|
+
if (dist4 < parms.Cell) doRep(p, q, xdelta, ydelta, dist4);
|
|
44741
44778
|
}
|
|
44742
44779
|
}
|
|
44743
44780
|
}
|
|
@@ -44909,7 +44946,7 @@ function ht2(n) {
|
|
|
44909
44946
|
return xMarg.doAdd ? n.info.height / 2 + xMarg.y : n.info.height * xMarg.y / 2;
|
|
44910
44947
|
}
|
|
44911
44948
|
function rad(n) {
|
|
44912
|
-
return
|
|
44949
|
+
return libmHypot(wd2(n), ht2(n));
|
|
44913
44950
|
}
|
|
44914
44951
|
function xinitParams(n, xpms) {
|
|
44915
44952
|
xParams.K = xpms.K;
|
|
@@ -44944,37 +44981,38 @@ function cntOverlaps(g) {
|
|
|
44944
44981
|
function applyRep2(p, q, rs) {
|
|
44945
44982
|
let xdelta = q.info.pos[0] - p.info.pos[0];
|
|
44946
44983
|
let ydelta = q.info.pos[1] - p.info.pos[1];
|
|
44947
|
-
let
|
|
44948
|
-
if (
|
|
44984
|
+
let dist4 = libmHypot(xdelta, ydelta);
|
|
44985
|
+
if (!(dist4 > 0)) {
|
|
44949
44986
|
const d = coincidentDelta();
|
|
44950
44987
|
xdelta = d.xdelta;
|
|
44951
44988
|
ydelta = d.ydelta;
|
|
44952
|
-
|
|
44989
|
+
dist4 = libmHypot(xdelta, ydelta);
|
|
44953
44990
|
}
|
|
44954
44991
|
const ov = overlap4(p, q) ? 1 : 0;
|
|
44955
|
-
|
|
44992
|
+
let force = ov ? rs.ov / (dist4 * dist4) : rs.nonov / (dist4 * dist4);
|
|
44993
|
+
if (dist4 > fdpParms.Mlimit) force = 0;
|
|
44956
44994
|
const dq = disp(q);
|
|
44957
44995
|
const dp = disp(p);
|
|
44958
|
-
dq[0]
|
|
44959
|
-
dq[1]
|
|
44960
|
-
dp[0]
|
|
44961
|
-
dp[1]
|
|
44996
|
+
dq[0] = fma(xdelta, force, dq[0]);
|
|
44997
|
+
dq[1] = fma(ydelta, force, dq[1]);
|
|
44998
|
+
dp[0] = fms(xdelta, force, dp[0]);
|
|
44999
|
+
dp[1] = fms(ydelta, force, dp[1]);
|
|
44962
45000
|
return ov;
|
|
44963
45001
|
}
|
|
44964
45002
|
function applyAttr2(p, q) {
|
|
44965
45003
|
if (overlap4(p, q)) return;
|
|
44966
45004
|
const xdelta = q.info.pos[0] - p.info.pos[0];
|
|
44967
45005
|
const ydelta = q.info.pos[1] - p.info.pos[1];
|
|
44968
|
-
const dist4 =
|
|
45006
|
+
const dist4 = libmHypot(xdelta, ydelta);
|
|
44969
45007
|
const din = rad(p) + rad(q);
|
|
44970
45008
|
const dout = dist4 - din;
|
|
44971
45009
|
const force = dout * dout / ((xParams.K + din) * dist4);
|
|
44972
45010
|
const dq = disp(q);
|
|
44973
45011
|
const dp = disp(p);
|
|
44974
|
-
dq[0]
|
|
44975
|
-
dq[1]
|
|
44976
|
-
dp[0]
|
|
44977
|
-
dp[1]
|
|
45012
|
+
dq[0] = fms(xdelta, force, dq[0]);
|
|
45013
|
+
dq[1] = fms(ydelta, force, dq[1]);
|
|
45014
|
+
dp[0] = fma(xdelta, force, dp[0]);
|
|
45015
|
+
dp[1] = fma(ydelta, force, dp[1]);
|
|
44978
45016
|
}
|
|
44979
45017
|
function accumForces(g, rs) {
|
|
44980
45018
|
let overlaps2 = 0;
|
|
@@ -44996,7 +45034,7 @@ function moveNodes(g, temp) {
|
|
|
44996
45034
|
if (dndata(n).pinned === P_PIN) continue;
|
|
44997
45035
|
const dx = disp(n)[0];
|
|
44998
45036
|
const dy = disp(n)[1];
|
|
44999
|
-
const len2 = dx
|
|
45037
|
+
const len2 = fma(dx, dx, dy * dy);
|
|
45000
45038
|
if (len2 < temp2) {
|
|
45001
45039
|
n.info.pos[0] += dx;
|
|
45002
45040
|
n.info.pos[1] += dy;
|
|
@@ -45250,7 +45288,7 @@ function deriveClusterNodes(g, dg, infop) {
|
|
|
45250
45288
|
}
|
|
45251
45289
|
}
|
|
45252
45290
|
function deriveRealNodes(g, dg) {
|
|
45253
|
-
for (const n of g
|
|
45291
|
+
for (const n of nodesInSeq(g)) {
|
|
45254
45292
|
if (getDnode(n) !== null) continue;
|
|
45255
45293
|
const par = getParent(n);
|
|
45256
45294
|
if (par !== null && par !== gdata(g).parent) {
|
|
@@ -45292,7 +45330,7 @@ function deriveEdge(dg, byPair, tl, hd) {
|
|
|
45292
45330
|
return de;
|
|
45293
45331
|
}
|
|
45294
45332
|
function deriveEdges(g, dg, byPair) {
|
|
45295
|
-
for (const n of g
|
|
45333
|
+
for (const n of nodesInSeq(g)) {
|
|
45296
45334
|
const tl = getDnode(n);
|
|
45297
45335
|
for (const e of n.outEdges(g)) {
|
|
45298
45336
|
const hd = getDnode(e.head);
|
|
@@ -55202,8 +55240,8 @@ async function loadFonts(fontSet, fonts, timeoutMs) {
|
|
|
55202
55240
|
var DEFAULT_FONT_TIMEOUT_MS = 3e3;
|
|
55203
55241
|
function defaultFontSet() {
|
|
55204
55242
|
const doc = Reflect.get(globalThis, "document");
|
|
55205
|
-
|
|
55206
|
-
const fonts = Reflect.get(
|
|
55243
|
+
const owner = typeof doc === "object" && doc !== null ? doc : globalThis;
|
|
55244
|
+
const fonts = Reflect.get(owner, "fonts");
|
|
55207
55245
|
if (typeof fonts !== "object" || fonts === null) return void 0;
|
|
55208
55246
|
return fonts;
|
|
55209
55247
|
}
|