1
0
Fork 0
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:
Mark Haslinghuis 2021-07-23 22:32:39 +02:00
parent 5ed5d04831
commit 1b26bb5dcc
No known key found for this signature in database
GPG key ID: 198B0F616296A584
4 changed files with 14 additions and 11 deletions

View file

@ -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;
}