Split Hover Text by New Lines

This commit is contained in:
Kam committed 2025-06-03 19:06:07 -04:00
1 parent 49757c7cb5
commit 96496a40e2
1 file changed
+10 -2
@@ -136,12 +136,20 @@ public abstract class GuiDiagram extends Gui {
String nameFrom = iconFrom != null ? getIconName(iconFrom) : "Unknown";
String nameTo = iconTo != null ? getIconName(iconTo) : "Unknown";
tooltip.add(nameFrom + " > " + nameTo + ":");
tooltip.add(conn.hoverText);
// Split Hover Text by newlines
if (conn.hoverText != null && !conn.hoverText.isEmpty()) {
String[] lines = conn.hoverText.split("\n");
tooltip.addAll(Arrays.asList(lines));
}
if (allowTwoWay) {
DiagramConnection reverse = getConnectionByIds(conn.idTo, conn.idFrom);
if (reverse != null) {
tooltip.add(nameTo + " > " + nameFrom + ":");
tooltip.add(reverse.hoverText);
// Split Hover Text by newlines
if (reverse.hoverText != null && !reverse.hoverText.isEmpty()) {
String[] lines = reverse.hoverText.split("\n");
tooltip.addAll(Arrays.asList(lines));
}
}
}
return tooltip;