Skip to content

Commit 5a1483c

Browse files
authored
Merge pull request #237 from DigitalSlideArchive/fix-counts
Fix counts for some labeled groups.
2 parents 96a8f6c + 5c40cfa commit 5a1483c

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

histomicsui/web_client/templates/panels/drawWidgetElement.pug

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,25 @@ if elements.length
1111
var type = element.type == 'polyline' ? (element.closed ? 'polygon' : 'line') : element.type;
1212
var displayId = ++displayIdOffset + displayIdStart;
1313
var label = ((element.label || {}).value || type);
14-
if (!element.label) {
14+
if (['point', 'polyline', 'rectangle', 'ellipse', 'circle'].includes(element.type)) {
15+
if (counts[groupName]) {
16+
counts[groupName]++;
17+
} else {
18+
counts[groupName] = 1;
19+
}
20+
} else {
21+
if (typeCounts[type] > 0) {
22+
typeCounts[type]++;
23+
} else {
24+
typeCounts[type] = 1;
25+
}
26+
}
27+
if (!(element.label || {}).value) {
1528
if (['point', 'polyline', 'rectangle', 'ellipse', 'circle'].includes(element.type)) {
16-
if (counts[groupName]) {
17-
counts[groupName]++;
18-
} else {
19-
counts[groupName] = 1;
20-
}
2129
label = groupName + ' ' + label + ' ' + displayId;
2230
} else {
23-
if (typeCounts[type] > 0) {
31+
if (typeCounts[type] > 1) {
2432
label = label + ' ' + displayId;
25-
typeCounts[type]++;
26-
} else {
27-
typeCounts[type] = 1;
2833
}
2934
}
3035
}

0 commit comments

Comments
 (0)