UNPKG

sigma

Version:

A JavaScript library dedicated to graph drawing.

2 lines 4.12 kB
(()=>{"use strict";var r,o={641:(r,o,e)=>{e.r(o),e.d(o,{default:()=>t});const t="precision mediump float;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float radius = 0.5;\nconst float halfRadius = 0.25;\n\nvoid main(void) {\n vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 color1 = vec4(1.0, 1.0, 1.0, 1.0);\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = length(m);\n\n\n if (dist < halfRadius - v_border)\n gl_FragColor = color1;\n else if (dist < halfRadius)\n gl_FragColor = mix(v_color, color1, (halfRadius - dist) / v_border);\n else if (dist < radius - v_border)\n gl_FragColor = v_color;\n else if (dist < radius)\n gl_FragColor = mix(color0, v_color, (radius - dist) / v_border);\n else\n gl_FragColor = color0;\n}\n"},2212:function(r,o,e){var t=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(o,"__esModule",{value:!0});var n=e(9807),i=t(e(7072)),a=t(e(5656)),l=t(e(6558)),s=e(7610),c=t(e(4780)),d=t(e(4197)),u=document.getElementById("container"),f=i.default(n.UndirectedGraph,{order:100,probability:.2});a.default.assign(f),f.nodes().forEach((function(r){f.mergeNodeAttributes(r,{label:s.getRandomName(),size:Math.max(4,10*Math.random()),color:l.default.random().hex()})}));var v=new c.default(f,u,{nodeProgramClasses:{circle:d.default}});s.globalize({graph:f,renderer:v})},4197:function(r,o,e){var t,n=this&&this.__extends||(t=function(r,o){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(r[e]=o[e])})(r,o)},function(r,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function e(){this.constructor=r}t(r,o),r.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}),i=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(o,"__esModule",{value:!0});var a=e(1647),l=e(1063),s=i(e(6143)),c=i(e(641)),d=function(r){function o(o){var e=r.call(this,o,s.default,c.default,3,5)||this;return e.bind(),e}return n(o,r),o.prototype.process=function(r,o,e){var t=3*e*5,n=this.array;if(o)return n[t++]=0,n[t++]=0,n[t++]=0,void(n[t++]=0);var i=l.floatColor(r.color);n[t++]=r.x,n[t++]=r.y,n[t++]=r.size,n[t]=i},o.prototype.render=function(r){var o=this.gl,e=this.program;o.useProgram(e),o.uniform1f(this.ratioLocation,1/Math.pow(r.ratio,r.nodesPowRatio)),o.uniform1f(this.scaleLocation,r.scalingRatio),o.uniformMatrix3fv(this.matrixLocation,!1,r.matrix),o.drawArrays(o.POINTS,0,this.array.length/5)},o}(a.AbstractNodeProgram);o.default=d}},e={};function t(r){var n=e[r];if(void 0!==n)return n.exports;var i=e[r]={id:r,loaded:!1,exports:{}};return o[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}t.m=o,r=[],t.O=(o,e,n,i)=>{if(!e){var a=1/0;for(c=0;c<r.length;c++){for(var[e,n,i]=r[c],l=!0,s=0;s<e.length;s++)(!1&i||a>=i)&&Object.keys(t.O).every((r=>t.O[r](e[s])))?e.splice(s--,1):(l=!1,i<a&&(a=i));l&&(r.splice(c--,1),o=n())}return o}i=i||0;for(var c=r.length;c>0&&r[c-1][2]>i;c--)r[c]=r[c-1];r[c]=[e,n,i]},t.d=(r,o)=>{for(var e in o)t.o(o,e)&&!t.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:o[e]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(r){if("object"==typeof window)return window}}(),t.o=(r,o)=>Object.prototype.hasOwnProperty.call(r,o),t.r=r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.nmd=r=>(r.paths=[],r.children||(r.children=[]),r),(()=>{var r={362:0};t.O.j=o=>0===r[o];var o=(o,e)=>{var n,i,[a,l,s]=e,c=0;for(n in l)t.o(l,n)&&(t.m[n]=l[n]);if(s)var d=s(t);for(o&&o(e);c<a.length;c++)i=a[c],t.o(r,i)&&r[i]&&r[i][0](),r[a[c]]=0;return t.O(d)},e=self.webpackChunk=self.webpackChunk||[];e.forEach(o.bind(null,0)),e.push=o.bind(null,e.push.bind(e))})();var n=t.O(void 0,[351],(()=>t(2212)));n=t.O(n)})(); //# sourceMappingURL=customNodes.bundle.js.map