mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-18 22:05:13 +03:00
Adjust Modes Name CSS min-width
This commit is contained in:
parent
5ed5d04831
commit
1b26bb5dcc
4 changed files with 14 additions and 11 deletions
|
@ -274,20 +274,11 @@ PortHandler.selectPort = function(ports) {
|
|||
|
||||
PortHandler.setPortsInputWidth = function() {
|
||||
|
||||
function getWidthofText(text) {
|
||||
const canvas = document.createElement('canvas');
|
||||
const context = canvas.getContext('2d');
|
||||
|
||||
context.font = getComputedStyle(document.body).font;
|
||||
|
||||
return Math.ceil(context.measureText(text).width);
|
||||
}
|
||||
|
||||
function findMaxLengthOption(selectEl) {
|
||||
let max = 0;
|
||||
|
||||
$(selectEl.options).each(function () {
|
||||
const textSize = getWidthofText(this.textContent);
|
||||
const textSize = getTextWidth(this.textContent);
|
||||
if (textSize > max) {
|
||||
max = textSize;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue