Link Hints: fix start value calculation (#2970)

* Link Hints: fix start value calculation

* fix comment
This commit is contained in:
Christian Günter 2019-10-14 07:39:56 +02:00 committed by Lars Hvam
parent b8cc55ec3f
commit bc082b15b0

View File

@ -827,8 +827,12 @@ function LinkHints(linkHintHotKey){
}
LinkHints.prototype.getHintStartValue = function(targetsCount){
// if we have 321 tooltips we start from 100
var maxHintStringLength = targetsCount.toString().length;
// e.g. if we have 89 tooltips we start from 10
// if we have 90 tooltips we start from 100
// if we have 900 tooltips we start from 1000
var
baseLength = Math.pow(10, targetsCount.toString().length - 1),
maxHintStringLength = (targetsCount + baseLength).toString().length;
return Math.pow(10, maxHintStringLength - 1);
};