timer support for drag-scrolling

This commit is contained in:
daboe01
2015-03-01 21:16:49 +01:00
parent fc2f5c3615
commit cbb4565a48
+13 -1
View File
@@ -118,7 +118,7 @@ var kDelegateRespondsTo_textShouldBeginEditing
BOOL _drawCaret;
CPTimer _caretTimer;
CPTimer _scollingTimer;
CPTimer _scrollingTimer;
CGRect _caretRect;
BOOL _scrollingDownward;
@@ -791,6 +791,13 @@ var kDelegateRespondsTo_textShouldBeginEditing
}
[self setSelectedRange:setRange affinity:0 stillSelecting:YES];
_scrollingTimer = [CPTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(_supportScrolling:) userInfo:nil repeats:YES]; // fixme: only start if we are in the scrolling areas
}
- (void)_supportScrolling:(CPTimer)aTimer
{
[self mouseDragged:[CPApp currentEvent]];
}
- (void)_clearRange:(CPRange)range
@@ -864,6 +871,11 @@ var kDelegateRespondsTo_textShouldBeginEditing
var point = [_layoutManager locationForGlyphAtIndex:[self selectedRange].location];
_stickyXLocation = point.x;
_startTrackingLocation = _selectionRange.location;
if (_scrollingTimer)
{ [_scrollingTimer invalidate];
_scrollingTimer = nil;
}
}
- (void)moveDown:(id)sender