diff options
author | Lasse Haugen <haugen.lasse@gmail.com> | 2023-04-05 22:35:38 +0200 |
---|---|---|
committer | Lasse Haugen <haugen.lasse@gmail.com> | 2023-04-07 18:43:03 +0200 |
commit | 4cf3c338ad7bc5b171eb3b7d18c8d5494ac1a6df (patch) | |
tree | ae7bc513d81c0abb6cba7f8c7f530cf569ee72fd /web/js/nms-map.js | |
parent | 73712230cccb52757abdf3b3197b441ee301638a (diff) |
tg23 fixtg23
Diffstat (limited to 'web/js/nms-map.js')
-rw-r--r-- | web/js/nms-map.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/web/js/nms-map.js b/web/js/nms-map.js index d5bc044..18a22b4 100644 --- a/web/js/nms-map.js +++ b/web/js/nms-map.js @@ -333,8 +333,17 @@ nmsMap._drawSwitch = function(sw) this._c.switch.ctx.shadowBlur = 0; var switchtext = sw; var textl = switchtext.length; - if (textl > 12) - switchtext = switchtext.slice(0,7) + ".." + switchtext.slice(textl-2,textl); + // Cut switch name if longer than this + var text_cut_l = 14; + // Cut switch name by more if we have a status indicator + if (this._info[sw]) { + text_cut_l -= this._info[sw].length + } + if (textl > text_cut_l) { + var rhs_text = this._info[sw]; + + switchtext = switchtext.slice(0,text_cut_l - 5) + ".." + switchtext.slice(textl-2,textl); + } if (this._lastName[sw] != switchtext) { nmsMap.stats.textSwitchDraws++; |