Add pan gesture handling
I get exactly the same kind of artefacts as in the Android app, which I guess is good as it is at least consistent, as the implementation at the LO layer is identical... Change-Id: Icf0690fd2c48a133cb66de2ab7977b7088d2199e
This commit is contained in:
parent
7711a60a64
commit
1e7bf8de3b
@ -59,8 +59,10 @@ static View *theView;
|
||||
self.view->textView.delegate = self;
|
||||
|
||||
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(tapGesture:)];
|
||||
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self.view action:@selector(panGesture:)];
|
||||
|
||||
[self.window addGestureRecognizer: tapRecognizer];
|
||||
[self.window addGestureRecognizer: panRecognizer];
|
||||
|
||||
NSLog(@"statusBarOrientation: %d", [[UIApplication sharedApplication] statusBarOrientation]);
|
||||
|
||||
|
@ -15,7 +15,8 @@
|
||||
UITextView* textView;
|
||||
}
|
||||
- (void)drawRect:(CGRect)rect;
|
||||
- (void)tapGesture:(UIGestureRecognizer *)gestureRecognizer;
|
||||
- (void)tapGesture:(UITapGestureRecognizer *)gestureRecognizer;
|
||||
- (void)panGesture:(UIPanGestureRecognizer *)gestureRecognizer;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
// NSLog(@"drawRect: lo_render_windows took %f s", [[NSDate date] timeIntervalSinceDate: startDate]);
|
||||
}
|
||||
|
||||
- (void) tapGesture:(UIGestureRecognizer *)gestureRecognizer
|
||||
- (void)tapGesture:(UITapGestureRecognizer *)gestureRecognizer
|
||||
{
|
||||
if ([gestureRecognizer state] == UIGestureRecognizerStateEnded) {
|
||||
CGPoint location = [gestureRecognizer locationInView: self];
|
||||
@ -57,6 +57,16 @@
|
||||
NSLog(@"tapGesture: %@", gestureRecognizer);
|
||||
}
|
||||
|
||||
- (void)panGesture:(UIPanGestureRecognizer *)gestureRecognizer
|
||||
{
|
||||
if ([gestureRecognizer state] == UIGestureRecognizerStateEnded) {
|
||||
CGPoint translation = [gestureRecognizer translationInView: self];
|
||||
NSLog(@"panGesture: pan: (%d,%d)", (int)translation.x, (int)translation.y);
|
||||
lo_pan(translation.x, translation.y);
|
||||
} else
|
||||
NSLog(@"panGesture: %@", gestureRecognizer);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// vim:set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
@ -49,6 +49,7 @@ void lo_runMain();
|
||||
void lo_set_view_size(int width, int height);
|
||||
void lo_render_windows(CGContextRef context, CGRect rect);
|
||||
void lo_tap(int x, int y);
|
||||
void lo_pan(int x, int y);
|
||||
void lo_keyboard_input(int c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -402,6 +402,17 @@ void lo_tap(int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
extern "C"
|
||||
void lo_pan(int x, int y)
|
||||
{
|
||||
SalFrame *pFocus = IosSalInstance::getInstance()->getFocusFrame();
|
||||
if (pFocus) {
|
||||
SAL_INFO( "vcl.ios", "scroll: " << "(" << x << "," << y << ")" );
|
||||
ScrollEvent aEvent( x, y );
|
||||
Application::PostScrollEvent(VCLEVENT_WINDOW_SCROLL, pFocus->GetWindow(), &aEvent);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C"
|
||||
void lo_keyboard_input(int c)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user