Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4508] iOS: Need the pinch gesture exposed for TIUIView event listeners

GitHub Issuen/a
TypeNew Feature
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2011-09-13T13:28:19.000+0000
Affected Version/sn/a
Fix Version/sSprint 2011-37, Release 1.8.0
ComponentsiOS
Labelsmodule_views
ReporterJohn V Pataki
AssigneeReggie Seagraves
Created2011-06-27T14:46:46.000+0000
Updated2017-03-21T18:27:18.000+0000

Description

We need to have the event handler for pinch gestures available for TIUIView objects and their derivatives This is needed for many projects we've been a apart of. We recently implemented this in the soon to be available openGL module development project (ios only so far) and it seems to work for our needs there. Having this available for all views and objects that are based on view objects would be very useful. Here are the code snippets from the IOS side: Added this to the view initialization: UIPinchGestureRecognizer *pinchRecognizer; pinchRecognizer=[[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(foundPinch:)]; [controller.view addGestureRecognizer:pinchRecognizer]; [pinchRecognizer release]; here's the callback: - (void)foundPinch:(UIPinchGestureRecognizer *)recognizer { NSDictionary *event = [NSDictionary dictionaryWithObjectsAndKeys:NUMDOUBLE(recognizer.scale), @"scale", NUMDOUBLE(recognizer.velocity), @"velocity", nil]; [self.proxy fireEvent:@"pinch" withObject:event]; } here's how we use it now on the opengl view opengl.addEventListener('pinch', function { scale = e.scale; });

Comments

  1. Kincy Clark 2011-06-27

    Per our conversation, assigning to you
  2. John V Pataki 2011-08-08

    While the pinch is being added, the enterprise customer project that needs the "pinch" also needs "long press". It seems reasonable that the effort here can expose both of these gestures together.
  3. Don Thorp 2011-09-13

    Doc reviewed, merged.
  4. John V Pataki 2011-09-15

    We will be testing this based on the AppC customer requirement to use it... which involves being able to pinch to zoom & rotate an image view. I suspect by default pinch exposes the scale property. What will we have to do in ti js to best be able to implement being able to rotate and also pan the view along with pinch to zoom? Is there a recommended way to do this based on they way pinch has been exposed through the module?

JSON Source