@@ -274,33 +274,24 @@ export class EntriesLinkOverlay extends HTMLElement {
274274 }
275275
276276 /*
277- * When only one entry from the connection is visible, the connection
278- * line becomes a gradient from the visible entry to the edge of
279- * the screen towards the entry that is not visible.
277+ * Calculates the gradient stop percentage when only one entry is visible.
278+ * This percentage represents the portion of the line visible within the canvas,
279+ * used to create a fade effect towards the off-screen entry.
280+ * When one entry is off-screen, it is impossible to tell where exactly the line
281+ * is going to. Therefore, to not needlessly take space, the faded line is very short.
280282 *
281283 * To achieve this, we need to calculate what percentage of the
282- * visible screen the connection is currently occupying and apply
284+ * shole connection the short line is currently occupying and apply
283285 * that gradient to the visible connection part.
284286 */
285287 #partlyVisibleConnectionLinePercentage( ) : number {
286288 if ( ! this . #canvasRect) {
287289 return 100 ;
288290 }
291+ const fadedLineLength = 25 ;
289292
290293 const lineLength = this . #coordinateTo. x - ( this . #coordinateFrom. x + this . #fromEntryDimensions. width ) ;
291- let visibleLineLength = 0 ;
292-
293- // If the visible entry is the 'From' entry, find the length of the visible arrow by
294- // subtracting the point where the arrow starts from the whole canvas length.
295- // If the 'to' entry is visible, the coordinate of the entry will be equal to
296- // the visible arrow length.
297- if ( this . #entryFromVisible && ! this . #entryToVisible) {
298- visibleLineLength = this . #canvasRect. width - ( this . #coordinateFrom. x + this . #fromEntryDimensions. width ) ;
299- } else if ( ! this . #entryFromVisible && this . #entryToVisible) {
300- visibleLineLength = this . #coordinateTo. x ;
301- }
302-
303- const visibleLineFromTotalPercentage = ( visibleLineLength * 100 ) / lineLength ;
294+ const visibleLineFromTotalPercentage = ( fadedLineLength * 100 ) / lineLength ;
304295
305296 return ( visibleLineFromTotalPercentage < 100 ) ? visibleLineFromTotalPercentage : 100 ;
306297 }
0 commit comments