@@ -45,6 +45,8 @@ let colorScale: (value: number | string) => string = () => 'rgba(0,0,0,0.5)';
4545let program: WebGLProgram | null = null ;
4646let uMatrixLocation: WebGLUniformLocation | null = null ;
4747let uScreenWidthPixelsLocation: WebGLUniformLocation | null = null ;
48+ let uStrokeWidthLocation: WebGLUniformLocation | null = null ;
49+ let uStrokeOpacityLocation: WebGLUniformLocation | null = null ;
4850let positionBuffer: WebGLBuffer | null = null ;
4951let offsetBuffer: WebGLBuffer | null = null ;
5052let colorBuffer: WebGLBuffer | null = null ;
@@ -71,6 +73,8 @@ const sendToWorker = (name: string, reference: Ref<any>) => {
7173
7274const edgeWidth = ref (5.0 );
7375const edgeOpacity = ref (0.5 );
76+ const strokeWidth = ref (1.0 );
77+ const strokeOpacity = ref (0.5 );
7478const nodeOpacity = ref (0.5 );
7579const size = ref (0.5 );
7680const sizeField = ref (' degree' );
@@ -466,6 +470,8 @@ const drawScene = (gl: WebGL2RenderingContext) => {
466470
467471 gl .uniformMatrix3fv (uMatrixLocation , false , matrix );
468472 gl .uniform1f (uScreenWidthPixelsLocation , gl .canvas .width );
473+ gl .uniform1f (uStrokeWidthLocation , strokeWidth .value );
474+ gl .uniform1f (uStrokeOpacityLocation , strokeOpacity .value );
469475 gl .drawArraysInstanced (gl .TRIANGLE_FAN , 0 , positions .length / 2 , graph .nodes .length || 0 );
470476};
471477
@@ -596,6 +602,8 @@ onMounted(() => {
596602
597603 uMatrixLocation = gl .getUniformLocation (program , ' uMatrix' );
598604 uScreenWidthPixelsLocation = gl .getUniformLocation (program , ' uScreenWidthPixels' );
605+ uStrokeWidthLocation = gl .getUniformLocation (program , ' uStrokeWidth' );
606+ uStrokeOpacityLocation = gl .getUniformLocation (program , ' uStrokeOpacity' );
599607
600608 setupBuffersAndAttributes (gl , program );
601609
@@ -781,7 +789,15 @@ const showLayoutControls = ref(true);
781789 <input type =" range" v-model.number =" edgeOpacity" :min =" 0" :max =" 1" :step =" epsilon" class =" w-full mt-1" >
782790 </div >
783791 <div class =" mt-2" >
784- <label class =" block text-sm font-medium text-gray-300" >Node Opacity</label >
792+ <label class =" block text-sm font-medium text-gray-300" >Stroke Width</label >
793+ <input type =" range" v-model.number =" strokeWidth" :min =" 0" :max =" 50" :step =" epsilon" class =" w-full mt-1" >
794+ </div >
795+ <div class =" mt-2" >
796+ <label class =" block text-sm font-medium text-gray-300" >Stroke Opacity</label >
797+ <input type =" range" v-model.number =" strokeOpacity" :min =" 0" :max =" 1" :step =" epsilon" class =" w-full mt-1" >
798+ </div >
799+ <div class =" mt-2" >
800+ <label class =" block text-sm font-medium text-gray-300" >Fill Opacity</label >
785801 <input type =" range" v-model.number =" nodeOpacity" :min =" 0" :max =" 1" :step =" epsilon" class =" w-full mt-1" >
786802 </div >
787803 <div class =" mt-2" >
0 commit comments