Closed drahkrub closed 6 years ago
That's because your given from
(80) is a 2-digit number, and shown 00
is the last 2-digit of 100 (80 + 10 + 10).
As a flip scoreboard won't change it's number of digits in real world,
the number of digits won't change too since the Flip
instance created, that would be the maxLenNum
of options' given from
and to
.
I've though it before and it's made to be that way: It is confusing if the number of digits is changing when user already thought it is a 2-digit flip scoreboard.
I'd like to make the maxLenNum
a param in options, instead of changing the number of digits suddenly.
Ok, making maxLenNum
a param would be an improvement at least. But why limit yourself to the "real world"?! ;-) Without the ability of changing the number of digits if needed, this very nice lib is not usable if the maximal number (or max. maxLenNum
) is unknown in advance. Or one has to live with a lot of leading zeros which looks ugly.
Ok, 'not usable' was a little bit harsh and most of the time the maximal number to be displayed is known in advance, so maxLenNum
as a param would be a nice improvement. :+1:
Another idea: What about introducing a flag which toggles the display of leading zeros as blanks (to avoid the ugliness of several leading zeros)?
It is a little bit weird for me seeing number decrease and leading zeroes disappear in a sudden.
Leading zeros should not disappear, they should not be visible at all: "120" minus 40 leads to " 80" (blank in first place). I would use such a flag... ;-)
new Flip({ maxLenNum:5 ... }); I tried like this , but number of digits didn't increase with the number ? how to solve , please ?
new Flip({ maxLenNum:5 ... }); I tried like this , but number of digits didn't increase with the number ? how to solve , please ?
make sure that maxLenNum
only works under branch maxLenNum
instead of master
for more discussion of invisible leading zeros, see #12
See https://codepen.io/bgraves/pen/gKZwYP - after hitting plus two times, 00 is shown.