This commit is contained in:
Martin Raifer
2022-11-26 10:28:20 +01:00
parent 59b10b7974
commit 6c9ffdc854
2 changed files with 5 additions and 7 deletions
+1 -3
View File
@@ -453,9 +453,7 @@ export function uiFieldCombo(field, context) {
if (_isSemi) {
_inputWrap.call(_lengthIndicator);
} else if (_isMulti) {
// todo: implement
} else {
} else if (!_isMulti) {
_container.call(_lengthIndicator);
}
+4 -4
View File
@@ -30,12 +30,12 @@ export function uiLengthIndicator(maxChars) {
lengthIndicator.update = function(val) {
const strLen = utilUnicodeCharsCount(utilCleanOsmString(val, Number.POSITIVE_INFINITY));
var lengthIndicator = _wrap.selectAll('span.length-indicator')
let indicator = _wrap.selectAll('span.length-indicator')
.data([strLen]);
lengthIndicator = lengthIndicator.enter()
indicator.enter()
.append('span')
.merge(lengthIndicator)
.merge(indicator)
.classed('length-indicator', true)
.classed('limit-reached', d => d > maxChars)
.style('border-right-width', d => `${Math.abs(maxChars - d) * 2}px`)
@@ -52,7 +52,7 @@ export function uiLengthIndicator(maxChars) {
} else {
_tooltip.hide();
}
}
};
return lengthIndicator;
}