Skip to content

Commit

Permalink
reset gesture timer
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Edwards authored and Kevin Edwards committed Jul 15, 2009
1 parent 5bd2400 commit cb608f2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions ChemDraw/Classes/DrawView.h
Expand Up @@ -62,6 +62,9 @@

-(void) onTimer;

@property (nonatomic, retain) NSTimer *symbolTimer;


@end


10 changes: 7 additions & 3 deletions ChemDraw/Classes/DrawView.m
Expand Up @@ -21,6 +21,7 @@

@implementation DrawView

@synthesize symbolTimer;

// this init method never seems to really get called
- (id)initWithFrame:(CGRect)frame {
Expand Down Expand Up @@ -280,9 +281,8 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

if([programState currentState] == GESTURE_MODE) {
if([symbolTimer isValid] == NO) {
symbolTimer = [NSTimer scheduledTimerWithTimeInterval:0.80 target:self selector:@selector(onTimer) userInfo:nil repeats:YES];
}
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.80 target:self selector:@selector(onTimer) userInfo:nil repeats:YES];
[self setSymbolTimer:timer];
}


Expand Down Expand Up @@ -361,6 +361,7 @@ - (void) setupToolbarButtonArrays {

}


- (void) renderPoint:(CGPoint)point withContext:(CGContextRef)ctx {

CGContextSetRGBFillColor(ctx, 0, 255, 0, 1.0);
Expand All @@ -386,6 +387,9 @@ -(void) onTimer {
// [programState setCurrentState:DEBUG_MODE];
[programState setCurrentState:SELECT_OBJECT];
[symbolTimer invalidate];
[self setSymbolTimer:NULL];

[gesturePoints clearPoints];
[self setNeedsDisplay]; // redraw entire screen


Expand Down
1 change: 1 addition & 0 deletions ChemDraw/Classes/PointObjectMap.h
Expand Up @@ -19,6 +19,7 @@
NSMutableArray *compressedPointObjects;
}

- (void) clearPoints;
- (void) addPoint:(PointObject *)pointObject;

- (void) renderWithContext:(CGContextRef)ctx;
Expand Down
9 changes: 7 additions & 2 deletions ChemDraw/Classes/PointObjectMap.m
Expand Up @@ -36,9 +36,14 @@ - (PointObjectMap *) init {

}

- (void) clearPoints {
[pointObjects removeAllObjects];
[completePointSet removeAllObjects];
[compressedPointObjects removeAllObjects];
}

- (void) addPoint:(PointObject *)pointObject {
[pointObjects addObject:pointObject];

}

- (CGPoint) northPoint {
Expand Down Expand Up @@ -133,7 +138,7 @@ - (CGFloat) xDistance {
// removes any points that are identical
// then we are ready for the symbolic binary field comparison
- (CharacterMatch *) compressPoints {

float shiftFromXOrigin = [self westPoint].x;
float shiftFromYOrigin = [self northPoint].y;

Expand Down

0 comments on commit cb608f2

Please sign in to comment.