jQuery-Knob icon indicating copy to clipboard operation
jQuery-Knob copied to clipboard

Invalid mechanism for counting the font size for float value

Open githubjeka opened this issue 10 years ago • 0 comments

<input value="0.572" class="knob">
<input value="0.428" class="knob">
<input value="0" class="knob">
<input value="0" class="knob">

MAX = 0.572 + 0.428 + 0 + 0 = 1

image

In https://github.com/aterrien/jQuery-Knob/blob/1.2.11/js/jquery.knob.js#L714

(this.w / s) >> 0 // w=112 s=4 result=28px

https://github.com/aterrien/jQuery-Knob/blob/1.2.11/js/jquery.knob.js#L698

var s = max(
                String(Math.abs(this.o.max)).length, // this.o.max =1 length=1
                String(Math.abs(this.o.min)).length, // this.o.min=0  length=1
                2
            ) + 2; //s = 4

I tried set max=1.000 but it's same result.

> String(Math.abs(1.000)).length
> 1

githubjeka avatar Oct 30 '15 07:10 githubjeka