SlideToCancel icon indicating copy to clipboard operation
SlideToCancel copied to clipboard

Incorrect math

Open H2CO3 opened this issue 12 years ago • 0 comments

On line 176 in SlideToCancelViewController.m, it reads:


- (void) sliderChanged: (UISlider *) sender
{
    // Fade the text as the slider moves to the right. This code makes the
    // text totally dissapear when the slider is 35% of the way to the right.
    label.alpha = MAX(0.0, 1.0 - (slider.value * 3.5));

    // Stop the animation if the slider moved off the zero point
    if (slider.value != 0) {
        [self stopTimer];
        [label.layer setNeedsDisplay];
    }
}

Lines 178-180:

// Fade the text as the slider moves to the right. This code makes the
// text totally dissapear when the slider is 35% of the way to the right.
label.alpha = MAX(0.0, 1.0 - (slider.value * 3.5));

It's not true. It makes the text disappear when it reaches 1/3.5 which is approx. 28.6 %. The corrected line 180 would be:

label.alpha = MAX(0.0, 1.0 - (slider.value / 0.35));

H2CO3 avatar Nov 02 '11 13:11 H2CO3