Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use unicode ellipsis
  • Loading branch information
christian-byrne committed Jul 14, 2024
commit a94def9349023f2fe171a5963d48e136ebb253c3
13 changes: 5 additions & 8 deletions src/litegraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -9963,14 +9963,11 @@ LGraphNode.prototype.executeAction = function(action)
const availableWidth = inputWidth - labelWidth
const textWidth = ctx.measureText(v).width;
if (textWidth > availableWidth) {
const ellipsis = "...";
const ellipsisWidth = ctx.measureText(ellipsis).width;
const ELLIPSIS = "\u2026";
const ellipsisWidth = ctx.measureText(ELLIPSIS).width;
const maxCharWidth = ctx.measureText("W").width;
if (availableWidth == 0) {
v = "";
}
else if (availableWidth <= ellipsisWidth) {
v = ellipsis;
if (availableWidth <= ellipsisWidth) {
v = "\u2024"; // One dot leader
} else {
const overflowWidth = (textWidth + ellipsisWidth) - availableWidth;
// Only last 3 truncated characters need to be measured for exact precision
Expand All @@ -9980,7 +9977,7 @@ LGraphNode.prototype.executeAction = function(action)
while (ctx.measureText(v).width + ellipsisWidth > availableWidth) {
v = v.substr(0, v.length - 1);
}
v += ellipsis;
v += ELLIPSIS;
}
}
ctx.fillText(
Expand Down