Kaydet (Commit) bdf2b506 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Intermediate commit of experimental iOS app hacking

Change-Id: I9326c9684a9c53f1f9a3ea5603bcb44c941e8918
üst 6cc508ae
......@@ -155,10 +155,22 @@
- (void)panGesture:(UIPanGestureRecognizer *)gestureRecognizer
{
static enum { NONE, TOPLEFT, BOTTOMRIGHT } draggedHandle = NONE;
static CGFloat previousX = 0.0f, previousY = 0.0f;
static CGFloat previousX, previousY;
CGPoint translation = [gestureRecognizer translationInView:self];
if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
previousX = previousY = 0;
}
CGFloat deltaX = translation.x - previousX;
CGFloat deltaY = translation.y - previousY;
NSLog(@"drag: %f,%f", deltaX, deltaY);
previousX = translation.x;
previousY = translation.y;
if (gestureRecognizer.state == UIGestureRecognizerStateBegan &&
gestureRecognizer.numberOfTouches == 1) {
if (CGRectContainsPoint([self topLeftResizeHandle],
......@@ -172,16 +184,17 @@
if (draggedHandle == TOPLEFT) {
const int N = self.selectionRectangleCount;
self.selectionRectangles[0].origin.x += translation.x;
self.selectionRectangles[0].origin.y += translation.y;
self.selectionRectangles[0].size.width -= translation.x;
self.selectionRectangles[0].size.height -= translation.y;
self.selectionRectangles[0].origin.x += deltaX;
self.selectionRectangles[0].origin.y += deltaY;
self.selectionRectangles[0].size.width -= deltaX;
self.selectionRectangles[0].size.height -= deltaY;
#if 0
touch_lo_selection_attempt_resize(self.documentHandle,
self.selectionRectangles,
self.selectionRectangleCount);
#else
touch_lo_tap(0, 0);
touch_lo_mouse(self.selectionRectangles[0].origin.x,
self.selectionRectangles[0].origin.y,
DOWN, NONE);
......@@ -197,16 +210,15 @@
} else if (draggedHandle == BOTTOMRIGHT) {
const int N = self.selectionRectangleCount;
self.selectionRectangles[N-1].origin.x += translation.x;
self.selectionRectangles[N-1].origin.y += translation.y;
self.selectionRectangles[N-1].size.width += translation.x;
self.selectionRectangles[N-1].size.height += translation.y;
self.selectionRectangles[N-1].size.width += deltaX;
self.selectionRectangles[N-1].size.height += deltaY;
#if 0
touch_lo_selection_attempt_resize(self.documentHandle,
self.selectionRectangles,
self.selectionRectangleCount);
#else
touch_lo_tap(0, 0);
touch_lo_mouse(self.selectionRectangles[0].origin.x,
self.selectionRectangles[0].origin.y,
DOWN, NONE);
......@@ -222,16 +234,10 @@
}
if (gestureRecognizer.state != UIGestureRecognizerStateBegan) {
int deltaX = translation.x - previousX;
int deltaY = translation.y - previousY;
// NSLog(@"panGesture: pan (delta): (%d,%d)", deltaX, deltaY);
touch_lo_pan(deltaX, deltaY);
}
previousX = translation.x;
previousY = translation.y;
}
- (void)pinchGesture:(UIPinchGestureRecognizer *)gestureRecognizer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment