Skip to content

Commit 170a346

Browse files
committed
Change how non-geometric elements are labeled
Now, the first pixelmap, heatmap, etc. element won't include a number as part of its label when listed in the draw widget. Subsequent elements of the same type will have a number.
1 parent fe200c7 commit 170a346

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

histomicsui/web_client/templates/panels/drawWidgetElement.pug

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
- var counts = {};
22
- var displayIdOffset = 0;
33
- var pixelmap = false;
4+
- var typeCounts = {};
45
if elements.length
56
each element in elements
67
-
@@ -9,15 +10,23 @@ if elements.length
910
var groupName = element['group'] ? element['group'] : 'default';
1011
var type = element.type == 'polyline' ? (element.closed ? 'polygon' : 'line') : element.type;
1112
var displayId = ++displayIdOffset + displayIdStart;
12-
var label = ((element.label || {}).value || type) + ' ' + displayId;
13+
var label = ((element.label || {}).value || type);
1314
if (['point', 'polyline', 'rectangle', 'ellipse', 'circle'].includes(element.type)) {
1415
if (counts[groupName]) {
1516
counts[groupName]++;
1617
} else {
1718
counts[groupName] = 1;
1819
}
19-
label = groupName + ' ' + label;
20-
} else if (element.type === 'pixelmap') {
20+
label = groupName + ' ' + label + ' ' + displayId;
21+
} else {
22+
if (typeCounts[type] > 0) {
23+
label = label + ' ' + displayId;
24+
typeCounts[type]++;
25+
} else {
26+
typeCounts[type] = 1;
27+
}
28+
}
29+
if (element.type === 'pixelmap') {
2130
pixelmap = true;
2231
}
2332
.h-element(data-id=element.id, class=classes)

0 commit comments

Comments
 (0)