Switch to ELK layout engine for proper compound node support
This commit is contained in:
8
static/cytoscape-elk.min.js
vendored
Normal file
8
static/cytoscape-elk.min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Minified by jsDelivr using Terser v5.39.0.
|
||||
* Original file: /npm/cytoscape-elk@2.2.0/dist/cytoscape-elk.js
|
||||
*
|
||||
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||||
*/
|
||||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("elkjs")):"function"==typeof define&&define.amd?define(["elkjs"],e):"object"==typeof exports?exports.cytoscapeElk=e(require("elkjs")):t.cytoscapeElk=e(t.ELK)}(this,(function(t){return function(){"use strict";var e={245:function(e){e.exports=t}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={exports:{}};return e[t](i,i.exports,r),i.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var o={};return function(){r.d(o,{default:function(){return p}});var t=r(245),e=r.n(t);var n=null!=Object.assign?Object.assign.bind(Object):function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.forEach((function(e){Object.keys(e).forEach((function(n){return t[n]=e[n]}))})),t},i={nodeDimensionsIncludeLabels:!1,fit:!0,padding:20,animate:!1,animateFilter:function(){return!0},animationDuration:500,animationEasing:void 0,transform:function(t,e){return e},ready:void 0,stop:void 0,nodeLayoutOptions:void 0,elk:{algorithm:void 0},priority:function(){return null}};function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var u={},c=function(t,e){var n={_cyEle:t,id:t.id()};if(e.nodeLayoutOptions&&(n.layoutOptions=e.nodeLayoutOptions(t)),!t.isParent()){var r=t.layoutDimensions(e),o=t.position();n.x=o.x-r.w/2,n.y=o.y-r.h/2,n.width=r.w,n.height=r.h}return t.scratch("elk",n),n},s=function(t){var e={_cyEle:t,id:t.id(),source:t.data("source"),target:t.data("target")};return t.scratch("elk",e),e},f=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var r=e.elk,o=e.cy;this.options=n({},i,e),this.options.elk=n({aspectRatio:o.width()/o.height()},i.elk,r,u)}var r,o,f;return r=t,o=[{key:"run",value:function(){var t=this,n=this.options,r=n.eles,o=r.nodes(),i=r.edges(),a=new(e()),u=function(t,e,n){for(var r=[],o=[],i={},a={id:"root",children:[],edges:[]},u=0;u<t.length;u++){var f=t[u],l=c(f,n);r.push(l),i[f.id()]=l}for(var d=0;d<e.length;d++){var p=e[d],y=s(p);o.push(y),i[p.id()]=y}for(var h=0;h<r.length;h++){var v=r[h],g=v._cyEle;if(g.isChild()){var k=i[g.parent().id()];(k.children=k.children||[]).push(v)}else a.children.push(v)}for(var b=0;b<o.length;b++){var m=o[b];a.edges.push(m)}return a}(o,i,n);return u.layoutOptions=n.elk,a.layout(u).then((function(){o.filter((function(t){return!t.isParent()})).layoutPositions(t,n,(function(t){return function(t,e){for(var n=t.layoutDimensions(e),r=t.parent(),o=t.scratch("elk"),i={x:o.x,y:o.y};r.nonempty();){var a=r.scratch("elk");i.x+=a.x,i.y+=a.y,r=r.parent()}return i.x+=n.w/2,i.y+=n.h/2,i}(t,n)}))})),this}},{key:"stop",value:function(){return this}},{key:"destroy",value:function(){return this}}],o&&a(r.prototype,o),f&&a(r,f),Object.defineProperty(r,"prototype",{writable:!1}),t}(),l=f,d=function(t){t&&t("layout","elk",l)};"undefined"!=typeof cytoscape&&d(cytoscape);var p=d}(),o=o.default}()}));
|
||||
//# sourceMappingURL=/sm/34a9798ae1315f03be558b9d20c4eec77955798bd7e8ff309e6c6add909ebe73.map
|
||||
Reference in New Issue
Block a user