@@ -9,7 +9,7 @@ export default class GraphLinkTypesPlugin extends Plugin {
99 // Retrieve the Dataview API
1010 api = getAPI ( ) ;
1111 // A map to keep track of the text nodes created for each link
12- nodeTextMap : Map < CustomLink , PIXI . Text > = new Map ( ) ;
12+ linkTextMap : Map < CustomLink , PIXI . Text > = new Map ( ) ;
1313 currentRenderer : CustomRenderer | null = null ;
1414 animationFrameId : number | null = null ;
1515
@@ -175,8 +175,8 @@ export default class GraphLinkTypesPlugin extends Plugin {
175175 }
176176
177177 // If text already exists for this link, remove text
178- if ( this . nodeTextMap . has ( link ) ) {
179- const existingText = this . nodeTextMap . get ( link ) ! ;
178+ if ( this . linkTextMap . has ( link ) ) {
179+ const existingText = this . linkTextMap . get ( link ) ! ;
180180 renderer . px . stage . removeChild ( existingText ) ;
181181 existingText . destroy ( ) ;
182182 }
@@ -192,7 +192,7 @@ export default class GraphLinkTypesPlugin extends Plugin {
192192 text . alpha = 0.7 ;
193193 text . anchor . set ( 0.5 , 0.5 ) ;
194194 // Add the text node to the map and the renderer
195- this . nodeTextMap . set ( link , text ) ;
195+ this . linkTextMap . set ( link , text ) ;
196196
197197 this . updateTextPosition ( renderer , link ) ;
198198 renderer . px . stage . addChild ( text ) ;
@@ -205,7 +205,7 @@ export default class GraphLinkTypesPlugin extends Plugin {
205205 return ;
206206 }
207207
208- const text : PIXI . Text | undefined = this . nodeTextMap . get ( link ) ;
208+ const text : PIXI . Text | undefined = this . linkTextMap . get ( link ) ;
209209 // Calculate the mid-point of the link
210210 const midX : number = ( link . source . x + link . target . x ) / 2 ;
211211 const midY : number = ( link . source . y + link . target . y ) / 2 ;
@@ -221,13 +221,13 @@ export default class GraphLinkTypesPlugin extends Plugin {
221221
222222 // Remove all text nodes from the graph
223223 destroyMap ( renderer : CustomRenderer ) : void {
224- if ( this . nodeTextMap . size > 0 ) {
225- this . nodeTextMap . forEach ( ( text , link ) => {
224+ if ( this . linkTextMap . size > 0 ) {
225+ this . linkTextMap . forEach ( ( text , link ) => {
226226 if ( text && renderer . px && renderer . px . stage && renderer . px . stage . children && renderer . px . stage . children . includes ( text ) ) {
227227 renderer . px . stage . removeChild ( text ) ;
228228 text . destroy ( ) ;
229229 }
230- this . nodeTextMap . delete ( link ) ;
230+ this . linkTextMap . delete ( link ) ;
231231 } ) ;
232232 }
233233 }
@@ -273,7 +273,7 @@ export default class GraphLinkTypesPlugin extends Plugin {
273273 renderer . links . forEach ( ( link : CustomLink ) => {
274274 if ( updateMap ) {
275275 // Add text for new links.
276- if ( ! this . nodeTextMap . has ( link ) ) {
276+ if ( ! this . linkTextMap . has ( link ) ) {
277277 this . createTextForLink ( renderer , link ) ;
278278 }
279279 // Add all links to the set of links, so that we can check quickly when removing text.
@@ -284,13 +284,13 @@ export default class GraphLinkTypesPlugin extends Plugin {
284284
285285 // Remove text that should no longer be on stage.
286286 if ( updateMap ) {
287- this . nodeTextMap . forEach ( ( text , link : CustomLink ) => {
287+ this . linkTextMap . forEach ( ( text , link : CustomLink ) => {
288288 if ( ! rendererLinks . has ( link ) ) {
289289 if ( text && renderer . px && renderer . px . stage && renderer . px . stage . children && renderer . px . stage . children . includes ( text ) ) {
290290 renderer . px . stage . removeChild ( text ) ;
291291 text . destroy ( ) ;
292292 }
293- this . nodeTextMap . delete ( link ) ;
293+ this . linkTextMap . delete ( link ) ;
294294 }
295295 } ) ;
296296 }
0 commit comments