@ankhorage/zora 26.0.0 → 26.0.2
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphController.js +2 -3
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphController.js.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js +3 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/getGraphGeometryKey.d.ts +5 -5
- package/dist/features/graph-view/adapters/inbound/web-artifact/getGraphGeometryKey.d.ts.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/getGraphGeometryKey.js +13 -7
- package/dist/features/graph-view/adapters/inbound/web-artifact/getGraphGeometryKey.js.map +1 -1
- package/package.json +5 -4
- package/src/features/graph-view/adapters/inbound/web-artifact/createGraphController.test.ts +1 -2
- package/src/features/graph-view/adapters/inbound/web-artifact/createGraphController.ts +2 -3
- package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.test.ts +45 -0
- package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.ts +3 -1
- package/src/features/graph-view/adapters/inbound/web-artifact/getGraphGeometryKey.test.ts +65 -3
- package/src/features/graph-view/adapters/inbound/web-artifact/getGraphGeometryKey.ts +13 -7
- package/web-dist/components/graph-view/GraphView.js +878 -317
|
@@ -94572,6 +94572,11 @@ var gcdMultipleZeroIfNonInt = function gcdMultipleZeroIfNonInt(arr) {
|
|
|
94572
94572
|
}
|
|
94573
94573
|
return out;
|
|
94574
94574
|
};
|
|
94575
|
+
var isIntegerMultiple = function isIntegerMultiple(a, b) {
|
|
94576
|
+
var ratio = a / b;
|
|
94577
|
+
var nearest = Math.round(ratio);
|
|
94578
|
+
return nearest >= 1 && Math.abs(ratio - nearest) < 0.000001;
|
|
94579
|
+
};
|
|
94575
94580
|
var deg2rad = function deg2rad(deg) {
|
|
94576
94581
|
return Math.PI * deg / 180;
|
|
94577
94582
|
};
|
|
@@ -95499,6 +95504,39 @@ var getBarrelCurveConstants = function getBarrelCurveConstants(width, height) {
|
|
|
95499
95504
|
ctrlPtOffsetPct: 0.05
|
|
95500
95505
|
};
|
|
95501
95506
|
};
|
|
95507
|
+
var getRotatedLabelBox$1 = function getRotatedLabelBox(bb, lx, ly, theta, ox, oy, th) {
|
|
95508
|
+
var lx1 = bb.x1 - th - ox;
|
|
95509
|
+
var lx2 = bb.x2 + th - ox;
|
|
95510
|
+
var ly1 = bb.y1 - th - oy;
|
|
95511
|
+
var ly2 = bb.y2 + th - oy;
|
|
95512
|
+
if (theta) {
|
|
95513
|
+
var cos = Math.cos(theta);
|
|
95514
|
+
var sin = Math.sin(theta);
|
|
95515
|
+
var rotate = function rotate(x, y) {
|
|
95516
|
+
x = x - lx;
|
|
95517
|
+
y = y - ly;
|
|
95518
|
+
return {
|
|
95519
|
+
x: x * cos - y * sin + lx + ox,
|
|
95520
|
+
y: x * sin + y * cos + ly + oy
|
|
95521
|
+
};
|
|
95522
|
+
};
|
|
95523
|
+
return [rotate(lx1, ly1), rotate(lx2, ly1), rotate(lx2, ly2), rotate(lx1, ly2)];
|
|
95524
|
+
} else {
|
|
95525
|
+
return [{
|
|
95526
|
+
x: lx1 + ox,
|
|
95527
|
+
y: ly1 + oy
|
|
95528
|
+
}, {
|
|
95529
|
+
x: lx2 + ox,
|
|
95530
|
+
y: ly1 + oy
|
|
95531
|
+
}, {
|
|
95532
|
+
x: lx2 + ox,
|
|
95533
|
+
y: ly2 + oy
|
|
95534
|
+
}, {
|
|
95535
|
+
x: lx1 + ox,
|
|
95536
|
+
y: ly2 + oy
|
|
95537
|
+
}];
|
|
95538
|
+
}
|
|
95539
|
+
};
|
|
95502
95540
|
function satPolygonIntersection(poly1, poly2) {
|
|
95503
95541
|
function getAxes(polygon) {
|
|
95504
95542
|
var axes = [];
|
|
@@ -95563,6 +95601,37 @@ function satPolygonIntersection(poly1, poly2) {
|
|
|
95563
95601
|
}
|
|
95564
95602
|
return true;
|
|
95565
95603
|
}
|
|
95604
|
+
function doLinesIntersect(p1, p2, q1, q2) {
|
|
95605
|
+
function ccw(a, b, c) {
|
|
95606
|
+
return (c.y - a.y) * (b.x - a.x) > (b.y - a.y) * (c.x - a.x);
|
|
95607
|
+
}
|
|
95608
|
+
return ccw(p1, q1, q2) !== ccw(p2, q1, q2) && ccw(p1, p2, q1) !== ccw(p1, p2, q2);
|
|
95609
|
+
}
|
|
95610
|
+
function pointInPolygon(point, polygon) {
|
|
95611
|
+
var inside = false;
|
|
95612
|
+
for (var i = 0, j = polygon.length - 1;i < polygon.length; j = i++) {
|
|
95613
|
+
var pi = polygon[i];
|
|
95614
|
+
var pj = polygon[j];
|
|
95615
|
+
var intersects = pi.y > point.y !== pj.y > point.y && point.x < (pj.x - pi.x) * (point.y - pi.y) / (pj.y - pi.y) + pi.x;
|
|
95616
|
+
if (intersects) {
|
|
95617
|
+
inside = !inside;
|
|
95618
|
+
}
|
|
95619
|
+
}
|
|
95620
|
+
return inside;
|
|
95621
|
+
}
|
|
95622
|
+
function segmentIntersectsPolygon(p1, p2, polygon) {
|
|
95623
|
+
if (pointInPolygon(p1, polygon)) {
|
|
95624
|
+
return true;
|
|
95625
|
+
}
|
|
95626
|
+
for (var i = 0;i < polygon.length; i++) {
|
|
95627
|
+
var q1 = polygon[i];
|
|
95628
|
+
var q2 = polygon[(i + 1) % polygon.length];
|
|
95629
|
+
if (doLinesIntersect(p1, p2, q1, q2)) {
|
|
95630
|
+
return true;
|
|
95631
|
+
}
|
|
95632
|
+
}
|
|
95633
|
+
return false;
|
|
95634
|
+
}
|
|
95566
95635
|
var pageRankDefaults = defaults$g({
|
|
95567
95636
|
dampingFactor: 0.8,
|
|
95568
95637
|
precision: 0.000001,
|
|
@@ -95603,7 +95672,7 @@ var elesfn$o = {
|
|
|
95603
95672
|
matrix[_n] += w;
|
|
95604
95673
|
columnSum[s] += w;
|
|
95605
95674
|
}
|
|
95606
|
-
var p =
|
|
95675
|
+
var p = dampingFactor / numNodes + additionalProb;
|
|
95607
95676
|
for (var _j = 0;_j < numNodes; _j++) {
|
|
95608
95677
|
if (columnSum[_j] === 0) {
|
|
95609
95678
|
for (var _i2 = 0;_i2 < numNodes; _i2++) {
|
|
@@ -95613,7 +95682,7 @@ var elesfn$o = {
|
|
|
95613
95682
|
} else {
|
|
95614
95683
|
for (var _i3 = 0;_i3 < numNodes; _i3++) {
|
|
95615
95684
|
var _n3 = _i3 * numNodes + _j;
|
|
95616
|
-
matrix[_n3] = matrix[_n3] / columnSum[_j] + additionalProb;
|
|
95685
|
+
matrix[_n3] = dampingFactor * matrix[_n3] / columnSum[_j] + additionalProb;
|
|
95617
95686
|
}
|
|
95618
95687
|
}
|
|
95619
95688
|
}
|
|
@@ -96375,6 +96444,9 @@ var kMedoids = function kMedoids(options) {
|
|
|
96375
96444
|
var nodes = this.nodes();
|
|
96376
96445
|
var node = null;
|
|
96377
96446
|
var opts = setOptions$2(options);
|
|
96447
|
+
if (opts.k > nodes.length) {
|
|
96448
|
+
error("kMedoids: k (".concat(opts.k, ") cannot exceed the number of nodes (").concat(nodes.length, ")."));
|
|
96449
|
+
}
|
|
96378
96450
|
var clusters = new Array(opts.k);
|
|
96379
96451
|
var medoids;
|
|
96380
96452
|
var assignment = {};
|
|
@@ -96588,12 +96660,14 @@ var mergeClosest = function mergeClosest(clusters, index, dists, mins, opts) {
|
|
|
96588
96660
|
merged = {
|
|
96589
96661
|
left: c1,
|
|
96590
96662
|
right: c2,
|
|
96591
|
-
key: c1.key
|
|
96663
|
+
key: c1.key,
|
|
96664
|
+
size: c1.size + c2.size
|
|
96592
96665
|
};
|
|
96593
96666
|
} else {
|
|
96594
96667
|
merged = {
|
|
96595
96668
|
value: c1.value.concat(c2.value),
|
|
96596
|
-
key: c1.key
|
|
96669
|
+
key: c1.key,
|
|
96670
|
+
size: c1.size + c2.size
|
|
96597
96671
|
};
|
|
96598
96672
|
}
|
|
96599
96673
|
clusters[c1.index] = merged;
|
|
@@ -96719,6 +96793,9 @@ var _buildClustersFromTree = function buildClustersFromTree(root, k, cy) {
|
|
|
96719
96793
|
var hierarchicalClustering = function hierarchicalClustering(options) {
|
|
96720
96794
|
var cy = this.cy();
|
|
96721
96795
|
var nodes = this.nodes();
|
|
96796
|
+
if (nodes.length === 0) {
|
|
96797
|
+
return [];
|
|
96798
|
+
}
|
|
96722
96799
|
var opts = setOptions$1(options);
|
|
96723
96800
|
var attrs = opts.attributes;
|
|
96724
96801
|
var getDist = function getDist(n1, n2) {
|
|
@@ -96736,7 +96813,8 @@ var hierarchicalClustering = function hierarchicalClustering(options) {
|
|
|
96736
96813
|
var cluster = {
|
|
96737
96814
|
value: opts.mode === "dendrogram" ? nodes[n] : [nodes[n]],
|
|
96738
96815
|
key: n,
|
|
96739
|
-
index: n
|
|
96816
|
+
index: n,
|
|
96817
|
+
size: 1
|
|
96740
96818
|
};
|
|
96741
96819
|
clusters[n] = cluster;
|
|
96742
96820
|
index[n] = cluster;
|
|
@@ -99802,7 +99880,8 @@ var valCmp = function valCmp(fieldVal, operator, value) {
|
|
|
99802
99880
|
operator = operator.replace("@", "");
|
|
99803
99881
|
caseInsensitive = true;
|
|
99804
99882
|
}
|
|
99805
|
-
|
|
99883
|
+
var isSubstrCmp = operator === "*=" || operator === "^=" || operator === "$=";
|
|
99884
|
+
if (isFieldStr || isValStr || caseInsensitive || isSubstrCmp) {
|
|
99806
99885
|
fieldStr = !isFieldStr && !isFieldNum ? "" : "" + fieldVal;
|
|
99807
99886
|
valStr = "" + value;
|
|
99808
99887
|
}
|
|
@@ -100489,6 +100568,9 @@ var beforePositionSet = function beforePositionSet(eles, newPos, silent) {
|
|
|
100489
100568
|
ele.children().shift(delta, silent);
|
|
100490
100569
|
}
|
|
100491
100570
|
ele.dirtyBoundingBoxCache();
|
|
100571
|
+
if (ele.isNode()) {
|
|
100572
|
+
ele.connectedEdges().dirtyBoundingBoxCache();
|
|
100573
|
+
}
|
|
100492
100574
|
}
|
|
100493
100575
|
}
|
|
100494
100576
|
};
|
|
@@ -100756,6 +100838,29 @@ elesfn$b.renderedBoundingBox = function(options) {
|
|
|
100756
100838
|
h: y2 - y1
|
|
100757
100839
|
};
|
|
100758
100840
|
};
|
|
100841
|
+
var getLabelPolygon = function getLabelPolygon(ele) {
|
|
100842
|
+
var label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "main";
|
|
100843
|
+
if (!ele || !ele.cy().styleEnabled()) {
|
|
100844
|
+
return null;
|
|
100845
|
+
}
|
|
100846
|
+
var prefix = label === "main" ? undefined : label;
|
|
100847
|
+
var _p = ele._private;
|
|
100848
|
+
var cache = _p.labelPolygonCache;
|
|
100849
|
+
var posKey = getLabelPolygonPosKey(ele);
|
|
100850
|
+
var isDirty = cache == null || cache[label] == null || _p.styleDirty || _p.labelPolygonPosKey !== posKey;
|
|
100851
|
+
if (!isDirty) {
|
|
100852
|
+
return cache[label];
|
|
100853
|
+
}
|
|
100854
|
+
ele.recalculateRenderedStyle();
|
|
100855
|
+
posKey = getLabelPolygonPosKey(ele);
|
|
100856
|
+
if (_p.labelPolygonCache == null || _p.labelPolygonPosKey !== posKey) {
|
|
100857
|
+
_p.labelPolygonCache = {};
|
|
100858
|
+
_p.labelPolygonPosKey = posKey;
|
|
100859
|
+
}
|
|
100860
|
+
var polygon = getRotatedLabelBox(ele, prefix);
|
|
100861
|
+
_p.labelPolygonCache[label] = polygon;
|
|
100862
|
+
return polygon;
|
|
100863
|
+
};
|
|
100759
100864
|
elesfn$b.dirtyCompoundBoundsCache = function() {
|
|
100760
100865
|
var silent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
100761
100866
|
var cy = this.cy();
|
|
@@ -100922,13 +101027,39 @@ var updateBoundsFromBox = function updateBoundsFromBox(b, b2) {
|
|
|
100922
101027
|
var prefixedProperty = function prefixedProperty(obj, field, prefix) {
|
|
100923
101028
|
return getPrefixedProperty(obj, field, prefix);
|
|
100924
101029
|
};
|
|
101030
|
+
var getRotatedLabelBox = function getRotatedLabelBox(ele, prefix) {
|
|
101031
|
+
if (ele.cy().headless()) {
|
|
101032
|
+
return;
|
|
101033
|
+
}
|
|
101034
|
+
var _p = ele._private;
|
|
101035
|
+
var prefixDash = prefix ? prefix + "-" : "";
|
|
101036
|
+
var label = ele.pstyle(prefixDash + "label").strValue;
|
|
101037
|
+
if (!label) {
|
|
101038
|
+
return null;
|
|
101039
|
+
}
|
|
101040
|
+
ele.boundingBox({
|
|
101041
|
+
includeLabels: true
|
|
101042
|
+
});
|
|
101043
|
+
var bbPrefix = prefix || "main";
|
|
101044
|
+
var bb = _p.labelBounds[bbPrefix];
|
|
101045
|
+
if (!bb) {
|
|
101046
|
+
return null;
|
|
101047
|
+
}
|
|
101048
|
+
var lx = prefixedProperty(_p.rscratch, "labelX", prefix);
|
|
101049
|
+
var ly = prefixedProperty(_p.rscratch, "labelY", prefix);
|
|
101050
|
+
var theta = prefixedProperty(_p.rscratch, "labelAngle", prefix);
|
|
101051
|
+
var ox = ele.pstyle(prefixDash + "text-margin-x").pfValue;
|
|
101052
|
+
var oy = ele.pstyle(prefixDash + "text-margin-y").pfValue;
|
|
101053
|
+
return getRotatedLabelBox$1(bb, lx, ly, theta, ox, oy, 0);
|
|
101054
|
+
};
|
|
100925
101055
|
var updateBoundsFromArrow = function updateBoundsFromArrow(bounds, ele, prefix) {
|
|
100926
101056
|
if (ele.cy().headless()) {
|
|
100927
101057
|
return;
|
|
100928
101058
|
}
|
|
100929
101059
|
var _p = ele._private;
|
|
100930
101060
|
var rstyle = _p.rstyle;
|
|
100931
|
-
var
|
|
101061
|
+
var arW = rstyle.arrowWidths != null && rstyle.arrowWidths[prefix] != null ? rstyle.arrowWidths[prefix] : rstyle.arrowWidth;
|
|
101062
|
+
var halfArW = arW / 2;
|
|
100932
101063
|
var arrowType = ele.pstyle(prefix + "-arrow-shape").value;
|
|
100933
101064
|
var x;
|
|
100934
101065
|
var y;
|
|
@@ -101420,6 +101551,17 @@ var cachedBoundingBoxImpl = function cachedBoundingBoxImpl(ele, opts) {
|
|
|
101420
101551
|
}
|
|
101421
101552
|
return bb;
|
|
101422
101553
|
};
|
|
101554
|
+
var getLabelPolygonPosKey = function getLabelPolygonPosKey(ele) {
|
|
101555
|
+
var angle = ele.pstyle("text-rotation").pfValue || 0;
|
|
101556
|
+
if (ele.isEdge()) {
|
|
101557
|
+
var p1 = ele.source().position();
|
|
101558
|
+
var p2 = ele.target().position();
|
|
101559
|
+
return hashIntsArray([Math.round(p1.x), Math.round(p1.y), Math.round(p2.x), Math.round(p2.y), Math.round(angle * 1000)]);
|
|
101560
|
+
} else {
|
|
101561
|
+
var pos = ele.position();
|
|
101562
|
+
return hashIntsArray([Math.round(pos.x), Math.round(pos.y), Math.round(angle * 1000)]);
|
|
101563
|
+
}
|
|
101564
|
+
};
|
|
101423
101565
|
var defBbOpts = {
|
|
101424
101566
|
includeNodes: true,
|
|
101425
101567
|
includeEdges: true,
|
|
@@ -101497,6 +101639,8 @@ elesfn$b.dirtyBoundingBoxCache = function() {
|
|
|
101497
101639
|
_p.arrowBounds.target = null;
|
|
101498
101640
|
_p.arrowBounds["mid-source"] = null;
|
|
101499
101641
|
_p.arrowBounds["mid-target"] = null;
|
|
101642
|
+
_p.labelPolygonCache = {};
|
|
101643
|
+
_p.labelPolygonPosKey = null;
|
|
101500
101644
|
}
|
|
101501
101645
|
this.emitAndNotify("bounds");
|
|
101502
101646
|
return this;
|
|
@@ -102397,6 +102541,120 @@ var elesfn$8 = {
|
|
|
102397
102541
|
value: min,
|
|
102398
102542
|
ele: minEle
|
|
102399
102543
|
};
|
|
102544
|
+
},
|
|
102545
|
+
withinBox: function withinBox(box) {
|
|
102546
|
+
var cy = this.cy();
|
|
102547
|
+
var r = cy.renderer();
|
|
102548
|
+
if (cy.styleEnabled()) {
|
|
102549
|
+
this.recalculateRenderedStyle();
|
|
102550
|
+
}
|
|
102551
|
+
var x2 = box.x2 != null ? box.x2 : box.x1 + box.w;
|
|
102552
|
+
var y2 = box.y2 != null ? box.y2 : box.y1 + box.h;
|
|
102553
|
+
var bb = makeBoundingBox({
|
|
102554
|
+
x1: Math.min(box.x1, x2),
|
|
102555
|
+
x2: Math.max(box.x1, x2),
|
|
102556
|
+
y1: Math.min(box.y1, y2),
|
|
102557
|
+
y2: Math.max(box.y1, y2)
|
|
102558
|
+
});
|
|
102559
|
+
var allInBox = r.getAllInBox(bb.x1, bb.y1, bb.x2, bb.y2);
|
|
102560
|
+
var col = this;
|
|
102561
|
+
return this.spawn(allInBox.filter(function(ele) {
|
|
102562
|
+
return col.has(ele);
|
|
102563
|
+
}));
|
|
102564
|
+
},
|
|
102565
|
+
hit: function hit(pos, options) {
|
|
102566
|
+
var cy = this.cy();
|
|
102567
|
+
var r = cy.renderer();
|
|
102568
|
+
if (cy.styleEnabled()) {
|
|
102569
|
+
this.recalculateRenderedStyle();
|
|
102570
|
+
}
|
|
102571
|
+
return this.spawn(r.hitTestAt(pos.x, pos.y, this, options));
|
|
102572
|
+
},
|
|
102573
|
+
polygonIntersection: function polygonIntersection(polygon) {
|
|
102574
|
+
var eles = this;
|
|
102575
|
+
var cy = eles.cy();
|
|
102576
|
+
if (cy.styleEnabled()) {
|
|
102577
|
+
this.recalculateRenderedStyle();
|
|
102578
|
+
}
|
|
102579
|
+
var matches = [];
|
|
102580
|
+
for (var i = 0;i < eles.length; i++) {
|
|
102581
|
+
var ele = eles[i];
|
|
102582
|
+
ele.boundingBox();
|
|
102583
|
+
if (ele.isEdge()) {
|
|
102584
|
+
var rs = ele._private.rscratch;
|
|
102585
|
+
var rstyle = ele._private.rstyle;
|
|
102586
|
+
var pts = rstyle.bezierPts || rstyle.linePts || rstyle.haystackPts;
|
|
102587
|
+
if (rstyle.bezierPts && rs.allpts && rs.allpts.length >= 6) {
|
|
102588
|
+
var spans = (rs.allpts.length - 2) / 4;
|
|
102589
|
+
var samplesPerSpan = rstyle.bezierPts.length / spans;
|
|
102590
|
+
pts = [{
|
|
102591
|
+
x: rs.allpts[0],
|
|
102592
|
+
y: rs.allpts[1]
|
|
102593
|
+
}];
|
|
102594
|
+
for (var k = 0;k < spans; k++) {
|
|
102595
|
+
for (var j = 0;j < samplesPerSpan; j++) {
|
|
102596
|
+
pts.push(rstyle.bezierPts[k * samplesPerSpan + j]);
|
|
102597
|
+
}
|
|
102598
|
+
pts.push({
|
|
102599
|
+
x: rs.allpts[k * 4 + 4],
|
|
102600
|
+
y: rs.allpts[k * 4 + 5]
|
|
102601
|
+
});
|
|
102602
|
+
}
|
|
102603
|
+
}
|
|
102604
|
+
if ((!pts || pts.length < 2) && rs.startX != null && rs.startY != null && rs.endX != null && rs.endY != null) {
|
|
102605
|
+
pts = [{
|
|
102606
|
+
x: rs.startX,
|
|
102607
|
+
y: rs.startY
|
|
102608
|
+
}, {
|
|
102609
|
+
x: rs.endX,
|
|
102610
|
+
y: rs.endY
|
|
102611
|
+
}];
|
|
102612
|
+
}
|
|
102613
|
+
if (pts && pts.length > 1) {
|
|
102614
|
+
var bodyMatched = false;
|
|
102615
|
+
for (var _k = 0;_k < pts.length - 1 && !bodyMatched; _k++) {
|
|
102616
|
+
if (segmentIntersectsPolygon(pts[_k], pts[_k + 1], polygon)) {
|
|
102617
|
+
matches.push(ele);
|
|
102618
|
+
bodyMatched = true;
|
|
102619
|
+
}
|
|
102620
|
+
}
|
|
102621
|
+
if (bodyMatched) {
|
|
102622
|
+
continue;
|
|
102623
|
+
}
|
|
102624
|
+
}
|
|
102625
|
+
} else {
|
|
102626
|
+
var bb = ele._private.bodyBounds;
|
|
102627
|
+
if (bb) {
|
|
102628
|
+
var bodyPoly = [{
|
|
102629
|
+
x: bb.x1,
|
|
102630
|
+
y: bb.y1
|
|
102631
|
+
}, {
|
|
102632
|
+
x: bb.x2,
|
|
102633
|
+
y: bb.y1
|
|
102634
|
+
}, {
|
|
102635
|
+
x: bb.x2,
|
|
102636
|
+
y: bb.y2
|
|
102637
|
+
}, {
|
|
102638
|
+
x: bb.x1,
|
|
102639
|
+
y: bb.y2
|
|
102640
|
+
}];
|
|
102641
|
+
if (satPolygonIntersection(bodyPoly, polygon)) {
|
|
102642
|
+
matches.push(ele);
|
|
102643
|
+
continue;
|
|
102644
|
+
}
|
|
102645
|
+
}
|
|
102646
|
+
}
|
|
102647
|
+
var labels = ele.isEdge() ? ["main", "source", "target"] : ["main"];
|
|
102648
|
+
var labelMatched = false;
|
|
102649
|
+
for (var _j = 0;_j < labels.length && !labelMatched; _j++) {
|
|
102650
|
+
var labelPoly = getLabelPolygon(ele, labels[_j]);
|
|
102651
|
+
if (labelPoly && labelPoly.length && satPolygonIntersection(labelPoly, polygon)) {
|
|
102652
|
+
matches.push(ele);
|
|
102653
|
+
labelMatched = true;
|
|
102654
|
+
}
|
|
102655
|
+
}
|
|
102656
|
+
}
|
|
102657
|
+
return this.spawn(matches);
|
|
102400
102658
|
}
|
|
102401
102659
|
};
|
|
102402
102660
|
var fn$1 = elesfn$8;
|
|
@@ -103971,7 +104229,7 @@ elesfn$1.remove = function() {
|
|
|
103971
104229
|
var removeFromPool = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
103972
104230
|
var self2 = this;
|
|
103973
104231
|
var elesToRemove = [];
|
|
103974
|
-
var elesToRemoveIds =
|
|
104232
|
+
var elesToRemoveIds = new Set$1;
|
|
103975
104233
|
var cy = self2._private.cy;
|
|
103976
104234
|
function addConnectedEdges(node) {
|
|
103977
104235
|
var edges = node._private.edges;
|
|
@@ -103986,11 +104244,11 @@ elesfn$1.remove = function() {
|
|
|
103986
104244
|
}
|
|
103987
104245
|
}
|
|
103988
104246
|
function add(ele) {
|
|
103989
|
-
var alreadyAdded = elesToRemoveIds
|
|
104247
|
+
var alreadyAdded = elesToRemoveIds.has(ele.id());
|
|
103990
104248
|
if (removeFromPool && ele.removed() || alreadyAdded) {
|
|
103991
104249
|
return;
|
|
103992
104250
|
} else {
|
|
103993
|
-
elesToRemoveIds
|
|
104251
|
+
elesToRemoveIds.add(ele.id());
|
|
103994
104252
|
}
|
|
103995
104253
|
if (ele.isNode()) {
|
|
103996
104254
|
elesToRemove.push(ele);
|
|
@@ -104013,7 +104271,7 @@ elesfn$1.remove = function() {
|
|
|
104013
104271
|
pllEdge.clearTraversalCache();
|
|
104014
104272
|
}
|
|
104015
104273
|
var alteredParents = [];
|
|
104016
|
-
alteredParents.ids =
|
|
104274
|
+
alteredParents.ids = new Set$1;
|
|
104017
104275
|
function removeChildRef(parent, ele) {
|
|
104018
104276
|
ele = ele[0];
|
|
104019
104277
|
parent = parent[0];
|
|
@@ -104021,8 +104279,8 @@ elesfn$1.remove = function() {
|
|
|
104021
104279
|
var pid = parent.id();
|
|
104022
104280
|
removeFromArray(children, ele);
|
|
104023
104281
|
ele._private.parent = null;
|
|
104024
|
-
if (!alteredParents.ids
|
|
104025
|
-
alteredParents.ids
|
|
104282
|
+
if (!alteredParents.ids.has(pid)) {
|
|
104283
|
+
alteredParents.ids.add(pid);
|
|
104026
104284
|
alteredParents.push(parent);
|
|
104027
104285
|
}
|
|
104028
104286
|
}
|
|
@@ -104190,9 +104448,23 @@ var corefn$9 = {
|
|
|
104190
104448
|
return collection.remove();
|
|
104191
104449
|
}
|
|
104192
104450
|
};
|
|
104193
|
-
/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License
|
|
104451
|
+
/*! Bezier curve function generator. Copyright 2014-2026 Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License
|
|
104452
|
+
* https://github.com/gre/bezier-easing */
|
|
104453
|
+
var cbrt = Math.cbrt || function(x) {
|
|
104454
|
+
return x < 0 ? -Math.pow(-x, 1 / 3) : Math.pow(x, 1 / 3);
|
|
104455
|
+
};
|
|
104456
|
+
function solveTForX(x, a, b, c) {
|
|
104457
|
+
var j = 1 / Math.max(c, Math.sqrt(x)), k = x * j, l = k * j, s = c * j, q = b * l, m = s * s + q, h = -s * (s * s + 1.5 * q) - a * k * l, D = h * h - m * m * m, v;
|
|
104458
|
+
if (m === 0 || D > 0.000000000001 * h * h) {
|
|
104459
|
+
var U = -cbrt(h < 0 ? h - Math.sqrt(D) : h + Math.sqrt(D));
|
|
104460
|
+
v = U + m / U || 0;
|
|
104461
|
+
} else {
|
|
104462
|
+
var r = Math.sqrt(m);
|
|
104463
|
+
v = 2 * r * Math.cos(Math.acos(Math.max(-1, Math.min(1, -h / (m * r)))) / 3);
|
|
104464
|
+
}
|
|
104465
|
+
return Math.min(1, k / (v + s));
|
|
104466
|
+
}
|
|
104194
104467
|
function generateCubicBezier(mX1, mY1, mX2, mY2) {
|
|
104195
|
-
var NEWTON_ITERATIONS = 4, NEWTON_MIN_SLOPE = 0.001, SUBDIVISION_PRECISION = 0.0000001, SUBDIVISION_MAX_ITERATIONS = 10, kSplineTableSize = 11, kSampleStepSize = 1 / (kSplineTableSize - 1), float32ArraySupported = typeof Float32Array !== "undefined";
|
|
104196
104468
|
if (arguments.length !== 4) {
|
|
104197
104469
|
return false;
|
|
104198
104470
|
}
|
|
@@ -104205,87 +104477,19 @@ function generateCubicBezier(mX1, mY1, mX2, mY2) {
|
|
|
104205
104477
|
mX2 = Math.min(mX2, 1);
|
|
104206
104478
|
mX1 = Math.max(mX1, 0);
|
|
104207
104479
|
mX2 = Math.max(mX2, 0);
|
|
104208
|
-
var
|
|
104209
|
-
function A(aA1, aA2) {
|
|
104210
|
-
return 1 - 3 * aA2 + 3 * aA1;
|
|
104211
|
-
}
|
|
104212
|
-
function B(aA1, aA2) {
|
|
104213
|
-
return 3 * aA2 - 6 * aA1;
|
|
104214
|
-
}
|
|
104215
|
-
function C(aA1) {
|
|
104216
|
-
return 3 * aA1;
|
|
104217
|
-
}
|
|
104218
|
-
function calcBezier(aT, aA1, aA2) {
|
|
104219
|
-
return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;
|
|
104220
|
-
}
|
|
104221
|
-
function getSlope(aT, aA1, aA2) {
|
|
104222
|
-
return 3 * A(aA1, aA2) * aT * aT + 2 * B(aA1, aA2) * aT + C(aA1);
|
|
104223
|
-
}
|
|
104224
|
-
function newtonRaphsonIterate(aX, aGuessT) {
|
|
104225
|
-
for (var _i = 0;_i < NEWTON_ITERATIONS; ++_i) {
|
|
104226
|
-
var currentSlope = getSlope(aGuessT, mX1, mX2);
|
|
104227
|
-
if (currentSlope === 0) {
|
|
104228
|
-
return aGuessT;
|
|
104229
|
-
}
|
|
104230
|
-
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
|
104231
|
-
aGuessT -= currentX / currentSlope;
|
|
104232
|
-
}
|
|
104233
|
-
return aGuessT;
|
|
104234
|
-
}
|
|
104235
|
-
function calcSampleValues() {
|
|
104236
|
-
for (var _i2 = 0;_i2 < kSplineTableSize; ++_i2) {
|
|
104237
|
-
mSampleValues[_i2] = calcBezier(_i2 * kSampleStepSize, mX1, mX2);
|
|
104238
|
-
}
|
|
104239
|
-
}
|
|
104240
|
-
function binarySubdivide(aX, aA, aB) {
|
|
104241
|
-
var currentX, currentT, i = 0;
|
|
104242
|
-
do {
|
|
104243
|
-
currentT = aA + (aB - aA) / 2;
|
|
104244
|
-
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
104245
|
-
if (currentX > 0) {
|
|
104246
|
-
aB = currentT;
|
|
104247
|
-
} else {
|
|
104248
|
-
aA = currentT;
|
|
104249
|
-
}
|
|
104250
|
-
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
|
104251
|
-
return currentT;
|
|
104252
|
-
}
|
|
104253
|
-
function getTForX(aX) {
|
|
104254
|
-
var intervalStart = 0, currentSample = 1, lastSample = kSplineTableSize - 1;
|
|
104255
|
-
for (;currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {
|
|
104256
|
-
intervalStart += kSampleStepSize;
|
|
104257
|
-
}
|
|
104258
|
-
--currentSample;
|
|
104259
|
-
var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]), guessForT = intervalStart + dist * kSampleStepSize, initialSlope = getSlope(guessForT, mX1, mX2);
|
|
104260
|
-
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
|
104261
|
-
return newtonRaphsonIterate(aX, guessForT);
|
|
104262
|
-
} else if (initialSlope === 0) {
|
|
104263
|
-
return guessForT;
|
|
104264
|
-
} else {
|
|
104265
|
-
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize);
|
|
104266
|
-
}
|
|
104267
|
-
}
|
|
104268
|
-
var _precomputed = false;
|
|
104269
|
-
function precompute() {
|
|
104270
|
-
_precomputed = true;
|
|
104271
|
-
if (mX1 !== mY1 || mX2 !== mY2) {
|
|
104272
|
-
calcSampleValues();
|
|
104273
|
-
}
|
|
104274
|
-
}
|
|
104480
|
+
var isLinear = mX1 === mY1 && mX2 === mY2, a = (3 * mX1 - 3 * mX2 + 1) / 2, b = mX2 - 2 * mX1, c = mX1, ay = 3 * mY1 - 3 * mY2 + 1, by = 3 * (mY2 - 2 * mY1), cy = 3 * mY1;
|
|
104275
104481
|
var f = function f(aX) {
|
|
104276
|
-
if (
|
|
104277
|
-
precompute();
|
|
104278
|
-
}
|
|
104279
|
-
if (mX1 === mY1 && mX2 === mY2) {
|
|
104482
|
+
if (isLinear) {
|
|
104280
104483
|
return aX;
|
|
104281
104484
|
}
|
|
104282
|
-
if (aX
|
|
104485
|
+
if (aX <= 0) {
|
|
104283
104486
|
return 0;
|
|
104284
104487
|
}
|
|
104285
|
-
if (aX
|
|
104488
|
+
if (aX >= 1) {
|
|
104286
104489
|
return 1;
|
|
104287
104490
|
}
|
|
104288
|
-
|
|
104491
|
+
var t = solveTForX(aX, a, b, c);
|
|
104492
|
+
return ((ay * t + by) * t + cy) * t;
|
|
104289
104493
|
};
|
|
104290
104494
|
f.getControlPoints = function() {
|
|
104291
104495
|
return [{
|
|
@@ -105434,12 +105638,12 @@ styfn$8.applyParsedProperty = function(ele, parsedProp) {
|
|
|
105434
105638
|
var b2 = prop.valueMax[2];
|
|
105435
105639
|
var a1 = prop.valueMin[3] == null ? 1 : prop.valueMin[3];
|
|
105436
105640
|
var a2 = prop.valueMax[3] == null ? 1 : prop.valueMax[3];
|
|
105437
|
-
var clr = [Math.round(r1 + (r2 - r1) * percent), Math.round(g1 + (g2 - g1) * percent), Math.round(b1 + (b2 - b1) * percent),
|
|
105641
|
+
var clr = [Math.round(r1 + (r2 - r1) * percent), Math.round(g1 + (g2 - g1) * percent), Math.round(b1 + (b2 - b1) * percent), a1 + (a2 - a1) * percent];
|
|
105438
105642
|
flatProp = {
|
|
105439
105643
|
bypass: prop.bypass,
|
|
105440
105644
|
name: prop.name,
|
|
105441
105645
|
value: clr,
|
|
105442
|
-
strValue: "
|
|
105646
|
+
strValue: "rgba(" + clr[0] + ", " + clr[1] + ", " + clr[2] + ", " + clr[3] + ")"
|
|
105443
105647
|
};
|
|
105444
105648
|
} else if (type.number) {
|
|
105445
105649
|
var calcValue = prop.valueMin + (prop.valueMax - prop.valueMin) * percent;
|
|
@@ -105750,7 +105954,7 @@ styfn$7.overrideBypass = function(eles, name, value) {
|
|
|
105750
105954
|
prop.pfValue = value;
|
|
105751
105955
|
}
|
|
105752
105956
|
if (isColor) {
|
|
105753
|
-
prop.strValue = "rgb(" + value
|
|
105957
|
+
prop.strValue = value[3] == null ? "rgb(" + value[0] + "," + value[1] + "," + value[2] + ")" : "rgba(" + value[0] + "," + value[1] + "," + value[2] + "," + value[3] + ")";
|
|
105754
105958
|
} else if (isMulti) {
|
|
105755
105959
|
prop.strValue = value.join(" ");
|
|
105756
105960
|
} else {
|
|
@@ -106084,6 +106288,16 @@ styfn$3.fromString = function(string) {
|
|
|
106084
106288
|
style.appendFromString(string);
|
|
106085
106289
|
return style;
|
|
106086
106290
|
};
|
|
106291
|
+
var arrowPrefixes = ["source", "mid-source", "target", "mid-target"];
|
|
106292
|
+
var getArrowScale = function getArrowScale(edge, prefix) {
|
|
106293
|
+
if (prefix != null) {
|
|
106294
|
+
var prefixed = edge.pstyle(prefix + "-arrow-scale");
|
|
106295
|
+
if (prefixed != null && prefixed.value !== "inherit") {
|
|
106296
|
+
return prefixed.value;
|
|
106297
|
+
}
|
|
106298
|
+
}
|
|
106299
|
+
return edge.pstyle("arrow-scale").value;
|
|
106300
|
+
};
|
|
106087
106301
|
var styfn$2 = {};
|
|
106088
106302
|
(function() {
|
|
106089
106303
|
var number$1 = number;
|
|
@@ -106174,6 +106388,13 @@ var styfn$2 = {};
|
|
|
106174
106388
|
min: 0,
|
|
106175
106389
|
strictMin: true
|
|
106176
106390
|
},
|
|
106391
|
+
arrowScale: {
|
|
106392
|
+
number: true,
|
|
106393
|
+
unitless: true,
|
|
106394
|
+
min: 0,
|
|
106395
|
+
strictMin: true,
|
|
106396
|
+
enums: ["inherit"]
|
|
106397
|
+
},
|
|
106177
106398
|
size: {
|
|
106178
106399
|
number: true,
|
|
106179
106400
|
min: 0
|
|
@@ -106712,6 +106933,18 @@ var styfn$2 = {};
|
|
|
106712
106933
|
}, {
|
|
106713
106934
|
name: "overlay-color",
|
|
106714
106935
|
type: t.color
|
|
106936
|
+
}, {
|
|
106937
|
+
name: "overlay-fill",
|
|
106938
|
+
type: t.fill
|
|
106939
|
+
}, {
|
|
106940
|
+
name: "overlay-gradient-stop-colors",
|
|
106941
|
+
type: t.colors
|
|
106942
|
+
}, {
|
|
106943
|
+
name: "overlay-gradient-stop-positions",
|
|
106944
|
+
type: t.percentages
|
|
106945
|
+
}, {
|
|
106946
|
+
name: "overlay-gradient-direction",
|
|
106947
|
+
type: t.gradientDirection
|
|
106715
106948
|
}, {
|
|
106716
106949
|
name: "overlay-opacity",
|
|
106717
106950
|
type: t.zeroOneNumber,
|
|
@@ -106731,6 +106964,18 @@ var styfn$2 = {};
|
|
|
106731
106964
|
}, {
|
|
106732
106965
|
name: "underlay-color",
|
|
106733
106966
|
type: t.color
|
|
106967
|
+
}, {
|
|
106968
|
+
name: "underlay-fill",
|
|
106969
|
+
type: t.fill
|
|
106970
|
+
}, {
|
|
106971
|
+
name: "underlay-gradient-stop-colors",
|
|
106972
|
+
type: t.colors
|
|
106973
|
+
}, {
|
|
106974
|
+
name: "underlay-gradient-stop-positions",
|
|
106975
|
+
type: t.percentages
|
|
106976
|
+
}, {
|
|
106977
|
+
name: "underlay-gradient-direction",
|
|
106978
|
+
type: t.gradientDirection
|
|
106734
106979
|
}, {
|
|
106735
106980
|
name: "underlay-opacity",
|
|
106736
106981
|
type: t.zeroOneNumber,
|
|
@@ -107168,7 +107413,7 @@ var styfn$2 = {};
|
|
|
107168
107413
|
});
|
|
107169
107414
|
}
|
|
107170
107415
|
var edgeArrow = [];
|
|
107171
|
-
|
|
107416
|
+
styfn$2.arrowPrefixes = arrowPrefixes;
|
|
107172
107417
|
[{
|
|
107173
107418
|
name: "arrow-shape",
|
|
107174
107419
|
type: t.arrowShape,
|
|
@@ -107182,6 +107427,10 @@ var styfn$2 = {};
|
|
|
107182
107427
|
}, {
|
|
107183
107428
|
name: "arrow-width",
|
|
107184
107429
|
type: t.arrowWidth
|
|
107430
|
+
}, {
|
|
107431
|
+
name: "arrow-scale",
|
|
107432
|
+
type: t.arrowScale,
|
|
107433
|
+
triggersBounds: diff.any
|
|
107185
107434
|
}].forEach(function(prop) {
|
|
107186
107435
|
arrowPrefixes.forEach(function(prefix) {
|
|
107187
107436
|
var name = prefix + "-" + prop.name;
|
|
@@ -107350,11 +107599,19 @@ styfn$2.getDefaultProperties = function() {
|
|
|
107350
107599
|
"target-text-margin-y": 0,
|
|
107351
107600
|
"overlay-opacity": 0,
|
|
107352
107601
|
"overlay-color": "#000",
|
|
107602
|
+
"overlay-fill": "solid",
|
|
107603
|
+
"overlay-gradient-stop-colors": "#999",
|
|
107604
|
+
"overlay-gradient-stop-positions": "0%",
|
|
107605
|
+
"overlay-gradient-direction": "to-bottom",
|
|
107353
107606
|
"overlay-padding": 10,
|
|
107354
107607
|
"overlay-shape": "round-rectangle",
|
|
107355
107608
|
"overlay-corner-radius": "auto",
|
|
107356
107609
|
"underlay-opacity": 0,
|
|
107357
107610
|
"underlay-color": "#000",
|
|
107611
|
+
"underlay-fill": "solid",
|
|
107612
|
+
"underlay-gradient-stop-colors": "#999",
|
|
107613
|
+
"underlay-gradient-stop-positions": "0%",
|
|
107614
|
+
"underlay-gradient-direction": "to-bottom",
|
|
107358
107615
|
"underlay-padding": 10,
|
|
107359
107616
|
"underlay-shape": "round-rectangle",
|
|
107360
107617
|
"underlay-corner-radius": "auto",
|
|
@@ -107504,6 +107761,9 @@ styfn$2.getDefaultProperties = function() {
|
|
|
107504
107761
|
}, {
|
|
107505
107762
|
name: "arrow-width",
|
|
107506
107763
|
value: 1
|
|
107764
|
+
}, {
|
|
107765
|
+
name: "arrow-scale",
|
|
107766
|
+
value: "inherit"
|
|
107507
107767
|
}].reduce(function(css, prop) {
|
|
107508
107768
|
styfn$2.arrowPrefixes.forEach(function(prefix) {
|
|
107509
107769
|
var name = prefix + "-" + prop.name;
|
|
@@ -107848,7 +108108,7 @@ styfn$1.parseImpl = function(name, value, propIsBypass, propIsFlat) {
|
|
|
107848
108108
|
name,
|
|
107849
108109
|
value: tuple,
|
|
107850
108110
|
pfValue: tuple,
|
|
107851
|
-
strValue: "rgb(" + tuple[0] + "," + tuple[1] + "," + tuple[2] + ")",
|
|
108111
|
+
strValue: tuple[3] == null ? "rgb(" + tuple[0] + "," + tuple[1] + "," + tuple[2] + ")" : "rgba(" + tuple[0] + "," + tuple[1] + "," + tuple[2] + "," + tuple[3] + ")",
|
|
107852
108112
|
bypass: propIsBypass
|
|
107853
108113
|
};
|
|
107854
108114
|
} else if (type.regex || type.regexes) {
|
|
@@ -109538,12 +109798,8 @@ function CoseLayout(options) {
|
|
|
109538
109798
|
var notEdges = edges.filter(function(e) {
|
|
109539
109799
|
var sourceId = e.source().data("id");
|
|
109540
109800
|
var targetId = e.target().data("id");
|
|
109541
|
-
var hasSource = nodes.
|
|
109542
|
-
|
|
109543
|
-
});
|
|
109544
|
-
var hasTarget = nodes.some(function(n) {
|
|
109545
|
-
return n.data("id") === targetId;
|
|
109546
|
-
});
|
|
109801
|
+
var hasSource = nodes.hasElementWithId(sourceId);
|
|
109802
|
+
var hasTarget = nodes.hasElementWithId(targetId);
|
|
109547
109803
|
return !hasSource || !hasTarget;
|
|
109548
109804
|
});
|
|
109549
109805
|
this.options.eles = this.options.eles.not(notEdges);
|
|
@@ -110589,6 +110845,12 @@ NullRenderer.prototype = {
|
|
|
110589
110845
|
isHeadless: function isHeadless() {
|
|
110590
110846
|
return true;
|
|
110591
110847
|
},
|
|
110848
|
+
getAllInBox: function getAllInBox() {
|
|
110849
|
+
return [];
|
|
110850
|
+
},
|
|
110851
|
+
hitTestAt: function hitTestAt() {
|
|
110852
|
+
return [];
|
|
110853
|
+
},
|
|
110592
110854
|
png: throwImgErr,
|
|
110593
110855
|
jpg: throwImgErr
|
|
110594
110856
|
};
|
|
@@ -110634,8 +110896,8 @@ BRp$f.registerArrowShapes = function() {
|
|
|
110634
110896
|
}
|
|
110635
110897
|
return ret;
|
|
110636
110898
|
};
|
|
110637
|
-
var standardGap = function standardGap(edge) {
|
|
110638
|
-
return edge.pstyle("width").pfValue * edge
|
|
110899
|
+
var standardGap = function standardGap(edge, prefix) {
|
|
110900
|
+
return edge.pstyle("width").pfValue * getArrowScale(edge, prefix) * 2;
|
|
110639
110901
|
};
|
|
110640
110902
|
var defineArrowShape = function defineArrowShape(name, defn) {
|
|
110641
110903
|
if (string(defn)) {
|
|
@@ -110654,7 +110916,7 @@ BRp$f.registerArrowShapes = function() {
|
|
|
110654
110916
|
var points = transformPoints(this.points, size, angle, translation);
|
|
110655
110917
|
renderer.arrowShapeImpl("polygon")(context, points);
|
|
110656
110918
|
},
|
|
110657
|
-
spacing: function spacing(edge) {
|
|
110919
|
+
spacing: function spacing(edge, prefix) {
|
|
110658
110920
|
return 0;
|
|
110659
110921
|
},
|
|
110660
110922
|
gap: standardGap
|
|
@@ -110681,8 +110943,8 @@ BRp$f.registerArrowShapes = function() {
|
|
|
110681
110943
|
var ctrlPtTrans = transform(ctrlPt[0], ctrlPt[1], size, angle, translation);
|
|
110682
110944
|
renderer.arrowShapeImpl(this.name)(context, ptsTrans, ctrlPtTrans);
|
|
110683
110945
|
},
|
|
110684
|
-
gap: function gap(edge) {
|
|
110685
|
-
return standardGap(edge) * 0.8;
|
|
110946
|
+
gap: function gap(edge, prefix) {
|
|
110947
|
+
return standardGap(edge, prefix) * 0.8;
|
|
110686
110948
|
}
|
|
110687
110949
|
});
|
|
110688
110950
|
defineArrowShape("triangle-tee", {
|
|
@@ -110713,8 +110975,8 @@ BRp$f.registerArrowShapes = function() {
|
|
|
110713
110975
|
var triPts = transformPoints(this.pointsTr, size, angle, translation);
|
|
110714
110976
|
renderer.arrowShapeImpl(this.name)(context, triPts, translation.x, translation.y, this.radius * size);
|
|
110715
110977
|
},
|
|
110716
|
-
spacing: function spacing(edge) {
|
|
110717
|
-
return renderer.getArrowWidth(edge.pstyle("width").pfValue, edge
|
|
110978
|
+
spacing: function spacing(edge, prefix) {
|
|
110979
|
+
return renderer.getArrowWidth(edge.pstyle("width").pfValue, getArrowScale(edge, prefix)) * this.radius;
|
|
110718
110980
|
}
|
|
110719
110981
|
});
|
|
110720
110982
|
defineArrowShape("triangle-cross", {
|
|
@@ -110752,8 +111014,8 @@ BRp$f.registerArrowShapes = function() {
|
|
|
110752
111014
|
});
|
|
110753
111015
|
defineArrowShape("vee", {
|
|
110754
111016
|
points: [-0.15, -0.3, 0, 0, 0.15, -0.3, 0, -0.15],
|
|
110755
|
-
gap: function gap(edge) {
|
|
110756
|
-
return standardGap(edge) * 0.525;
|
|
111017
|
+
gap: function gap(edge, prefix) {
|
|
111018
|
+
return standardGap(edge, prefix) * 0.525;
|
|
110757
111019
|
}
|
|
110758
111020
|
});
|
|
110759
111021
|
defineArrowShape("circle", {
|
|
@@ -110766,16 +111028,16 @@ BRp$f.registerArrowShapes = function() {
|
|
|
110766
111028
|
draw: function draw(context, size, angle, translation, edgeWidth) {
|
|
110767
111029
|
renderer.arrowShapeImpl(this.name)(context, translation.x, translation.y, this.radius * size);
|
|
110768
111030
|
},
|
|
110769
|
-
spacing: function spacing(edge) {
|
|
110770
|
-
return renderer.getArrowWidth(edge.pstyle("width").pfValue, edge
|
|
111031
|
+
spacing: function spacing(edge, prefix) {
|
|
111032
|
+
return renderer.getArrowWidth(edge.pstyle("width").pfValue, getArrowScale(edge, prefix)) * this.radius;
|
|
110771
111033
|
}
|
|
110772
111034
|
});
|
|
110773
111035
|
defineArrowShape("tee", {
|
|
110774
111036
|
points: [-0.15, 0, -0.15, -0.1, 0.15, -0.1, 0.15, 0],
|
|
110775
|
-
spacing: function spacing(edge) {
|
|
111037
|
+
spacing: function spacing(edge, prefix) {
|
|
110776
111038
|
return 1;
|
|
110777
111039
|
},
|
|
110778
|
-
gap: function gap(edge) {
|
|
111040
|
+
gap: function gap(edge, prefix) {
|
|
110779
111041
|
return 1;
|
|
110780
111042
|
}
|
|
110781
111043
|
});
|
|
@@ -110784,14 +111046,14 @@ BRp$f.registerArrowShapes = function() {
|
|
|
110784
111046
|
});
|
|
110785
111047
|
defineArrowShape("diamond", {
|
|
110786
111048
|
points: [-0.15, -0.15, 0, -0.3, 0.15, -0.15, 0, 0],
|
|
110787
|
-
gap: function gap(edge) {
|
|
110788
|
-
return edge.pstyle("width").pfValue * edge
|
|
111049
|
+
gap: function gap(edge, prefix) {
|
|
111050
|
+
return edge.pstyle("width").pfValue * getArrowScale(edge, prefix);
|
|
110789
111051
|
}
|
|
110790
111052
|
});
|
|
110791
111053
|
defineArrowShape("chevron", {
|
|
110792
111054
|
points: [0, 0, -0.15, -0.15, -0.1, -0.2, 0, -0.1, 0.1, -0.2, 0.15, -0.15],
|
|
110793
|
-
gap: function gap(edge) {
|
|
110794
|
-
return 0.95 * edge.pstyle("width").pfValue * edge
|
|
111055
|
+
gap: function gap(edge, prefix) {
|
|
111056
|
+
return 0.95 * edge.pstyle("width").pfValue * getArrowScale(edge, prefix);
|
|
110795
111057
|
}
|
|
110796
111058
|
});
|
|
110797
111059
|
};
|
|
@@ -110845,6 +111107,169 @@ BRp$e.findContainerClientCoords = function() {
|
|
|
110845
111107
|
BRp$e.invalidateContainerClientCoordsCache = function() {
|
|
110846
111108
|
this.containerBB = null;
|
|
110847
111109
|
};
|
|
111110
|
+
BRp$e.getLabelHitPolygon = function(ele, prefix, th) {
|
|
111111
|
+
var _p = ele._private;
|
|
111112
|
+
var prefixDash = prefix ? prefix + "-" : "";
|
|
111113
|
+
ele.boundingBox();
|
|
111114
|
+
var bb = _p.labelBounds[prefix || "main"];
|
|
111115
|
+
if (!bb) {
|
|
111116
|
+
return null;
|
|
111117
|
+
}
|
|
111118
|
+
var lx = getPrefixedProperty(_p.rscratch, "labelX", prefix);
|
|
111119
|
+
var ly = getPrefixedProperty(_p.rscratch, "labelY", prefix);
|
|
111120
|
+
var theta = getPrefixedProperty(_p.rscratch, "labelAngle", prefix);
|
|
111121
|
+
var ox = ele.pstyle(prefixDash + "text-margin-x").pfValue;
|
|
111122
|
+
var oy = ele.pstyle(prefixDash + "text-margin-y").pfValue;
|
|
111123
|
+
return getRotatedLabelBox$1(bb, lx, ly, theta, ox, oy, th);
|
|
111124
|
+
};
|
|
111125
|
+
BRp$e.checkLabelHitAt = function(ele, x, y, prefix, th) {
|
|
111126
|
+
var prefixDash = prefix ? prefix + "-" : "";
|
|
111127
|
+
var text = ele.pstyle(prefixDash + "label").value;
|
|
111128
|
+
var eventsEnabled = ele.pstyle("text-events").strValue === "yes";
|
|
111129
|
+
if (!eventsEnabled || !text) {
|
|
111130
|
+
return false;
|
|
111131
|
+
}
|
|
111132
|
+
var polygon = this.getLabelHitPolygon(ele, prefix, th);
|
|
111133
|
+
if (!polygon) {
|
|
111134
|
+
return false;
|
|
111135
|
+
}
|
|
111136
|
+
var points = [];
|
|
111137
|
+
for (var i = 0;i < polygon.length; i++) {
|
|
111138
|
+
points.push(polygon[i].x, polygon[i].y);
|
|
111139
|
+
}
|
|
111140
|
+
return pointInsidePolygonPoints(x, y, points);
|
|
111141
|
+
};
|
|
111142
|
+
BRp$e.checkNodeHitAt = function(node, x, y, threshold) {
|
|
111143
|
+
var r = this;
|
|
111144
|
+
var width = node.outerWidth() + 2 * threshold;
|
|
111145
|
+
var height = node.outerHeight() + 2 * threshold;
|
|
111146
|
+
var pos = node.position();
|
|
111147
|
+
if (pos.x - width / 2 <= x && x <= pos.x + width / 2 && pos.y - height / 2 <= y && y <= pos.y + height / 2) {
|
|
111148
|
+
var cornerRadius = node.pstyle("corner-radius").value === "auto" ? "auto" : node.pstyle("corner-radius").pfValue;
|
|
111149
|
+
var shape = r.nodeShapes[r.getNodeShape(node)];
|
|
111150
|
+
return shape.checkPoint(x, y, 0, width, height, pos.x, pos.y, cornerRadius, node._private.rscratch);
|
|
111151
|
+
}
|
|
111152
|
+
return false;
|
|
111153
|
+
};
|
|
111154
|
+
BRp$e.checkEdgeHitAt = function(edge, x, y, threshold) {
|
|
111155
|
+
var r = this;
|
|
111156
|
+
var _p = edge._private;
|
|
111157
|
+
var rs = _p.rscratch;
|
|
111158
|
+
var styleWidth = edge.pstyle("width").pfValue;
|
|
111159
|
+
var width = styleWidth / 2 + threshold;
|
|
111160
|
+
var widthSq = width * width;
|
|
111161
|
+
var width2 = width * 2;
|
|
111162
|
+
var sqDist;
|
|
111163
|
+
if (rs.edgeType === "segments" || rs.edgeType === "straight" || rs.edgeType === "haystack") {
|
|
111164
|
+
var linePts = rs.allpts;
|
|
111165
|
+
for (var i = 0;i + 3 < linePts.length; i += 2) {
|
|
111166
|
+
if (inLineVicinity(x, y, linePts[i], linePts[i + 1], linePts[i + 2], linePts[i + 3], width2) && widthSq > (sqDist = sqdistToFiniteLine(x, y, linePts[i], linePts[i + 1], linePts[i + 2], linePts[i + 3]))) {
|
|
111167
|
+
return {
|
|
111168
|
+
sqDist
|
|
111169
|
+
};
|
|
111170
|
+
}
|
|
111171
|
+
}
|
|
111172
|
+
} else if (rs.edgeType === "bezier" || rs.edgeType === "multibezier" || rs.edgeType === "self" || rs.edgeType === "compound") {
|
|
111173
|
+
var bezierPts = rs.allpts;
|
|
111174
|
+
for (var k = 0;k + 5 < bezierPts.length; k += 4) {
|
|
111175
|
+
if (inBezierVicinity(x, y, bezierPts[k], bezierPts[k + 1], bezierPts[k + 2], bezierPts[k + 3], bezierPts[k + 4], bezierPts[k + 5], width2) && widthSq > (sqDist = sqdistToQuadraticBezier(x, y, bezierPts[k], bezierPts[k + 1], bezierPts[k + 2], bezierPts[k + 3], bezierPts[k + 4], bezierPts[k + 5]))) {
|
|
111176
|
+
return {
|
|
111177
|
+
sqDist
|
|
111178
|
+
};
|
|
111179
|
+
}
|
|
111180
|
+
}
|
|
111181
|
+
}
|
|
111182
|
+
var arrows = [{
|
|
111183
|
+
name: "source",
|
|
111184
|
+
x: rs.arrowStartX,
|
|
111185
|
+
y: rs.arrowStartY,
|
|
111186
|
+
angle: rs.srcArrowAngle
|
|
111187
|
+
}, {
|
|
111188
|
+
name: "target",
|
|
111189
|
+
x: rs.arrowEndX,
|
|
111190
|
+
y: rs.arrowEndY,
|
|
111191
|
+
angle: rs.tgtArrowAngle
|
|
111192
|
+
}, {
|
|
111193
|
+
name: "mid-source",
|
|
111194
|
+
x: rs.midX,
|
|
111195
|
+
y: rs.midY,
|
|
111196
|
+
angle: rs.midsrcArrowAngle
|
|
111197
|
+
}, {
|
|
111198
|
+
name: "mid-target",
|
|
111199
|
+
x: rs.midX,
|
|
111200
|
+
y: rs.midY,
|
|
111201
|
+
angle: rs.midtgtArrowAngle
|
|
111202
|
+
}];
|
|
111203
|
+
for (var j = 0;j < arrows.length; j++) {
|
|
111204
|
+
var ar = arrows[j];
|
|
111205
|
+
var shape = r.arrowShapes[edge.pstyle(ar.name + "-arrow-shape").value];
|
|
111206
|
+
var edgeWidth = styleWidth;
|
|
111207
|
+
var arSize = r.getArrowWidth(styleWidth, getArrowScale(edge, ar.name));
|
|
111208
|
+
if (shape.roughCollide(x, y, arSize, ar.angle, {
|
|
111209
|
+
x: ar.x,
|
|
111210
|
+
y: ar.y
|
|
111211
|
+
}, edgeWidth, threshold) && shape.collide(x, y, arSize, ar.angle, {
|
|
111212
|
+
x: ar.x,
|
|
111213
|
+
y: ar.y
|
|
111214
|
+
}, edgeWidth, threshold)) {
|
|
111215
|
+
return {
|
|
111216
|
+
sqDist: null
|
|
111217
|
+
};
|
|
111218
|
+
}
|
|
111219
|
+
}
|
|
111220
|
+
return null;
|
|
111221
|
+
};
|
|
111222
|
+
BRp$e.hitTestAt = function(x, y, eles, options) {
|
|
111223
|
+
var r = this;
|
|
111224
|
+
var zoom = r.cy.zoom();
|
|
111225
|
+
var opts = options || {};
|
|
111226
|
+
var isTouch = opts.isTouch;
|
|
111227
|
+
var includeBody = opts.includeBody !== false;
|
|
111228
|
+
var includeMainLabels = opts.includeMainLabels !== false;
|
|
111229
|
+
var includeSourceLabels = opts.includeSourceLabels !== false;
|
|
111230
|
+
var includeTargetLabels = opts.includeTargetLabels !== false;
|
|
111231
|
+
var nodeThreshold = (isTouch ? 8 : 2) / zoom;
|
|
111232
|
+
var labelThreshold = (isTouch ? 8 : 2) / zoom;
|
|
111233
|
+
var edgeThreshold = (isTouch ? 24 : 8) / zoom;
|
|
111234
|
+
var eleIds = new Set;
|
|
111235
|
+
for (var i = 0;i < eles.length; i++) {
|
|
111236
|
+
eleIds.add(eles[i]._private.data.id);
|
|
111237
|
+
}
|
|
111238
|
+
var zSorted = r.getCachedZSortedEles().interactive;
|
|
111239
|
+
var matches = [];
|
|
111240
|
+
for (var j = zSorted.length - 1;j >= 0; j--) {
|
|
111241
|
+
var ele = zSorted[j];
|
|
111242
|
+
if (!eleIds.has(ele._private.data.id)) {
|
|
111243
|
+
continue;
|
|
111244
|
+
}
|
|
111245
|
+
var hit = false;
|
|
111246
|
+
if (ele.isNode()) {
|
|
111247
|
+
if (includeBody) {
|
|
111248
|
+
hit = r.checkNodeHitAt(ele, x, y, nodeThreshold);
|
|
111249
|
+
}
|
|
111250
|
+
if (!hit && includeMainLabels) {
|
|
111251
|
+
hit = r.checkLabelHitAt(ele, x, y, null, labelThreshold);
|
|
111252
|
+
}
|
|
111253
|
+
} else {
|
|
111254
|
+
if (includeBody) {
|
|
111255
|
+
hit = r.checkEdgeHitAt(ele, x, y, edgeThreshold) != null;
|
|
111256
|
+
}
|
|
111257
|
+
if (!hit && includeMainLabels) {
|
|
111258
|
+
hit = r.checkLabelHitAt(ele, x, y, null, labelThreshold);
|
|
111259
|
+
}
|
|
111260
|
+
if (!hit && includeSourceLabels) {
|
|
111261
|
+
hit = r.checkLabelHitAt(ele, x, y, "source", labelThreshold);
|
|
111262
|
+
}
|
|
111263
|
+
if (!hit && includeTargetLabels) {
|
|
111264
|
+
hit = r.checkLabelHitAt(ele, x, y, "target", labelThreshold);
|
|
111265
|
+
}
|
|
111266
|
+
}
|
|
111267
|
+
if (hit) {
|
|
111268
|
+
matches.push(ele);
|
|
111269
|
+
}
|
|
111270
|
+
}
|
|
111271
|
+
return matches;
|
|
111272
|
+
};
|
|
110848
111273
|
BRp$e.findNearestElement = function(x, y, interactiveElementsOnly, isTouch) {
|
|
110849
111274
|
return this.findNearestElements(x, y, interactiveElementsOnly, isTouch)[0];
|
|
110850
111275
|
};
|
|
@@ -110893,26 +111318,15 @@ BRp$e.findNearestElements = function(x, y, interactiveElementsOnly, isTouch) {
|
|
|
110893
111318
|
}
|
|
110894
111319
|
}
|
|
110895
111320
|
function checkNode(node) {
|
|
110896
|
-
|
|
110897
|
-
|
|
110898
|
-
|
|
110899
|
-
var hh = height / 2;
|
|
110900
|
-
var pos = node.position();
|
|
110901
|
-
var cornerRadius = node.pstyle("corner-radius").value === "auto" ? "auto" : node.pstyle("corner-radius").pfValue;
|
|
110902
|
-
var rs = node._private.rscratch;
|
|
110903
|
-
if (pos.x - hw <= x && x <= pos.x + hw && pos.y - hh <= y && y <= pos.y + hh) {
|
|
110904
|
-
var shape = r.nodeShapes[self2.getNodeShape(node)];
|
|
110905
|
-
if (shape.checkPoint(x, y, 0, width, height, pos.x, pos.y, cornerRadius, rs)) {
|
|
110906
|
-
addEle(node, 0);
|
|
110907
|
-
return true;
|
|
110908
|
-
}
|
|
111321
|
+
if (r.checkNodeHitAt(node, x, y, nodeThreshold)) {
|
|
111322
|
+
addEle(node, 0);
|
|
111323
|
+
return true;
|
|
110909
111324
|
}
|
|
110910
111325
|
}
|
|
110911
111326
|
function checkEdge(edge) {
|
|
110912
111327
|
var _p = edge._private;
|
|
110913
111328
|
var rs = _p.rscratch;
|
|
110914
111329
|
var styleWidth = edge.pstyle("width").pfValue;
|
|
110915
|
-
var scale = edge.pstyle("arrow-scale").value;
|
|
110916
111330
|
var width = styleWidth / 2 + edgeThreshold;
|
|
110917
111331
|
var widthSq = width * width;
|
|
110918
111332
|
var width2 = width * 2;
|
|
@@ -110938,7 +111352,6 @@ BRp$e.findNearestElements = function(x, y, interactiveElementsOnly, isTouch) {
|
|
|
110938
111352
|
}
|
|
110939
111353
|
var src = src || _p.source;
|
|
110940
111354
|
var tgt = tgt || _p.target;
|
|
110941
|
-
var arSize = self2.getArrowWidth(styleWidth, scale);
|
|
110942
111355
|
var arrows = [{
|
|
110943
111356
|
name: "source",
|
|
110944
111357
|
x: rs.arrowStartX,
|
|
@@ -110964,6 +111377,7 @@ BRp$e.findNearestElements = function(x, y, interactiveElementsOnly, isTouch) {
|
|
|
110964
111377
|
var ar = arrows[i];
|
|
110965
111378
|
var shape = r.arrowShapes[edge.pstyle(ar.name + "-arrow-shape").value];
|
|
110966
111379
|
var edgeWidth = edge.pstyle("width").pfValue;
|
|
111380
|
+
var arSize = self2.getArrowWidth(styleWidth, getArrowScale(edge, ar.name));
|
|
110967
111381
|
if (shape.roughCollide(x, y, arSize, ar.angle, {
|
|
110968
111382
|
x: ar.x,
|
|
110969
111383
|
y: ar.y
|
|
@@ -110980,68 +111394,10 @@ BRp$e.findNearestElements = function(x, y, interactiveElementsOnly, isTouch) {
|
|
|
110980
111394
|
checkNode(tgt);
|
|
110981
111395
|
}
|
|
110982
111396
|
}
|
|
110983
|
-
function preprop(obj, name, pre) {
|
|
110984
|
-
return getPrefixedProperty(obj, name, pre);
|
|
110985
|
-
}
|
|
110986
111397
|
function checkLabel(ele, prefix) {
|
|
110987
|
-
|
|
110988
|
-
|
|
110989
|
-
|
|
110990
|
-
if (prefix) {
|
|
110991
|
-
prefixDash = prefix + "-";
|
|
110992
|
-
} else {
|
|
110993
|
-
prefixDash = "";
|
|
110994
|
-
}
|
|
110995
|
-
ele.boundingBox();
|
|
110996
|
-
var bb = _p.labelBounds[prefix || "main"];
|
|
110997
|
-
var text = ele.pstyle(prefixDash + "label").value;
|
|
110998
|
-
var eventsEnabled = ele.pstyle("text-events").strValue === "yes";
|
|
110999
|
-
if (!eventsEnabled || !text) {
|
|
111000
|
-
return;
|
|
111001
|
-
}
|
|
111002
|
-
var lx = preprop(_p.rscratch, "labelX", prefix);
|
|
111003
|
-
var ly = preprop(_p.rscratch, "labelY", prefix);
|
|
111004
|
-
var theta = preprop(_p.rscratch, "labelAngle", prefix);
|
|
111005
|
-
var ox = ele.pstyle(prefixDash + "text-margin-x").pfValue;
|
|
111006
|
-
var oy = ele.pstyle(prefixDash + "text-margin-y").pfValue;
|
|
111007
|
-
var lx1 = bb.x1 - th - ox;
|
|
111008
|
-
var lx2 = bb.x2 + th - ox;
|
|
111009
|
-
var ly1 = bb.y1 - th - oy;
|
|
111010
|
-
var ly2 = bb.y2 + th - oy;
|
|
111011
|
-
if (theta) {
|
|
111012
|
-
var cos = Math.cos(theta);
|
|
111013
|
-
var sin = Math.sin(theta);
|
|
111014
|
-
var rotate = function rotate(x, y) {
|
|
111015
|
-
x = x - lx;
|
|
111016
|
-
y = y - ly;
|
|
111017
|
-
return {
|
|
111018
|
-
x: x * cos - y * sin + lx,
|
|
111019
|
-
y: x * sin + y * cos + ly
|
|
111020
|
-
};
|
|
111021
|
-
};
|
|
111022
|
-
var px1y1 = rotate(lx1, ly1);
|
|
111023
|
-
var px1y2 = rotate(lx1, ly2);
|
|
111024
|
-
var px2y1 = rotate(lx2, ly1);
|
|
111025
|
-
var px2y2 = rotate(lx2, ly2);
|
|
111026
|
-
var points = [
|
|
111027
|
-
px1y1.x + ox,
|
|
111028
|
-
px1y1.y + oy,
|
|
111029
|
-
px2y1.x + ox,
|
|
111030
|
-
px2y1.y + oy,
|
|
111031
|
-
px2y2.x + ox,
|
|
111032
|
-
px2y2.y + oy,
|
|
111033
|
-
px1y2.x + ox,
|
|
111034
|
-
px1y2.y + oy
|
|
111035
|
-
];
|
|
111036
|
-
if (pointInsidePolygonPoints(x, y, points)) {
|
|
111037
|
-
addEle(ele);
|
|
111038
|
-
return true;
|
|
111039
|
-
}
|
|
111040
|
-
} else {
|
|
111041
|
-
if (inBoundingBox(bb, x, y)) {
|
|
111042
|
-
addEle(ele);
|
|
111043
|
-
return true;
|
|
111044
|
-
}
|
|
111398
|
+
if (self2.checkLabelHitAt(ele, x, y, prefix, labelThreshold)) {
|
|
111399
|
+
addEle(ele);
|
|
111400
|
+
return true;
|
|
111045
111401
|
}
|
|
111046
111402
|
}
|
|
111047
111403
|
for (var i = eles.length - 1;i >= 0; i--) {
|
|
@@ -111055,6 +111411,7 @@ BRp$e.findNearestElements = function(x, y, interactiveElementsOnly, isTouch) {
|
|
|
111055
111411
|
return near;
|
|
111056
111412
|
};
|
|
111057
111413
|
BRp$e.getAllInBox = function(x1, y1, x2, y2) {
|
|
111414
|
+
var r = this;
|
|
111058
111415
|
var eles = this.getCachedZSortedEles().interactive;
|
|
111059
111416
|
var zoom = this.cy.zoom();
|
|
111060
111417
|
var labelThreshold = 2 / zoom;
|
|
@@ -111087,54 +111444,8 @@ BRp$e.getAllInBox = function(x1, y1, x2, y2) {
|
|
|
111087
111444
|
y: boxBb.y2
|
|
111088
111445
|
}];
|
|
111089
111446
|
var boxEdges = [[selectionBox[0], selectionBox[1]], [selectionBox[1], selectionBox[2]], [selectionBox[2], selectionBox[3]], [selectionBox[3], selectionBox[0]]];
|
|
111090
|
-
function preprop(obj, name, pre) {
|
|
111091
|
-
return getPrefixedProperty(obj, name, pre);
|
|
111092
|
-
}
|
|
111093
111447
|
function getRotatedLabelBox(ele, prefix) {
|
|
111094
|
-
|
|
111095
|
-
var th = labelThreshold;
|
|
111096
|
-
var prefixDash = "";
|
|
111097
|
-
ele.boundingBox();
|
|
111098
|
-
var bb = _p.labelBounds["main"];
|
|
111099
|
-
if (!bb) {
|
|
111100
|
-
return null;
|
|
111101
|
-
}
|
|
111102
|
-
var lx = preprop(_p.rscratch, "labelX", prefix);
|
|
111103
|
-
var ly = preprop(_p.rscratch, "labelY", prefix);
|
|
111104
|
-
var theta = preprop(_p.rscratch, "labelAngle", prefix);
|
|
111105
|
-
var ox = ele.pstyle(prefixDash + "text-margin-x").pfValue;
|
|
111106
|
-
var oy = ele.pstyle(prefixDash + "text-margin-y").pfValue;
|
|
111107
|
-
var lx1 = bb.x1 - th - ox;
|
|
111108
|
-
var lx2 = bb.x2 + th - ox;
|
|
111109
|
-
var ly1 = bb.y1 - th - oy;
|
|
111110
|
-
var ly2 = bb.y2 + th - oy;
|
|
111111
|
-
if (theta) {
|
|
111112
|
-
var cos = Math.cos(theta);
|
|
111113
|
-
var sin = Math.sin(theta);
|
|
111114
|
-
var rotate = function rotate(x, y) {
|
|
111115
|
-
x = x - lx;
|
|
111116
|
-
y = y - ly;
|
|
111117
|
-
return {
|
|
111118
|
-
x: x * cos - y * sin + lx,
|
|
111119
|
-
y: x * sin + y * cos + ly
|
|
111120
|
-
};
|
|
111121
|
-
};
|
|
111122
|
-
return [rotate(lx1, ly1), rotate(lx2, ly1), rotate(lx2, ly2), rotate(lx1, ly2)];
|
|
111123
|
-
} else {
|
|
111124
|
-
return [{
|
|
111125
|
-
x: lx1,
|
|
111126
|
-
y: ly1
|
|
111127
|
-
}, {
|
|
111128
|
-
x: lx2,
|
|
111129
|
-
y: ly1
|
|
111130
|
-
}, {
|
|
111131
|
-
x: lx2,
|
|
111132
|
-
y: ly2
|
|
111133
|
-
}, {
|
|
111134
|
-
x: lx1,
|
|
111135
|
-
y: ly2
|
|
111136
|
-
}];
|
|
111137
|
-
}
|
|
111448
|
+
return r.getLabelHitPolygon(ele, prefix, labelThreshold);
|
|
111138
111449
|
}
|
|
111139
111450
|
function doLinesIntersect(p1, p2, q1, q2) {
|
|
111140
111451
|
function ccw(a, b, c) {
|
|
@@ -111777,6 +112088,15 @@ BRp$c.findTaxiPoints = function(edge, pairInfo) {
|
|
|
111777
112088
|
};
|
|
111778
112089
|
var dx = subDWH(pdx, dw);
|
|
111779
112090
|
var dy = subDWH(pdy, dh);
|
|
112091
|
+
var midBetween = function midBetween(c1, c2, size1, size2) {
|
|
112092
|
+
if (!dIncludesNodeBody) {
|
|
112093
|
+
return (c1 + c2) / 2;
|
|
112094
|
+
}
|
|
112095
|
+
var sgn = signum(c2 - c1);
|
|
112096
|
+
var side1 = c1 + sgn * size1 / 2;
|
|
112097
|
+
var side2 = c2 - sgn * size2 / 2;
|
|
112098
|
+
return sgn * (side2 - side1) >= 0 ? (side1 + side2) / 2 : (c1 + c2) / 2;
|
|
112099
|
+
};
|
|
111780
112100
|
var isExplicitDir = false;
|
|
111781
112101
|
if (rawTaxiDir === AUTO) {
|
|
111782
112102
|
taxiDir = Math.abs(dx) > Math.abs(dy) ? HORIZONTAL : VERTICAL;
|
|
@@ -111816,11 +112136,11 @@ BRp$c.findTaxiPoints = function(edge, pairInfo) {
|
|
|
111816
112136
|
var lShapeInsideSrc = Math.abs(pl) <= srcH / 2;
|
|
111817
112137
|
var lShapeInsideTgt = Math.abs(pdx) <= tgtW / 2;
|
|
111818
112138
|
if (lShapeInsideSrc) {
|
|
111819
|
-
var x = (posPts.x1
|
|
112139
|
+
var x = midBetween(posPts.x1, posPts.x2, srcW, tgtW);
|
|
111820
112140
|
var { y1, y2 } = posPts;
|
|
111821
112141
|
rs.segpts = [x, y1, x, y2];
|
|
111822
112142
|
} else if (lShapeInsideTgt) {
|
|
111823
|
-
var y = (posPts.y1
|
|
112143
|
+
var y = midBetween(posPts.y1, posPts.y2, srcH, tgtH);
|
|
111824
112144
|
var { x1, x2 } = posPts;
|
|
111825
112145
|
rs.segpts = [x1, y, x2, y];
|
|
111826
112146
|
} else {
|
|
@@ -111830,11 +112150,11 @@ BRp$c.findTaxiPoints = function(edge, pairInfo) {
|
|
|
111830
112150
|
var _lShapeInsideSrc = Math.abs(pl) <= srcW / 2;
|
|
111831
112151
|
var _lShapeInsideTgt = Math.abs(pdy) <= tgtH / 2;
|
|
111832
112152
|
if (_lShapeInsideSrc) {
|
|
111833
|
-
var _y = (posPts.y1
|
|
112153
|
+
var _y = midBetween(posPts.y1, posPts.y2, srcH, tgtH);
|
|
111834
112154
|
var { x1: _x, x2: _x2 } = posPts;
|
|
111835
112155
|
rs.segpts = [_x, _y, _x2, _y];
|
|
111836
112156
|
} else if (_lShapeInsideTgt) {
|
|
111837
|
-
var _x3 = (posPts.x1
|
|
112157
|
+
var _x3 = midBetween(posPts.x1, posPts.x2, srcW, tgtW);
|
|
111838
112158
|
var { y1: _y2, y2: _y3 } = posPts;
|
|
111839
112159
|
rs.segpts = [_x3, _y2, _x3, _y3];
|
|
111840
112160
|
} else {
|
|
@@ -111868,8 +112188,9 @@ BRp$c.tryToCorrectInvalidPoints = function(edge, pairInfo) {
|
|
|
111868
112188
|
var badEnd = !number$1(rs.endX) || !number$1(rs.endY);
|
|
111869
112189
|
var badAEnd = !number$1(rs.arrowEndX) || !number$1(rs.arrowEndY);
|
|
111870
112190
|
var minCpADistFactor = 3;
|
|
111871
|
-
var
|
|
111872
|
-
var
|
|
112191
|
+
var edgeWidth = edge.pstyle("width").pfValue;
|
|
112192
|
+
var minCpASrcDist = minCpADistFactor * this.getArrowWidth(edgeWidth, getArrowScale(edge, "source")) * this.arrowShapeWidth;
|
|
112193
|
+
var minCpATgtDist = minCpADistFactor * this.getArrowWidth(edgeWidth, getArrowScale(edge, "target")) * this.arrowShapeWidth;
|
|
111873
112194
|
var startACpDist = dist({
|
|
111874
112195
|
x: rs.ctrlpts[0],
|
|
111875
112196
|
y: rs.ctrlpts[1]
|
|
@@ -111877,15 +112198,7 @@ BRp$c.tryToCorrectInvalidPoints = function(edge, pairInfo) {
|
|
|
111877
112198
|
x: rs.startX,
|
|
111878
112199
|
y: rs.startY
|
|
111879
112200
|
});
|
|
111880
|
-
var closeStartACp = startACpDist <
|
|
111881
|
-
var endACpDist = dist({
|
|
111882
|
-
x: rs.ctrlpts[0],
|
|
111883
|
-
y: rs.ctrlpts[1]
|
|
111884
|
-
}, {
|
|
111885
|
-
x: rs.endX,
|
|
111886
|
-
y: rs.endY
|
|
111887
|
-
});
|
|
111888
|
-
var closeEndACp = endACpDist < minCpADist;
|
|
112201
|
+
var closeStartACp = startACpDist < minCpASrcDist;
|
|
111889
112202
|
var overlapping = false;
|
|
111890
112203
|
if (badStart || badAStart || closeStartACp) {
|
|
111891
112204
|
overlapping = true;
|
|
@@ -111905,13 +112218,21 @@ BRp$c.tryToCorrectInvalidPoints = function(edge, pairInfo) {
|
|
|
111905
112218
|
};
|
|
111906
112219
|
var srcCtrlPtIntn = srcShape.intersectLine(srcPos.x, srcPos.y, srcW, srcH, cpProj.x, cpProj.y, 0, srcCornerRadius, srcRs);
|
|
111907
112220
|
if (closeStartACp) {
|
|
111908
|
-
rs.ctrlpts[0] = rs.ctrlpts[0] + cpM.x * (
|
|
111909
|
-
rs.ctrlpts[1] = rs.ctrlpts[1] + cpM.y * (
|
|
112221
|
+
rs.ctrlpts[0] = rs.ctrlpts[0] + cpM.x * (minCpASrcDist - startACpDist);
|
|
112222
|
+
rs.ctrlpts[1] = rs.ctrlpts[1] + cpM.y * (minCpASrcDist - startACpDist);
|
|
111910
112223
|
} else {
|
|
111911
|
-
rs.ctrlpts[0] = srcCtrlPtIntn[0] + cpM.x *
|
|
111912
|
-
rs.ctrlpts[1] = srcCtrlPtIntn[1] + cpM.y *
|
|
112224
|
+
rs.ctrlpts[0] = srcCtrlPtIntn[0] + cpM.x * minCpASrcDist;
|
|
112225
|
+
rs.ctrlpts[1] = srcCtrlPtIntn[1] + cpM.y * minCpASrcDist;
|
|
111913
112226
|
}
|
|
111914
112227
|
}
|
|
112228
|
+
var endACpDist = dist({
|
|
112229
|
+
x: rs.ctrlpts[0],
|
|
112230
|
+
y: rs.ctrlpts[1]
|
|
112231
|
+
}, {
|
|
112232
|
+
x: rs.endX,
|
|
112233
|
+
y: rs.endY
|
|
112234
|
+
});
|
|
112235
|
+
var closeEndACp = endACpDist < minCpATgtDist;
|
|
111915
112236
|
if (badEnd || badAEnd || closeEndACp) {
|
|
111916
112237
|
overlapping = true;
|
|
111917
112238
|
var _cpD = {
|
|
@@ -111930,11 +112251,11 @@ BRp$c.tryToCorrectInvalidPoints = function(edge, pairInfo) {
|
|
|
111930
112251
|
};
|
|
111931
112252
|
var tgtCtrlPtIntn = tgtShape.intersectLine(tgtPos.x, tgtPos.y, tgtW, tgtH, _cpProj.x, _cpProj.y, 0, tgtCornerRadius, tgtRs);
|
|
111932
112253
|
if (closeEndACp) {
|
|
111933
|
-
rs.ctrlpts[0] = rs.ctrlpts[0] + _cpM.x * (
|
|
111934
|
-
rs.ctrlpts[1] = rs.ctrlpts[1] + _cpM.y * (
|
|
112254
|
+
rs.ctrlpts[0] = rs.ctrlpts[0] + _cpM.x * (minCpATgtDist - endACpDist);
|
|
112255
|
+
rs.ctrlpts[1] = rs.ctrlpts[1] + _cpM.y * (minCpATgtDist - endACpDist);
|
|
111935
112256
|
} else {
|
|
111936
|
-
rs.ctrlpts[0] = tgtCtrlPtIntn[0] + _cpM.x *
|
|
111937
|
-
rs.ctrlpts[1] = tgtCtrlPtIntn[1] + _cpM.y *
|
|
112257
|
+
rs.ctrlpts[0] = tgtCtrlPtIntn[0] + _cpM.x * minCpATgtDist;
|
|
112258
|
+
rs.ctrlpts[1] = tgtCtrlPtIntn[1] + _cpM.y * minCpATgtDist;
|
|
111938
112259
|
}
|
|
111939
112260
|
}
|
|
111940
112261
|
if (overlapping) {
|
|
@@ -112436,8 +112757,8 @@ BRp$b.findEndpoints = function(edge) {
|
|
|
112436
112757
|
}
|
|
112437
112758
|
}
|
|
112438
112759
|
}
|
|
112439
|
-
var arrowEnd = shortenIntersection(intersect, p1, r.arrowShapes[tgtArShape].spacing(edge) + tgtDist);
|
|
112440
|
-
var edgeEnd = shortenIntersection(intersect, p1, r.arrowShapes[tgtArShape].gap(edge) + tgtDist);
|
|
112760
|
+
var arrowEnd = shortenIntersection(intersect, p1, r.arrowShapes[tgtArShape].spacing(edge, "target") + tgtDist);
|
|
112761
|
+
var edgeEnd = shortenIntersection(intersect, p1, r.arrowShapes[tgtArShape].gap(edge, "target") + tgtDist);
|
|
112441
112762
|
rs.endX = edgeEnd[0];
|
|
112442
112763
|
rs.endY = edgeEnd[1];
|
|
112443
112764
|
rs.arrowEndX = arrowEnd[0];
|
|
@@ -112499,8 +112820,8 @@ BRp$b.findEndpoints = function(edge) {
|
|
|
112499
112820
|
}
|
|
112500
112821
|
}
|
|
112501
112822
|
}
|
|
112502
|
-
var arrowStart = shortenIntersection(intersect, p2, r.arrowShapes[srcArShape].spacing(edge) + srcDist);
|
|
112503
|
-
var edgeStart = shortenIntersection(intersect, p2, r.arrowShapes[srcArShape].gap(edge) + srcDist);
|
|
112823
|
+
var arrowStart = shortenIntersection(intersect, p2, r.arrowShapes[srcArShape].spacing(edge, "source") + srcDist);
|
|
112824
|
+
var edgeStart = shortenIntersection(intersect, p2, r.arrowShapes[srcArShape].gap(edge, "source") + srcDist);
|
|
112504
112825
|
rs.startX = edgeStart[0];
|
|
112505
112826
|
rs.startY = edgeStart[1];
|
|
112506
112827
|
rs.arrowStartX = arrowStart[0];
|
|
@@ -112590,7 +112911,18 @@ BRp$a.storeEdgeProjections = function(edge) {
|
|
|
112590
112911
|
y: hpts[3]
|
|
112591
112912
|
}];
|
|
112592
112913
|
}
|
|
112593
|
-
|
|
112914
|
+
var edgeWidth = edge.pstyle("width").pfValue;
|
|
112915
|
+
var arrowWidths = _p.rstyle.arrowWidths = _p.rstyle.arrowWidths || {};
|
|
112916
|
+
var maxScale = 0;
|
|
112917
|
+
for (var _i = 0;_i < arrowPrefixes.length; _i++) {
|
|
112918
|
+
var prefix = arrowPrefixes[_i];
|
|
112919
|
+
var scale = getArrowScale(edge, prefix);
|
|
112920
|
+
arrowWidths[prefix] = this.getArrowWidth(edgeWidth, scale) * this.arrowShapeWidth;
|
|
112921
|
+
if (scale > maxScale) {
|
|
112922
|
+
maxScale = scale;
|
|
112923
|
+
}
|
|
112924
|
+
}
|
|
112925
|
+
_p.rstyle.arrowWidth = this.getArrowWidth(edgeWidth, maxScale) * this.arrowShapeWidth;
|
|
112594
112926
|
};
|
|
112595
112927
|
BRp$a.recalculateEdgeProjections = function(edges) {
|
|
112596
112928
|
this.findEdgeControlPoints(edges);
|
|
@@ -114122,6 +114454,11 @@ BRp$3.load = function() {
|
|
|
114122
114454
|
var wheelDeltaN = 4;
|
|
114123
114455
|
var inaccurateScrollDevice;
|
|
114124
114456
|
var inaccurateScrollFactor = 1e5;
|
|
114457
|
+
var sampledScrollFactor;
|
|
114458
|
+
var wheelFactorMaxReduction = 4;
|
|
114459
|
+
var wheelNotchMaxReduction = 8;
|
|
114460
|
+
var wheelSmallDeltaMax = 15;
|
|
114461
|
+
var unconfirmedMagnitude = null;
|
|
114125
114462
|
var allAreSameMagnitude = function allAreSameMagnitude(list) {
|
|
114126
114463
|
var firstMag = Math.abs(list[0]);
|
|
114127
114464
|
for (var i = 1;i < list.length; i++) {
|
|
@@ -114158,14 +114495,35 @@ BRp$3.load = function() {
|
|
|
114158
114495
|
if (factor > 1) {
|
|
114159
114496
|
inaccurateScrollDevice = true;
|
|
114160
114497
|
inaccurateScrollFactor = factor;
|
|
114498
|
+
sampledScrollFactor = factor;
|
|
114161
114499
|
}
|
|
114162
114500
|
}
|
|
114163
114501
|
} else {
|
|
114164
114502
|
wheelDeltas.push(Math.abs(delta));
|
|
114165
114503
|
clamp = true;
|
|
114166
114504
|
}
|
|
114167
|
-
}
|
|
114168
|
-
|
|
114505
|
+
}
|
|
114506
|
+
var isWheelNotch = false;
|
|
114507
|
+
if (inaccurateScrollDevice) {
|
|
114508
|
+
var magnitude = Math.abs(delta);
|
|
114509
|
+
isWheelNotch = isIntegerMultiple(magnitude, inaccurateScrollFactor);
|
|
114510
|
+
if (isWheelNotch)
|
|
114511
|
+
;
|
|
114512
|
+
else if (magnitude < Math.min(sampledScrollFactor / wheelNotchMaxReduction, wheelSmallDeltaMax)) {
|
|
114513
|
+
unconfirmedMagnitude = null;
|
|
114514
|
+
} else if (!integer(magnitude) && isIntegerMultiple(inaccurateScrollFactor, magnitude)) {
|
|
114515
|
+
inaccurateScrollFactor = magnitude;
|
|
114516
|
+
unconfirmedMagnitude = null;
|
|
114517
|
+
isWheelNotch = true;
|
|
114518
|
+
} else if (magnitude === unconfirmedMagnitude) {
|
|
114519
|
+
var commonFactor = gcdMultipleZeroIfNonInt([inaccurateScrollFactor, magnitude]);
|
|
114520
|
+
inaccurateScrollFactor = commonFactor * wheelFactorMaxReduction >= sampledScrollFactor ? commonFactor : magnitude;
|
|
114521
|
+
unconfirmedMagnitude = null;
|
|
114522
|
+
isWheelNotch = true;
|
|
114523
|
+
} else {
|
|
114524
|
+
unconfirmedMagnitude = magnitude;
|
|
114525
|
+
clamp = integer(magnitude) || magnitude > inaccurateScrollFactor;
|
|
114526
|
+
}
|
|
114169
114527
|
}
|
|
114170
114528
|
if (r.scrollingPage) {
|
|
114171
114529
|
return;
|
|
@@ -114193,7 +114551,7 @@ BRp$3.load = function() {
|
|
|
114193
114551
|
delta = signum(delta) * 5;
|
|
114194
114552
|
}
|
|
114195
114553
|
diff = delta / -250;
|
|
114196
|
-
if (
|
|
114554
|
+
if (isWheelNotch) {
|
|
114197
114555
|
diff /= inaccurateScrollFactor;
|
|
114198
114556
|
diff *= 3;
|
|
114199
114557
|
}
|
|
@@ -115490,6 +115848,7 @@ BRp$1.startRenderLoop = function() {
|
|
|
115490
115848
|
if (cy.batching())
|
|
115491
115849
|
;
|
|
115492
115850
|
else if (r.requestedFrame && !r.skipFrame) {
|
|
115851
|
+
r.requestedFrame = false;
|
|
115493
115852
|
beforeRenderCallbacks(r, true, requestTime);
|
|
115494
115853
|
var startTime = performanceNow();
|
|
115495
115854
|
r.render(r.renderOptions);
|
|
@@ -115508,7 +115867,6 @@ BRp$1.startRenderLoop = function() {
|
|
|
115508
115867
|
r.redrawTotalTime += duration;
|
|
115509
115868
|
r.lastRedrawTime = duration;
|
|
115510
115869
|
r.averageRedrawTime = r.averageRedrawTime / 2 + duration / 2;
|
|
115511
|
-
r.requestedFrame = false;
|
|
115512
115870
|
} else {
|
|
115513
115871
|
beforeRenderCallbacks(r, false, requestTime);
|
|
115514
115872
|
}
|
|
@@ -117026,7 +117384,7 @@ CRp$9.drawEdge = function(context, edge, shiftToOriginWithBb) {
|
|
|
117026
117384
|
context.lineWidth = edgeWidth + lineOutlineWidth;
|
|
117027
117385
|
context.lineCap = lineCap;
|
|
117028
117386
|
if (lineOutlineWidth > 0) {
|
|
117029
|
-
r.colorStrokeStyle(context, lineOutlineColor
|
|
117387
|
+
r.colorStrokeStyle(context, lineOutlineColor, strokeOpacity);
|
|
117030
117388
|
} else {
|
|
117031
117389
|
context.lineCap = "butt";
|
|
117032
117390
|
return;
|
|
@@ -117085,6 +117443,7 @@ var drawEdgeOverlayUnderlay = function drawEdgeOverlayUnderlay(overlayOrUnderlay
|
|
|
117085
117443
|
throw new Error("Invalid state");
|
|
117086
117444
|
}
|
|
117087
117445
|
return function(context, edge) {
|
|
117446
|
+
var _edge$pstyle;
|
|
117088
117447
|
if (!edge.visible()) {
|
|
117089
117448
|
return;
|
|
117090
117449
|
}
|
|
@@ -117097,14 +117456,25 @@ var drawEdgeOverlayUnderlay = function drawEdgeOverlayUnderlay(overlayOrUnderlay
|
|
|
117097
117456
|
var rs = edge._private.rscratch;
|
|
117098
117457
|
var padding = edge.pstyle("".concat(overlayOrUnderlay, "-padding")).pfValue;
|
|
117099
117458
|
var width = 2 * padding;
|
|
117100
|
-
var color = edge.pstyle("".concat(overlayOrUnderlay, "-color")).value;
|
|
117101
117459
|
context.lineWidth = width;
|
|
117102
117460
|
if (rs.edgeType === "self" && !usePaths) {
|
|
117103
117461
|
context.lineCap = "butt";
|
|
117104
117462
|
} else {
|
|
117105
117463
|
context.lineCap = "round";
|
|
117106
117464
|
}
|
|
117107
|
-
|
|
117465
|
+
var fillStyle = (_edge$pstyle = edge.pstyle("".concat(overlayOrUnderlay, "-fill"))) === null || _edge$pstyle === undefined ? undefined : _edge$pstyle.value;
|
|
117466
|
+
if (fillStyle === "linear-gradient" || fillStyle === "radial-gradient") {
|
|
117467
|
+
var gradient = r.createGradientStyleFor(context, overlayOrUnderlay, edge, fillStyle, opacity);
|
|
117468
|
+
if (gradient) {
|
|
117469
|
+
context.strokeStyle = gradient;
|
|
117470
|
+
} else {
|
|
117471
|
+
var color = edge.pstyle("".concat(overlayOrUnderlay, "-color")).value;
|
|
117472
|
+
r.colorStrokeStyle(context, color, opacity);
|
|
117473
|
+
}
|
|
117474
|
+
} else {
|
|
117475
|
+
var _color = edge.pstyle("".concat(overlayOrUnderlay, "-color")).value;
|
|
117476
|
+
r.colorStrokeStyle(context, _color, opacity);
|
|
117477
|
+
}
|
|
117108
117478
|
r.drawEdgePath(edge, context, rs.allpts, "solid");
|
|
117109
117479
|
};
|
|
117110
117480
|
};
|
|
@@ -117247,17 +117617,17 @@ CRp$9.drawArrowhead = function(context, edge, prefix, x, y, angle, opacity) {
|
|
|
117247
117617
|
var gco = context.globalCompositeOperation;
|
|
117248
117618
|
if (opacity !== 1 || arrowFill === "hollow") {
|
|
117249
117619
|
context.globalCompositeOperation = "destination-out";
|
|
117250
|
-
self2.colorFillStyle(context, 255, 255, 255, 1);
|
|
117251
|
-
self2.colorStrokeStyle(context, 255, 255, 255, 1);
|
|
117252
|
-
self2.drawArrowShape(edge, context, arrowClearFill, edgeWidth, arrowShape, arrowWidth, x, y, angle);
|
|
117620
|
+
self2.colorFillStyle(context, [255, 255, 255], 1);
|
|
117621
|
+
self2.colorStrokeStyle(context, [255, 255, 255], 1);
|
|
117622
|
+
self2.drawArrowShape(edge, context, arrowClearFill, edgeWidth, arrowShape, arrowWidth, x, y, angle, prefix);
|
|
117253
117623
|
context.globalCompositeOperation = gco;
|
|
117254
117624
|
}
|
|
117255
117625
|
var color = edge.pstyle(prefix + "-arrow-color").value;
|
|
117256
|
-
self2.colorFillStyle(context, color
|
|
117257
|
-
self2.colorStrokeStyle(context, color
|
|
117258
|
-
self2.drawArrowShape(edge, context, arrowFill, edgeWidth, arrowShape, arrowWidth, x, y, angle);
|
|
117626
|
+
self2.colorFillStyle(context, color, opacity);
|
|
117627
|
+
self2.colorStrokeStyle(context, color, opacity);
|
|
117628
|
+
self2.drawArrowShape(edge, context, arrowFill, edgeWidth, arrowShape, arrowWidth, x, y, angle, prefix);
|
|
117259
117629
|
};
|
|
117260
|
-
CRp$9.drawArrowShape = function(edge, context, fill, edgeWidth, shape, shapeWidth, x, y, angle) {
|
|
117630
|
+
CRp$9.drawArrowShape = function(edge, context, fill, edgeWidth, shape, shapeWidth, x, y, angle, prefix) {
|
|
117261
117631
|
var r = this;
|
|
117262
117632
|
var usePaths = this.usePaths() && shape !== "triangle-cross";
|
|
117263
117633
|
var pathCacheHit = false;
|
|
@@ -117267,9 +117637,9 @@ CRp$9.drawArrowShape = function(edge, context, fill, edgeWidth, shape, shapeWidt
|
|
|
117267
117637
|
x,
|
|
117268
117638
|
y
|
|
117269
117639
|
};
|
|
117270
|
-
var scale = edge.pstyle("arrow-scale").value;
|
|
117271
|
-
var size = this.getArrowWidth(edgeWidth, scale);
|
|
117272
117640
|
var shapeImpl = r.arrowShapes[shape];
|
|
117641
|
+
var scale = getArrowScale(edge, prefix);
|
|
117642
|
+
var size = this.getArrowWidth(edgeWidth, scale);
|
|
117273
117643
|
if (usePaths) {
|
|
117274
117644
|
var cache = r.arrowPathCache = r.arrowPathCache || [];
|
|
117275
117645
|
var key = hashString(shape);
|
|
@@ -117560,8 +117930,8 @@ CRp$7.setupTextStyle = function(context, ele) {
|
|
|
117560
117930
|
var outlineColor = ele.pstyle("text-outline-color").value;
|
|
117561
117931
|
context.font = labelStyle + " " + labelWeight + " " + labelSize + " " + labelFamily;
|
|
117562
117932
|
context.lineJoin = "round";
|
|
117563
|
-
this.colorFillStyle(context, color
|
|
117564
|
-
this.colorStrokeStyle(context, outlineColor
|
|
117933
|
+
this.colorFillStyle(context, color, opacity);
|
|
117934
|
+
this.colorStrokeStyle(context, outlineColor, outlineOpacity);
|
|
117565
117935
|
};
|
|
117566
117936
|
function circle(ctx, x, y, width, height) {
|
|
117567
117937
|
var diameter = Math.min(width, height);
|
|
@@ -117692,10 +118062,10 @@ CRp$7.drawText = function(context, ele, prefix) {
|
|
|
117692
118062
|
var bgW = textW + 2 * backgroundPadding;
|
|
117693
118063
|
var bgH = textH + 2 * backgroundPadding;
|
|
117694
118064
|
if (doFill) {
|
|
117695
|
-
|
|
118065
|
+
this.colorFillStyle(context, textBackgroundColor, backgroundOpacity * parentOpacity);
|
|
117696
118066
|
}
|
|
117697
118067
|
if (doStroke) {
|
|
117698
|
-
|
|
118068
|
+
this.colorStrokeStyle(context, textBorderColor, borderOpacity * parentOpacity);
|
|
117699
118069
|
context.lineWidth = textBorderWidth;
|
|
117700
118070
|
if (context.setLineDash) {
|
|
117701
118071
|
switch (textBorderStyle) {
|
|
@@ -117875,11 +118245,11 @@ CRp$6.drawNode = function(context, node, shiftToOriginWithBb) {
|
|
|
117875
118245
|
};
|
|
117876
118246
|
var setupBorderColor = function setupBorderColor() {
|
|
117877
118247
|
var bdrOpy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : borderOpacity;
|
|
117878
|
-
r.colorStrokeStyle(context, borderColor
|
|
118248
|
+
r.colorStrokeStyle(context, borderColor, bdrOpy);
|
|
117879
118249
|
};
|
|
117880
118250
|
var setupOutlineColor = function setupOutlineColor() {
|
|
117881
118251
|
var otlnOpy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : outlineOpacity;
|
|
117882
|
-
r.colorStrokeStyle(context, outlineColor
|
|
118252
|
+
r.colorStrokeStyle(context, outlineColor, otlnOpy);
|
|
117883
118253
|
};
|
|
117884
118254
|
var getPath = function getPath(width, height, shape, points) {
|
|
117885
118255
|
var pathCache = r.nodePathCache = r.nodePathCache || [];
|
|
@@ -117931,6 +118301,9 @@ CRp$6.drawNode = function(context, node, shiftToOriginWithBb) {
|
|
|
117931
118301
|
var prevBging = _p.backgrounding;
|
|
117932
118302
|
var totalCompleted = 0;
|
|
117933
118303
|
for (var _i = 0;_i < image.length; _i++) {
|
|
118304
|
+
if (!urlDefined[_i]) {
|
|
118305
|
+
continue;
|
|
118306
|
+
}
|
|
117934
118307
|
var bgContainment = node.cy().style().getIndexedStyle(node, "background-image-containment", "value", _i);
|
|
117935
118308
|
if (inside && bgContainment === "over" || !inside && bgContainment === "inside") {
|
|
117936
118309
|
totalCompleted++;
|
|
@@ -117983,7 +118356,7 @@ CRp$6.drawNode = function(context, node, shiftToOriginWithBb) {
|
|
|
117983
118356
|
var opacity = (darkness > 0 ? darkness : -darkness) * darkenOpacity;
|
|
117984
118357
|
var c = darkness > 0 ? 0 : 255;
|
|
117985
118358
|
if (darkness !== 0) {
|
|
117986
|
-
r.colorFillStyle(context, c, c, c, opacity);
|
|
118359
|
+
r.colorFillStyle(context, [c, c, c], opacity);
|
|
117987
118360
|
if (usePaths) {
|
|
117988
118361
|
context.fill(path);
|
|
117989
118362
|
} else {
|
|
@@ -118249,17 +118622,29 @@ var drawNodeOverlayUnderlay = function drawNodeOverlayUnderlay(overlayOrUnderlay
|
|
|
118249
118622
|
}
|
|
118250
118623
|
var padding = node.pstyle("".concat(overlayOrUnderlay, "-padding")).pfValue;
|
|
118251
118624
|
var opacity = node.pstyle("".concat(overlayOrUnderlay, "-opacity")).value;
|
|
118252
|
-
var color = node.pstyle("".concat(overlayOrUnderlay, "-color")).value;
|
|
118253
118625
|
var shape = node.pstyle("".concat(overlayOrUnderlay, "-shape")).value;
|
|
118254
118626
|
var radius = node.pstyle("".concat(overlayOrUnderlay, "-corner-radius")).value;
|
|
118255
118627
|
if (opacity > 0) {
|
|
118628
|
+
var _node$pstyle;
|
|
118256
118629
|
pos = pos || node.position();
|
|
118257
118630
|
if (nodeWidth == null || nodeHeight == null) {
|
|
118258
118631
|
var _padding = node.padding();
|
|
118259
118632
|
nodeWidth = node.width() + 2 * _padding;
|
|
118260
118633
|
nodeHeight = node.height() + 2 * _padding;
|
|
118261
118634
|
}
|
|
118262
|
-
|
|
118635
|
+
var fillStyle = (_node$pstyle = node.pstyle("".concat(overlayOrUnderlay, "-fill"))) === null || _node$pstyle === undefined ? undefined : _node$pstyle.value;
|
|
118636
|
+
if (fillStyle === "linear-gradient" || fillStyle === "radial-gradient") {
|
|
118637
|
+
var gradient = r.createGradientStyleFor(context, overlayOrUnderlay, node, fillStyle, opacity);
|
|
118638
|
+
if (gradient) {
|
|
118639
|
+
context.fillStyle = gradient;
|
|
118640
|
+
} else {
|
|
118641
|
+
var color = node.pstyle("".concat(overlayOrUnderlay, "-color")).value;
|
|
118642
|
+
r.colorFillStyle(context, color, opacity);
|
|
118643
|
+
}
|
|
118644
|
+
} else {
|
|
118645
|
+
var _color = node.pstyle("".concat(overlayOrUnderlay, "-color")).value;
|
|
118646
|
+
r.colorFillStyle(context, _color, opacity);
|
|
118647
|
+
}
|
|
118263
118648
|
r.nodeShapes[shape].draw(context, pos.x, pos.y, nodeWidth + padding * 2, nodeHeight + padding * 2, radius);
|
|
118264
118649
|
context.fill();
|
|
118265
118650
|
}
|
|
@@ -118333,7 +118718,7 @@ CRp$6.drawPie = function(context, node, nodeOpacity, pos) {
|
|
|
118333
118718
|
context.arc(x, y, holeRadius, angleEnd, angleStart, true);
|
|
118334
118719
|
context.closePath();
|
|
118335
118720
|
}
|
|
118336
|
-
this.colorFillStyle(context, color
|
|
118721
|
+
this.colorFillStyle(context, color, opacity);
|
|
118337
118722
|
context.fill();
|
|
118338
118723
|
lastPercent += percent;
|
|
118339
118724
|
}
|
|
@@ -118387,7 +118772,7 @@ CRp$6.drawStripe = function(context, node, nodeOpacity, pos) {
|
|
|
118387
118772
|
context.beginPath();
|
|
118388
118773
|
context.rect(x, y + stripeH * lastPercent, stripeW, stripeH * percent);
|
|
118389
118774
|
context.closePath();
|
|
118390
|
-
this.colorFillStyle(context, color
|
|
118775
|
+
this.colorFillStyle(context, color, opacity);
|
|
118391
118776
|
context.fill();
|
|
118392
118777
|
lastPercent += percent;
|
|
118393
118778
|
}
|
|
@@ -118395,6 +118780,12 @@ CRp$6.drawStripe = function(context, node, nodeOpacity, pos) {
|
|
|
118395
118780
|
};
|
|
118396
118781
|
var CRp$5 = {};
|
|
118397
118782
|
var motionBlurDelay = 100;
|
|
118783
|
+
var colorAlpha = function colorAlpha(color) {
|
|
118784
|
+
return color[3] == null ? 1 : color[3];
|
|
118785
|
+
};
|
|
118786
|
+
var effectiveAlpha = function effectiveAlpha(color, opacity) {
|
|
118787
|
+
return colorAlpha(color) * opacity;
|
|
118788
|
+
};
|
|
118398
118789
|
CRp$5.getPixelRatio = function() {
|
|
118399
118790
|
var context = this.data.contexts[0];
|
|
118400
118791
|
if (this.forcedPixelRatio != null) {
|
|
@@ -118434,7 +118825,7 @@ CRp$5.createGradientStyleFor = function(context, shapeStyleName, ele, fill, opac
|
|
|
118434
118825
|
var d2 = dist(end, mid);
|
|
118435
118826
|
gradientStyle = context.createRadialGradient(mid.x, mid.y, 0, mid.x, mid.y, Math.max(d1, d2));
|
|
118436
118827
|
} else {
|
|
118437
|
-
var pos = usePaths ? {
|
|
118828
|
+
var pos = usePaths && shapeStyleName === "background" ? {
|
|
118438
118829
|
x: 0,
|
|
118439
118830
|
y: 0
|
|
118440
118831
|
} : ele.position(), width = ele.paddedWidth(), height = ele.paddedHeight();
|
|
@@ -118445,11 +118836,11 @@ CRp$5.createGradientStyleFor = function(context, shapeStyleName, ele, fill, opac
|
|
|
118445
118836
|
var _start = ele.sourceEndpoint(), _end = ele.targetEndpoint();
|
|
118446
118837
|
gradientStyle = context.createLinearGradient(_start.x, _start.y, _end.x, _end.y);
|
|
118447
118838
|
} else {
|
|
118448
|
-
var _pos = usePaths ? {
|
|
118839
|
+
var _pos = usePaths && shapeStyleName === "background" ? {
|
|
118449
118840
|
x: 0,
|
|
118450
118841
|
y: 0
|
|
118451
118842
|
} : ele.position(), _width = ele.paddedWidth(), _height = ele.paddedHeight(), halfWidth = _width / 2, halfHeight = _height / 2;
|
|
118452
|
-
var direction = ele.pstyle("
|
|
118843
|
+
var direction = ele.pstyle(shapeStyleName + "-gradient-direction").value;
|
|
118453
118844
|
switch (direction) {
|
|
118454
118845
|
case "to-bottom":
|
|
118455
118846
|
gradientStyle = context.createLinearGradient(_pos.x, _pos.y - halfHeight, _pos.x, _pos.y + halfHeight);
|
|
@@ -118487,7 +118878,8 @@ CRp$5.createGradientStyleFor = function(context, shapeStyleName, ele, fill, opac
|
|
|
118487
118878
|
var hasPositions = positions.length === colors.length;
|
|
118488
118879
|
var length = colors.length;
|
|
118489
118880
|
for (var i = 0;i < length; i++) {
|
|
118490
|
-
|
|
118881
|
+
var stopAlpha = effectiveAlpha(colors[i], opacity);
|
|
118882
|
+
gradientStyle.addColorStop(hasPositions ? positions[i] : i / (length - 1), "rgba(" + colors[i][0] + "," + colors[i][1] + "," + colors[i][2] + "," + stopAlpha + ")");
|
|
118491
118883
|
}
|
|
118492
118884
|
return gradientStyle;
|
|
118493
118885
|
};
|
|
@@ -118497,8 +118889,8 @@ CRp$5.gradientFillStyle = function(context, ele, fill, opacity) {
|
|
|
118497
118889
|
return null;
|
|
118498
118890
|
context.fillStyle = gradientStyle;
|
|
118499
118891
|
};
|
|
118500
|
-
CRp$5.colorFillStyle = function(context,
|
|
118501
|
-
context.fillStyle = "rgba(" +
|
|
118892
|
+
CRp$5.colorFillStyle = function(context, color, opacity) {
|
|
118893
|
+
context.fillStyle = "rgba(" + color[0] + "," + color[1] + "," + color[2] + "," + effectiveAlpha(color, opacity) + ")";
|
|
118502
118894
|
};
|
|
118503
118895
|
CRp$5.eleFillStyle = function(context, ele, opacity) {
|
|
118504
118896
|
var backgroundFill = ele.pstyle("background-fill").value;
|
|
@@ -118506,7 +118898,7 @@ CRp$5.eleFillStyle = function(context, ele, opacity) {
|
|
|
118506
118898
|
this.gradientFillStyle(context, ele, backgroundFill, opacity);
|
|
118507
118899
|
} else {
|
|
118508
118900
|
var backgroundColor = ele.pstyle("background-color").value;
|
|
118509
|
-
this.colorFillStyle(context, backgroundColor
|
|
118901
|
+
this.colorFillStyle(context, backgroundColor, opacity);
|
|
118510
118902
|
}
|
|
118511
118903
|
};
|
|
118512
118904
|
CRp$5.gradientStrokeStyle = function(context, ele, fill, opacity) {
|
|
@@ -118515,8 +118907,8 @@ CRp$5.gradientStrokeStyle = function(context, ele, fill, opacity) {
|
|
|
118515
118907
|
return null;
|
|
118516
118908
|
context.strokeStyle = gradientStyle;
|
|
118517
118909
|
};
|
|
118518
|
-
CRp$5.colorStrokeStyle = function(context,
|
|
118519
|
-
context.strokeStyle = "rgba(" +
|
|
118910
|
+
CRp$5.colorStrokeStyle = function(context, color, opacity) {
|
|
118911
|
+
context.strokeStyle = "rgba(" + color[0] + "," + color[1] + "," + color[2] + "," + effectiveAlpha(color, opacity) + ")";
|
|
118520
118912
|
};
|
|
118521
118913
|
CRp$5.eleStrokeStyle = function(context, ele, opacity) {
|
|
118522
118914
|
var lineFill = ele.pstyle("line-fill").value;
|
|
@@ -118524,7 +118916,7 @@ CRp$5.eleStrokeStyle = function(context, ele, opacity) {
|
|
|
118524
118916
|
this.gradientStrokeStyle(context, ele, lineFill, opacity);
|
|
118525
118917
|
} else {
|
|
118526
118918
|
var lineColor = ele.pstyle("line-color").value;
|
|
118527
|
-
this.colorStrokeStyle(context, lineColor
|
|
118919
|
+
this.colorStrokeStyle(context, lineColor, opacity);
|
|
118528
118920
|
}
|
|
118529
118921
|
};
|
|
118530
118922
|
CRp$5.matchCanvasSize = function(container) {
|
|
@@ -118672,7 +119064,7 @@ CRp$5.render = function(options) {
|
|
|
118672
119064
|
function mbclear(context, x, y, w, h) {
|
|
118673
119065
|
var gco = context.globalCompositeOperation;
|
|
118674
119066
|
context.globalCompositeOperation = "destination-out";
|
|
118675
|
-
r.colorFillStyle(context, 255, 255, 255, r.motionBlurTransparency);
|
|
119067
|
+
r.colorFillStyle(context, [255, 255, 255], r.motionBlurTransparency);
|
|
118676
119068
|
context.fillRect(x, y, w, h);
|
|
118677
119069
|
context.globalCompositeOperation = gco;
|
|
118678
119070
|
}
|
|
@@ -118750,7 +119142,7 @@ CRp$5.render = function(options) {
|
|
|
118750
119142
|
}
|
|
118751
119143
|
var outsideBgColor = style.core("outside-texture-bg-color").value;
|
|
118752
119144
|
var outsideBgOpacity = style.core("outside-texture-bg-opacity").value;
|
|
118753
|
-
r.colorFillStyle(context, outsideBgColor
|
|
119145
|
+
r.colorFillStyle(context, outsideBgColor, outsideBgOpacity);
|
|
118754
119146
|
context.fillRect(0, 0, vp.width, vp.height);
|
|
118755
119147
|
var zoom = cy.zoom();
|
|
118756
119148
|
setContextTransform(context, false);
|
|
@@ -118995,7 +119387,7 @@ function toWebGLColor(color, opacity, outArray) {
|
|
|
118995
119387
|
var r = color[0] / 255;
|
|
118996
119388
|
var g = color[1] / 255;
|
|
118997
119389
|
var b = color[2] / 255;
|
|
118998
|
-
var a = opacity;
|
|
119390
|
+
var a = (color[3] == null ? 1 : color[3]) * opacity;
|
|
118999
119391
|
var arr = outArray || new Array(4);
|
|
119000
119392
|
arr[0] = r * a;
|
|
119001
119393
|
arr[1] = g * a;
|
|
@@ -120711,7 +121103,7 @@ var ElementDrawingWebGL = /* @__PURE__ */ function() {
|
|
|
120711
121103
|
var lineOpacity = edge.pstyle("line-opacity").value;
|
|
120712
121104
|
var opacity = baseOpacity * lineOpacity;
|
|
120713
121105
|
var lineWidth = edge.pstyle("width").pfValue;
|
|
120714
|
-
var scale$1 = edge
|
|
121106
|
+
var scale$1 = getArrowScale(edge, prefix);
|
|
120715
121107
|
var size = this.r.getArrowWidth(lineWidth, scale$1);
|
|
120716
121108
|
var instance = this.instanceCount;
|
|
120717
121109
|
var transform = this.transformBuffer.getMatrixView(instance);
|
|
@@ -121382,8 +121774,10 @@ function renderWebgl(r, options, renderTarget) {
|
|
|
121382
121774
|
drawAxes(r);
|
|
121383
121775
|
drawAtlases(r);
|
|
121384
121776
|
}
|
|
121385
|
-
|
|
121386
|
-
|
|
121777
|
+
if (renderTarget.screen) {
|
|
121778
|
+
r.data.canvasNeedsRedraw[r.NODE] = false;
|
|
121779
|
+
r.data.canvasNeedsRedraw[r.DRAG] = false;
|
|
121780
|
+
}
|
|
121387
121781
|
}
|
|
121388
121782
|
if (r.webglDebug) {
|
|
121389
121783
|
var end = performance.now();
|
|
@@ -122309,7 +122703,7 @@ sheetfn.appendToStyle = function(style) {
|
|
|
122309
122703
|
}
|
|
122310
122704
|
return style;
|
|
122311
122705
|
};
|
|
122312
|
-
var version = "3.
|
|
122706
|
+
var version = "3.35.0";
|
|
122313
122707
|
var cytoscape = function cytoscape(options) {
|
|
122314
122708
|
if (options === undefined) {
|
|
122315
122709
|
options = {};
|
|
@@ -122865,12 +123259,11 @@ function measureRenderedNodes(cy, nodeIds) {
|
|
|
122865
123259
|
const node = cy.getElementById(id);
|
|
122866
123260
|
if (!node.isNode())
|
|
122867
123261
|
return [];
|
|
122868
|
-
const bounds = node.renderedBoundingBox();
|
|
122869
123262
|
return [
|
|
122870
123263
|
{
|
|
122871
123264
|
id,
|
|
122872
123265
|
position: node.renderedPosition(),
|
|
122873
|
-
size: { width:
|
|
123266
|
+
size: { width: node.renderedOuterWidth(), height: node.renderedOuterHeight() }
|
|
122874
123267
|
}
|
|
122875
123268
|
];
|
|
122876
123269
|
});
|
|
@@ -123027,8 +123420,14 @@ function getGraphGeometryKey(cy) {
|
|
|
123027
123420
|
return JSON.stringify(cy.nodes().map((node) => {
|
|
123028
123421
|
if (node.isParent())
|
|
123029
123422
|
return [node.id()];
|
|
123030
|
-
const
|
|
123031
|
-
|
|
123423
|
+
const labelBounds = node.boundingBox({
|
|
123424
|
+
includeEdges: false,
|
|
123425
|
+
includeLabels: true,
|
|
123426
|
+
includeNodes: false,
|
|
123427
|
+
includeOverlays: false,
|
|
123428
|
+
includeUnderlays: false
|
|
123429
|
+
});
|
|
123430
|
+
return [node.id(), node.outerWidth(), node.outerHeight(), labelBounds.w, labelBounds.h];
|
|
123032
123431
|
}));
|
|
123033
123432
|
}
|
|
123034
123433
|
|
|
@@ -123088,6 +123487,8 @@ var defaults2 = {
|
|
|
123088
123487
|
ready: undefined,
|
|
123089
123488
|
stop: undefined,
|
|
123090
123489
|
nodeLayoutOptions: undefined,
|
|
123490
|
+
useElkEdgeGeometry: false,
|
|
123491
|
+
elkEdgeRadius: 0,
|
|
123091
123492
|
elk: {
|
|
123092
123493
|
algorithm: undefined
|
|
123093
123494
|
},
|
|
@@ -123146,6 +123547,138 @@ var makeEdge = function(edge) {
|
|
|
123146
123547
|
edge.scratch("elk", k);
|
|
123147
123548
|
return k;
|
|
123148
123549
|
};
|
|
123550
|
+
var getElkOrigins = function(graph) {
|
|
123551
|
+
const origins = { [graph.id]: { x: 0, y: 0 } };
|
|
123552
|
+
const walk = function(container, ox, oy) {
|
|
123553
|
+
const children = container.children || [];
|
|
123554
|
+
for (let i = 0;i < children.length; i++) {
|
|
123555
|
+
const child = children[i];
|
|
123556
|
+
const x = ox + (child.x || 0);
|
|
123557
|
+
const y = oy + (child.y || 0);
|
|
123558
|
+
origins[child.id] = { x, y };
|
|
123559
|
+
walk(child, x, y);
|
|
123560
|
+
}
|
|
123561
|
+
};
|
|
123562
|
+
walk(graph, 0, 0);
|
|
123563
|
+
return origins;
|
|
123564
|
+
};
|
|
123565
|
+
var getElkEdgePoints = function(elkEdge, origins, rootId) {
|
|
123566
|
+
const sec = elkEdge.sections && elkEdge.sections[0];
|
|
123567
|
+
if (!sec || !sec.startPoint || !sec.endPoint) {
|
|
123568
|
+
return [];
|
|
123569
|
+
}
|
|
123570
|
+
const container = elkEdge.container === undefined ? rootId : elkEdge.container;
|
|
123571
|
+
const origin = origins[container] || { x: 0, y: 0 };
|
|
123572
|
+
const raw = [sec.startPoint].concat(sec.bendPoints || [], [sec.endPoint]);
|
|
123573
|
+
const points = [];
|
|
123574
|
+
for (let i = 0;i < raw.length; i++) {
|
|
123575
|
+
const p = { x: raw[i].x + origin.x, y: raw[i].y + origin.y };
|
|
123576
|
+
const last = points[points.length - 1];
|
|
123577
|
+
if (!last || last.x !== p.x || last.y !== p.y) {
|
|
123578
|
+
points.push(p);
|
|
123579
|
+
}
|
|
123580
|
+
}
|
|
123581
|
+
return points;
|
|
123582
|
+
};
|
|
123583
|
+
var fmtEndpoint = function(dx, dy) {
|
|
123584
|
+
return `${dx.toFixed(1)}px ${dy.toFixed(1)}px`;
|
|
123585
|
+
};
|
|
123586
|
+
var projectOntoLine = function(a, b, p) {
|
|
123587
|
+
const dx = b.x - a.x;
|
|
123588
|
+
const dy = b.y - a.y;
|
|
123589
|
+
const len2 = dx * dx + dy * dy;
|
|
123590
|
+
if (len2 < 0.001) {
|
|
123591
|
+
return {
|
|
123592
|
+
w: 0.5,
|
|
123593
|
+
d: 0
|
|
123594
|
+
};
|
|
123595
|
+
}
|
|
123596
|
+
const w = ((p.x - a.x) * dx + (p.y - a.y) * dy) / len2;
|
|
123597
|
+
const cross = dx * (p.y - a.y) - dy * (p.x - a.x);
|
|
123598
|
+
const d = cross / Math.sqrt(len2);
|
|
123599
|
+
return {
|
|
123600
|
+
w,
|
|
123601
|
+
d
|
|
123602
|
+
};
|
|
123603
|
+
};
|
|
123604
|
+
var clearElkEdgeStyle = function(edge) {
|
|
123605
|
+
const saved = edge.scratch("_elkEdgeStyle");
|
|
123606
|
+
if (!saved) {
|
|
123607
|
+
return;
|
|
123608
|
+
}
|
|
123609
|
+
Object.keys(saved.applied).forEach((name) => {
|
|
123610
|
+
if (edge.style(name) === saved.applied[name]) {
|
|
123611
|
+
edge.removeStyle(name);
|
|
123612
|
+
if (saved.previous[name] !== undefined) {
|
|
123613
|
+
edge.style(name, saved.previous[name]);
|
|
123614
|
+
}
|
|
123615
|
+
}
|
|
123616
|
+
});
|
|
123617
|
+
edge.removeScratch("_elkEdgeStyle");
|
|
123618
|
+
};
|
|
123619
|
+
var setElkEdgeStyle = function(edge, style) {
|
|
123620
|
+
const previous = {};
|
|
123621
|
+
Object.keys(style).forEach((name) => {
|
|
123622
|
+
const property = edge.pstyle(name);
|
|
123623
|
+
if (property && property.bypass) {
|
|
123624
|
+
previous[name] = property.strValue;
|
|
123625
|
+
}
|
|
123626
|
+
});
|
|
123627
|
+
edge.style(style);
|
|
123628
|
+
const applied = {};
|
|
123629
|
+
Object.keys(style).forEach((name) => {
|
|
123630
|
+
applied[name] = edge.style(name);
|
|
123631
|
+
});
|
|
123632
|
+
edge.scratch("_elkEdgeStyle", { previous, applied });
|
|
123633
|
+
};
|
|
123634
|
+
var applyElkEdgeGeometry = function(edge, points, sourceCenter, targetCenter, radius) {
|
|
123635
|
+
if (points.length < 2) {
|
|
123636
|
+
return;
|
|
123637
|
+
}
|
|
123638
|
+
const [startPoint] = points;
|
|
123639
|
+
const endPoint = points[points.length - 1];
|
|
123640
|
+
const bends = points.slice(1, points.length - 1);
|
|
123641
|
+
const sourceEndpoint = fmtEndpoint(startPoint.x - sourceCenter.x, startPoint.y - sourceCenter.y);
|
|
123642
|
+
const targetEndpoint = fmtEndpoint(endPoint.x - targetCenter.x, endPoint.y - targetCenter.y);
|
|
123643
|
+
const segmentWeights = [];
|
|
123644
|
+
const segmentDistances = [];
|
|
123645
|
+
for (let i = 0;i < bends.length; i++) {
|
|
123646
|
+
const proj = projectOntoLine(startPoint, endPoint, bends[i]);
|
|
123647
|
+
const weight = proj.w.toFixed(4);
|
|
123648
|
+
const distance = proj.d.toFixed(2);
|
|
123649
|
+
if ((Number(weight) === 0 || Number(weight) === 1) && Number(distance) === 0) {
|
|
123650
|
+
continue;
|
|
123651
|
+
}
|
|
123652
|
+
segmentWeights.push(weight);
|
|
123653
|
+
segmentDistances.push(distance);
|
|
123654
|
+
}
|
|
123655
|
+
if (segmentWeights.length === 0) {
|
|
123656
|
+
setElkEdgeStyle(edge, {
|
|
123657
|
+
"curve-style": "straight",
|
|
123658
|
+
"edge-distances": "endpoints",
|
|
123659
|
+
"source-endpoint": sourceEndpoint,
|
|
123660
|
+
"target-endpoint": targetEndpoint
|
|
123661
|
+
});
|
|
123662
|
+
return;
|
|
123663
|
+
}
|
|
123664
|
+
const style = {
|
|
123665
|
+
"curve-style": radius > 0 ? "round-segments" : "segments",
|
|
123666
|
+
"edge-distances": "endpoints",
|
|
123667
|
+
"source-endpoint": sourceEndpoint,
|
|
123668
|
+
"target-endpoint": targetEndpoint,
|
|
123669
|
+
"segment-weights": segmentWeights.join(" "),
|
|
123670
|
+
"segment-distances": segmentDistances.join(" ")
|
|
123671
|
+
};
|
|
123672
|
+
if (radius > 0) {
|
|
123673
|
+
style["segment-radii"] = String(radius);
|
|
123674
|
+
style["radius-type"] = "arc-radius";
|
|
123675
|
+
}
|
|
123676
|
+
setElkEdgeStyle(edge, style);
|
|
123677
|
+
};
|
|
123678
|
+
var supportsRoundSegments = function(cy) {
|
|
123679
|
+
const names = cy.style().propertyNames;
|
|
123680
|
+
return Array.isArray(names) && names.indexOf("segment-radii") >= 0;
|
|
123681
|
+
};
|
|
123149
123682
|
var makeGraph = function(nodes, edges, options) {
|
|
123150
123683
|
const elkNodes = [];
|
|
123151
123684
|
const elkEdges = [];
|
|
@@ -123205,6 +123738,34 @@ class Layout {
|
|
|
123205
123738
|
const graph = makeGraph(nodes, edges, options);
|
|
123206
123739
|
graph["layoutOptions"] = options.elk;
|
|
123207
123740
|
elk.layout(graph).then(() => {
|
|
123741
|
+
const nodePosLookup = {};
|
|
123742
|
+
nodes.filter((n) => !n.isParent()).forEach((n) => {
|
|
123743
|
+
nodePosLookup[n.id()] = getPos(n, options);
|
|
123744
|
+
});
|
|
123745
|
+
const styleEnabled = options.cy.styleEnabled();
|
|
123746
|
+
if (styleEnabled) {
|
|
123747
|
+
edges.forEach(clearElkEdgeStyle);
|
|
123748
|
+
}
|
|
123749
|
+
if (options.useElkEdgeGeometry && styleEnabled) {
|
|
123750
|
+
const elkEdgeLookup = {};
|
|
123751
|
+
const origins = getElkOrigins(graph);
|
|
123752
|
+
const radius = supportsRoundSegments(options.cy) ? options.elkEdgeRadius || 0 : 0;
|
|
123753
|
+
for (let i = 0;i < graph.edges.length; i++) {
|
|
123754
|
+
elkEdgeLookup[graph.edges[i].id] = graph.edges[i];
|
|
123755
|
+
}
|
|
123756
|
+
edges.forEach((edge) => {
|
|
123757
|
+
const elkEdge = elkEdgeLookup[edge.id()];
|
|
123758
|
+
const sourcePos = nodePosLookup[edge.source().id()];
|
|
123759
|
+
const targetPos = nodePosLookup[edge.target().id()];
|
|
123760
|
+
if (edge.isLoop() || !elkEdge || !sourcePos || !targetPos) {
|
|
123761
|
+
return;
|
|
123762
|
+
}
|
|
123763
|
+
const rawPoints = getElkEdgePoints(elkEdge, origins, graph.id);
|
|
123764
|
+
const transform = (node, point) => options.transform ? options.transform(node, { x: point.x, y: point.y }) : point;
|
|
123765
|
+
const points = rawPoints.map((point, i) => transform(i === rawPoints.length - 1 ? edge.target() : edge.source(), point));
|
|
123766
|
+
applyElkEdgeGeometry(edge, points, transform(edge.source(), sourcePos), transform(edge.target(), targetPos), radius);
|
|
123767
|
+
});
|
|
123768
|
+
}
|
|
123208
123769
|
nodes.filter((n) => !n.isParent()).layoutPositions(layout, options, (n) => getPos(n, options));
|
|
123209
123770
|
});
|
|
123210
123771
|
return this;
|
|
@@ -123520,7 +124081,7 @@ function updateRuntime(state, input) {
|
|
|
123520
124081
|
applyKnownNodeSizes(state);
|
|
123521
124082
|
state.loopSizer.update();
|
|
123522
124083
|
const geometry = getGraphGeometryKey(state.cy);
|
|
123523
|
-
const relayout = geometry !== state.geometryRef.current
|
|
124084
|
+
const relayout = hasGraphLayoutChanged(previous, input) || geometry !== state.geometryRef.current;
|
|
123524
124085
|
state.geometryRef.current = geometry;
|
|
123525
124086
|
if (!relayout) {
|
|
123526
124087
|
if (previous?.zoomMode !== input.zoomMode || previous?.fitPadding !== input.fitPadding || previous?.minZoom !== input.minZoom || previous?.maxZoom !== input.maxZoom || previous?.minReadableLabelSize !== input.minReadableLabelSize || previous?.maxFitLabelSize !== input.maxFitLabelSize) {
|