| 88 | } |
| 89 | |
| 90 | void CodeDigit::setDigit(int digit) { |
| 91 | if ((_dataDigit == digit) && _animation.animating()) { |
| 92 | return; |
| 93 | } |
| 94 | _dataDigit = digit; |
| 95 | if (_viewDigit != digit) { |
| 96 | _animation.stop(); |
| 97 | if (digit == kDigitNone) { |
| 98 | _animation.start([=](float64 value) { |
| 99 | update(); |
| 100 | if (!value) { |
| 101 | _viewDigit = digit; |
| 102 | } |
| 103 | }, 1., 0., st::universalDuration); |
| 104 | } else { |
| 105 | _viewDigit = digit; |
| 106 | _animation.start([=] { update(); }, 0, 1., st::universalDuration); |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | int CodeDigit::digit() const { |
| 112 | return _dataDigit; |
no test coverage detected