Skip to content

Commit 858d31d

Browse files
committed
truncate name and display tooltip in design enumeration
1 parent fbd38c9 commit 858d31d

File tree

1 file changed

+11
-3
lines changed
  • src/main/resources/static/js

1 file changed

+11
-3
lines changed

src/main/resources/static/js/knox.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,23 +328,31 @@ $('#enumerate-designs-tooltip').click(() => {
328328
var svgimg = document.createElementNS("http://www.w3.org/2000/svg", "image");
329329
svgimg.setAttribute("height", "100");
330330
svgimg.setAttribute("width", "100");
331-
svgimg.setAttribute("id", "testimg2");
332331
svgimg.style.display = "block";
333332
svgimg.setAttributeNS(
334333
"http://www.w3.org/1999/xlink",
335334
"href", getSBOLImage(element.roles[0]));
336335
svgimg.setAttribute("x", "" + pen.x);
337336
svgimg.setAttribute("y", "" + pen.y);
337+
$(svgimg).tooltipster({
338+
content: element.id
339+
});
338340
svg.appendChild(svgimg);
339341

340342
var svgtext = document.createElementNS("http://www.w3.org/2000/svg", "text");
341343
svgtext.setAttribute("height", "100");
342344
svgtext.setAttribute("width", "100");
343345
svgtext.setAttribute("id", "testimg2");
344346
svgtext.setAttribute("font-family", "sans-serif");
345-
svgtext.setAttribute("font-size", "12px");
347+
svgtext.setAttribute("font-size", "10px");
346348
svgtext.setAttribute("fill", "black");
347-
svgtext.textContent = element.id;
349+
350+
let text = element.id;
351+
if (text.length > 10) {
352+
text = text.substring(0, 7) + '...';
353+
}
354+
svgtext.textContent = text;
355+
348356
svgtext.style.display = "block";
349357
svgtext.setAttribute("x", "" + (pen.x + 0.40*celWidth));
350358
if (element.roles[0] === "CDS") {

0 commit comments

Comments
 (0)