@@ -10,14 +10,15 @@ import { MIN_LABEL_HEIGHT } from './const';
1010export function renderBranchConnectors ( props : {
1111 section : SectionState ,
1212 nextSection ?: SectionState ,
13+ sectionIndex : number ,
1314 statePerPixelY : number ,
1415 connectionsByParent : Map < EntityConfigInternal , ConnectionState [ ] > ,
1516 connectionsByChild : Map < EntityConfigInternal , ConnectionState [ ] > ,
1617} ) : SVGTemplateResult [ ] {
1718 const { boxes } = props . section ;
1819 return boxes
1920 . filter ( b => b . children . length > 0 )
20- . map ( b => {
21+ . map ( ( b , boxIndex ) => {
2122 const children = props . nextSection ! . boxes . filter ( child => b . children . some ( c => getEntityId ( c ) === child . entity_id ) ) ;
2223 const connections = getChildConnections ( b , children , props . connectionsByParent . get ( b . config ) ) . filter ( ( c , i ) => {
2324 if ( c . state > 0 ) {
@@ -46,7 +47,7 @@ export function renderBranchConnectors(props: {
4647 < defs >
4748 ${ connections . map (
4849 ( c , i ) => svg `
49- < linearGradient id ="gradient ${ b . entity_id + i } ">
50+ < linearGradient id ="gradient${ props . sectionIndex } . ${ boxIndex } . ${ i } ">
5051 < stop offset ="0% " stop-color ="${ c . startColor } "> </ stop >
5152 < stop offset ="100% " stop-color ="${ c . endColor } "> </ stop >
5253 </ linearGradient >
@@ -58,7 +59,7 @@ export function renderBranchConnectors(props: {
5859 < path d ="M0,${ c . startY } C50,${ c . startY } 50,${ c . endY } 100,${ c . endY } L100,${ c . endY + c . endSize } C50,${
5960 c . endY + c . endSize
6061 } 50,${ c . startY + c . startSize } 0,${ c . startY + c . startSize } Z "
61- fill ="url(#gradient${ b . entity_id + i } ) " fill-opacity ="${ c . highlighted ? 0.85 : 0.4 } " />
62+ fill ="url(#gradient${ props . sectionIndex } . ${ boxIndex } . ${ i } ) " fill-opacity ="${ c . highlighted ? 0.85 : 0.4 } " />
6263 ` ,
6364 ) }
6465 ` ;
@@ -70,6 +71,7 @@ export function renderSection(props: {
7071 config : Config ,
7172 section : SectionState ,
7273 nextSection ?: SectionState ,
74+ sectionIndex : number ,
7375 highlightedEntities : EntityConfigInternal [ ] ,
7476 statePerPixelY : number ,
7577 connectionsByParent : Map < EntityConfigInternal , ConnectionState [ ] > ,
0 commit comments