How to Simulate Pinch on BlackBerry 10 Simulator ?

1k views Asked by At

I am developing a project using the Native SDK for BlackBerry 10. I am using BlackBerry 10 Dev Alpha Simulator for testing purposes. I can't seem to simulate a pinch event, and did some searching just to find out that this is not implemented yet in the simulator.

So basically, I need a method to programatically create a pinch and run it when some other event is triggered. What is the easiest way to do this?

Edit:

I am not looking for language-agnostic solutions. I need an architectural implementation. How would one go on using gesture_pinch_t to create a pinch event (even with hardcoded parameters)?

2

There are 2 answers

2
Graham Robertson On

I'm more involved with the WebWorks and AIR team at RIM, but off the top of my head a language agnostic solution would be something like the following:

  • You have some handler for the pinch event, which is able to process the data passed by the event (gesture_pinch_t)
  • Instead of using the pinch event to trigger the callback, you can simulate a pinch with some other obtainable event (perhaps a double tap or a test toggle button that you turn on and then all touch events become the start of a simulated pinch).
  • You then make the centroid property your starting coordinate, and then as you drag with your finger (or in this case, with your cursor in the simulator), you calculate the distance property by subtracting the current coordinate with the origin coordinate you made your centroid.

Again, I haven't delved into the NDK specifically, but this is the approach I would take with JavaScript or ActionScript and is quite do-able. I wish I could write a code snippet but hopefully this helps take you in the right direction.

Cheers!

0
donturner On

Just to let you know that multiple touch gestures are now supported in the simulator. Just right click and drag to add a touch event, do it again to simulate more touch events, then left click to execute them at the same time.

Example of pinch gesture:

enter image description here