yy20111011659 / route-me

Automatically exported from code.google.com/p/route-me
0 stars 0 forks source link

Deceleration bug causes multiple timers to be created, run indefinitely #151

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Enable deceleration
2. Drag and release twice, quickly
3. Deceleration timer is started twice (once for each touchesEnded), the 
latter overwriting the reference to the former.

Fix is to wrap the timer starting code in a test:

        if ( !_decelerationTimer ) {
            _decelerationTimer = [NSTimer scheduledTimerWithTimeInterval:0.01f 
                                                                 target:self
                                                               selector:@selector(incrementDeceleration:) 
                                                               userInfo:nil 
                                                                repeats:YES];
        }

Original issue reported on code.google.com by michael@tyson.id.au on 11 Oct 2010 at 5:14