Introduced an offset limit to prevent the dropdown from going far right
This commit is contained in:
parent
f6f52b43b5
commit
98dbb8e23d
1 changed files with 9 additions and 1 deletions
|
@ -90,7 +90,15 @@
|
||||||
const input = this.filteredSearchInput;
|
const input = this.filteredSearchInput;
|
||||||
const inputText = input.value.slice(0, input.selectionStart);
|
const inputText = input.value.slice(0, input.selectionStart);
|
||||||
const filterIconPadding = 27;
|
const filterIconPadding = 27;
|
||||||
const offset = gl.text.getTextWidth(inputText, this.font) + filterIconPadding;
|
let offset = gl.text.getTextWidth(inputText, this.font) + filterIconPadding;
|
||||||
|
|
||||||
|
const currentDropdownWidth = this.mapping[key].element.clientWidth === 0 ? 200 :
|
||||||
|
this.mapping[key].element.clientWidth;
|
||||||
|
const offsetMaxWidth = this.filteredSearchInput.clientWidth - currentDropdownWidth;
|
||||||
|
|
||||||
|
if (offsetMaxWidth < offset) {
|
||||||
|
offset = offsetMaxWidth;
|
||||||
|
}
|
||||||
|
|
||||||
this.mapping[key].reference.setOffset(offset);
|
this.mapping[key].reference.setOffset(offset);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue