Pinch the touch gesture event

My code:

int _lastX = - 1;
int _lastY = - 1;
protected boolean touchEvent (TouchEvent message)
{
Retrieve the new x and y of touch positions
int x = message.getX (1);
int y = message.getY (1);

Boolean isGesture = false;
int eventCode = message.getEvent ();

if(eventCode == TouchEvent.Down)
{
If this event is followed by a move event, we will need
to know the starting point.
_lastX = x;
_lastY = y;

}

if(eventCode == TouchEvent.GESTURE)
{
GHG TouchGesture = message.getGesture ();
int gesEventCode = ges.getEvent ();
If (gesEventCode == TouchGesture.PINCH_END | gesEventCode == TouchGesture.PINCH_UPDATE) {}
isGesture = true;

float pinchM = ges.getPinchMagnitude ();
-To zoom out.
If (pinchM< 0="" ){_renderer.zoom-="">
-Zoom.
If (pinchM > 0) {_renderer.zoom += pinchM / 2.0f ;}}
}

}
{if(!isGesture)}
if(eventCode == TouchEvent.Move)
{
_renderer.isAlt = true;

Calculation of the crossing points
int XmoveSize = x - _lastX;
int YmoveSize = y - _lastY;
If (XmoveSize<>
If (XmoveSize > 0) {_renderer.rotateRX () ;}

If (YmoveSize<>
If (YmoveSize > 0) {_renderer.rotateUZ () ;}

_lastX = x;
_lastY = y;

}

}

if(eventCode == TouchEvent.up) {}
_renderer.isAlt = false;
We have lost contact with the screen, set the last x and y
_lastX = - 1;
_lastY = - 1;
}
Returns true;
}
________________________________________________________

Hello
I took the code above the screen touchscreen blackberry example project and modified a bit to accept the pinch gesture.
Now I get one problem with it, the getPinchmagnitude() method always return a positive value, so how do to be able to know if it was a pinch on or a pinch in the event.

Any response will help.
I thank.

Note something I've tried, but read the API, you must keep the PINCH_BEGIN value and action about the magnitude of the change between this and your greatness of PINCH gesture currently detected.  Don't forget that users might get STUCK in and out in a single step (where the use of PINCH_UPDATE), it is not only a start and end value.

Tags: BlackBerry Developers

Similar Questions

  • Are the touch events in new broken ripple?

    Hello

    I have a PlayBook application that uses touch events to shake things. I tested it in the stand-alone version of ripple and the physical device.

    Now I think on porting the app to BB10, so I downloaded the verion of ripple Chrome and I found that in the waving of the new, I can't move any object!

    I've identified the problem, but I don't know how to cope. Here is a small HTML file that shows the problem:

    http://www.w3.org/1999/xhtml">
    
    
    
        
    child

    So basically there is a div container that listenes to the touchstart and if this event happens that it displays an alert. In the ripple of old (and on the PlayBook device) If you press the 'child' div the alert is also shown (the event is pushed down and intercepted by containers). In the waving again, it happens.

    Any suggestions? I can force ripple action as does the Playbook? Maybe I should use another technique to capture touch events?

    Hi razorek,

    I'm not sure of the reason (his behavior of WebKit), but the propagation of the event using the AddEventListener method will allow when you use touchstart. Take a look:

    http://www.w3.org/1999/xhtml">
    
    
    
        
    child

    Also, when using ripple for Chrome, please make sure that "Emulate touch events" are not verified, since ripple there are tactile own emulation system and it may come into conflict with it.

    F12 (Open Developer Tools) > click on the gear icon in the lower right > Exceptions tab > emulate the Touch events. I'll also post this work around for that matter https://github.com/blackberry/Ripple-UI/issues/344 github page

  • stimulate the touch event handling in PRC?

    I want to stimulate the touch event in another application. can someone help me in explaining to me with a code example.

    I'll pass on this one, whenever I give you an answer to a topic, change you what you wanted in the first place.
    First of all, you wanted to listen to the event:
    http://supportforums.BlackBerry.com/T5/native-development/touch-does-not-fire-for-Q10/TD-p/3026980

    Second, you were finally made in the PRC:
    http://supportforums.BlackBerry.com/T5/native-development/touch-event-handling-in-CPP/TD-p/3027043

    Third, you asked to simulate a key event in this thread I made.

    Now, this isn't what you want, you want to simulate a click on a button.

    I'll let someone else answer that one.

  • Convert Dialog.alert to handle the touch event

    Anyone know how I can convert my dialog.alert to handle the touch event

    Please help me = D

    You don't need - if you use the standard RIM dialogue he class shoud touch event itself.

  • Nature of the touch events

    Hello ladies and gentlemen,

    I am currently working on activating the touch support to an existing application to my friends, and I'm running into some difficulties. My screen consists of a few: on the bottom, I have a row of BitmapFields acting as buttons all content in a HFM, above that I have a great EditField, and above I have a HFM with a few more selectable BitmapFields.

    First of all, I'm not sure that should be implemented in touchEvent(), my managers or the fields themselves. I tried both, but noticed a strange behavior. It seems that the field that currently has the focus Gets the touchEvent little anywhere on the screen, the key event occurs.

    I think that the OS would simply understand that touching an object simply focusable means 'set the focus to this item"and clicking on the object means 'click on this object', I don't think you should even implement the touchEvent() method to achieve this effect.

    Does anyone have experience of writing applications for the storm? Am I missing something?

    Thank you
    Tyler

    Thank you Rex,

    I did a search on "touchEvent" but did not find much.

    Oops, looks like I just got this job.

    Let me explain what I have in case someone else comes on this thread:
    -My screen has a 'top manager' who handles most of the items on the screen, including other managers

    -J' have a HFM at the bottom of the screen (which is managed by my Senior Manager) that contains several BitmapFields that act like buttons
    -The question I had was trying to setFocus in the appropriate field when this field was hit

    Here's what I added to my managers to manage events:

    protected boolean touchEvent(TouchEvent event)    {        //Figure out where the touch occurred on the screen        int globX = event.getGlobalX(1);        int globY = event.getGlobalY(1);
    
            //Determine if the touch occurred within the extent of this manager        if (getExtent().contains(globX, globY))        {            if (event.getEvent() == TouchEvent.DOWN)            {                //Get the position of the touch within the manager                int x = event.getX(1);                int y = event.getY(1);
    
                    //See if there is a field at this screen position                int fieldIndex = getFieldAtLocation(x, y);
    
                    if ((fieldIndex >= 0) && (fieldIndex < getFieldCount()))                {                    //Set the focus to the field at this position                    Field f = getField(fieldIndex);                    f.setFocus();                }
    
                    //Return false so that the event propagates to the contained field                return false;            }        }
    
            //Event wasn't for us, handle in default manner        return super.touchEvent(event);    }
    

    In addition, you must ensure you set the scope of your managers correctly, both real as virtual, I usually do when I'm in the override of the sublayout() method.

    Hope this helps people.

  • How the MovieClip not to block the touch events

    Hey guys,.

    I'm trying to do something that should be simple.  I have a listener to button a button, this button has a MovieClip that is located on the top, so my button below will not receive the click event of the mouse.  How can I keep the MovieClip above the button but allow the mouse click event move to the button?

    Thank you

    Assuming you named the MovieClip "myMovieClip".

    To write

    myMovieClip.mouseChildren = false;

    myMovieClip.mouseEnabled = false;

    The ClickEvent must spend in the MovieClip safe and sound.

  • Disable the touch screen scrolling

    I found a ton of results describing how to force Firefox to scroll as a touchscreen. Let me start by being clear: I want to do the opposite of this. I have a page that key scrolls correctly, but this causes problems.

    I use a web page that submits electronic contracts, and they require signatures; I access this page from a Dell XPS 18 tablet. The problem is that the signature field is extremely temperamental. If you try to connect, the page scrolls, and the signature field remains empty. If you type just as it should be and then start to sign later, you can select the field, and it works. The problem is that it is so capricious, it took me several minutes to get the idea of the right button/timing of the thing. This does not work for clients. If I plug a conventional mouse, it works as it should; Click and drag the points highlights text, rather than scrolling and click and drag in the signature box signs.

    I use Firefox for this task because of its high degree of customization; I could (pretty simple) to make everything display exactly as I wanted. On that note, I hope that there is a way to disable the touch scrolling. I tried to use the clamp and slide the module to subvert its own destination, but it does not seem an option to do this. If someone can point me in the direction of a parameter or add-on that can do this, I'll be very grateful. Ideally, I would like to disable on this page in particular only, but disable overall would be as well.

    Since the submission of my original post, I spent a lot of time delving into everything: config with nothing else than an incomplete article knowledge base to guide me, and after losing a ton of time to play with the mousewheel settings, I discovered gestures.enable_single_finger_input, set it to false and voila! Problem solved. If there is never anyone trying to accomplish this for a reason, I hope that you find it useful.

  • Why was the swype gesture to the right to view open deleted tabs?

    In previous versions of Firefox for Android, you could swype the screen with 2 fingers to the right, and he would show a list of open tabs. This design was smooth and very easy access.
    Why this was removed?
    Is all swyping equivalent to the new version of the tabs on the top?
    Thank you

    There were many complainants that Firefox has no legs. UX testing, with the entire population, the UI Slides tabs was generally regarded as impossible.

    In addition he caused problems with pages that use the touch events. For example, panoramic view of Google Maps.

  • Questions of G72 - "pinch" the Touchpad / compatible keyboard backlight

    Currently, I bought a HP G72-B66US.  I just have a few questions.

    1. I am able to "pinch" on the Touchpad zoom?
    2. Y at - it a backlit keyboard to this model?

    Any help would be greatly appreciated.

    Right-click on the icon synpatics on the bottom right of the screen and you will find an option that says "gestures". Make sure that this option is disabled for all the different gestures like pinch and zoom, scrolling 1finger at work etc

  • Is there a way to disable the touch screen on a TouchSmart 520?

    One of my cats likes to stick his nose in the touchscreen.  Is there a way to simply turn off the touch screen on a 520-1020?

    Hi cs700,.

    Here's how:

    Go to the sounds and then hardware and Control Panel.

    Select the Pen and Touch and go to the contact tab.

    At the top is "Use your finger as input device."  Uncheck the box.

    Click apply and then click OK.

    The touch screen no longer works to the touch.  You should now use the mouse and keyboard, just like any other computer.

    Repeat these steps to reactivate it.  "You also have to check"Enable multi-touch and inking gestures", it turns off when the" use your finger... "is disabled.

    Hope that helps.

    If you like my answer, say thank you with a Kudo. ***

  • Touch the touch screen moves the cursor appear on another monitor in a multi-monitor for Windows 7 system

    There are three 3 monitors on this system. Two of them are the screens LCD Dell 2407WFP-HC and one is the touchscreen Acer T230H. Dell monitors are connected to a NVIDIA Quadro FX3500 and identify as monitors 1 and 2. The Acer monitor is connected to a NVIDIA GeForce 7600GS and identifies as monitor 3. The system runs Windows 7 Ultimate x 64, with updates. Everything works fine except for the touch screen feature.

    According to the instructions I used the Tablet PC configuration to configure the touch screen. In the installation program, reports monitor 2 Dell incorrectly as having entered touch available and the Acer monitor 3 reports as not having NOT available - also incorrect enter key.

    When I touch the Acer screen, the cursor appears on the monitor Dell 2 and moves according to the movement of my finger on the Acer screen.

    1. Go to the control panel and search for "Touch".
    2. Click on 'The Tablet PC settings'
    3. Click on "Setup"... "right" configure your stylus and touch displays.
    4. Choose "enter." »
    5. Press the 'Enter' key until you see the instructions displayed on your actual touchscreen.  Tap the screen and it will say something like "press ENTER to move to the next step.

    You should now see your contact to events (and mouse) are displayed on the touch screen when you... Well, touch.

    Hope that helps.

  • How can I activate the touch screen with remote desktop

    I have an Asus ep121 windows 7 home tablet Office remotely to a desktop windows 7 Professional.

    Remote Desktop is not recognized any touch gesture. Windows 7 has a touchscreen native, is backing anyway to force the remote computer to accept the touch input of the Tablet?

    Hello

    Windows 7 has a native touch screen probably support in that. Affect the gesture is unfortunately not possible on desktop connection remotely.

    When a remote desktop session is established between two computers (one with the ability to touch and others with no possibility of touch) as in your case. It may not be a chance to access a computer able to touch with your desktop capable of non-contact, although Windows 7 is touch wiz compatible.

    In order to use the touch features or programs, both computers must be installed with equipment able to touch. For example a touch screen, Touch pad, etc.

    Without compatible hardware on both computers by touch, touch capable desktop connection between two computers remotely maybe isn't possible.

    The only way to create an able to touch Remote Desktop connection is by installing equipment to touch interface on your desktop.

    Provide us additional information. So that we can help solve you the problem on your computer.

    Hope this information helps you.

  • The Windows show Event ID 264 WARNING logs

    Hello

    Our report of customer that there is a single newspaper waring in the windows logs. Please check the message below.

    The OS is windows 8.

    ------------------------------------------------------------

    Log name: System
    Source: Win32k
    Date: 13/06/2013 18:18:02
    Event ID: 264
    Task category: no
    Level: WARNING
    Keywords: Classic
    User: n/a
    Computer: test
    Description:
    A multi touch reported coordinated incompatible device.

    ------------------------------------------------------------

    But

    (1) the multi touch device passed the WHCK. And,

    (2) we have also double check it the hid descriptor device. Device to control the Microsoft tool descriptor "digitizer report DescriptorChecker.

    I know that there are many cell phones have the same problem. But nobody has the solution for this.

    MSFT has solution for this or any other test tool that can help to find the cause root? Since the log is created by system and our device alreay check our all the functions declared in the hid descriptor. We do not know why the waring appear.

    Once MSFT response the issue of 264 event id with the following returns information.

    MSFT: it can refer to the firmware. For example, firmware claims it can withstand 2 contacts, but in fact it shows 5 contacts.

    But we do not find the bad part of our hidden device report descriptor, and device alreay spend WHCK.  Given that many other phones have the same problem, I think is not easy root cause guess by checking our own firmware. Hope MSFT can check this issue and to provide more information.

    The description of event id 264:
    A multi touch reported coordinated incompatible device.

    We need a more "specific" reason the warning log.

    Best regards

    Caro flax

    Hi Caro Lin,

    1. are you connected to the domain?
    2. What is the brand and model of the computer?

    If you are connected to the domain, then I suggest you to post in the forums of Windows IT pro.

    http://social.technet.Microsoft.com/forums/en-us/category/w8itpro

  • Using the touch screen and the touch pad at the same time on Windows 8

    How can I use my touchpad and my touchscreen Windows 8? I use Acer and it seems that whenever I get I have TO use the touch screen and my cursor is non-existent. I'm sure there will be a setting I can change to be able to use both at the same time, but so far I can't find answers online or elsewhere.

    Help, please!

    Hello green,

    Thanks for posting your question on the Microsoft community.

    I would like to know some information about the problem so that we can help you better.

    What is the model number of your PC Acer laptop?

    Thank you for your query details.

    I also like the fact that you want to use the touch screen and press the key at the same time.

    Unfortunately, it is not possible. However, you can use touchpad of precision which uses a variety of touch gestures to get around your computer. Touchpad different gestures are provided in this article.
    Reference:
    With the help of a precision touchpad
    http://Windows.Microsoft.com/en-us/Windows-8/touchpad

    You can also make changes to its settings to adjust the duration that your touchpad stays off as you type so that you can avoid accidentally tapping the touchpad with your thumb and move the cursor.

    I hope this information helps.

    Please let us know if you need more help.

    Thank you

  • Touch gesture "pan two finger ' Photoshop cc 2015.1 does not

    Hello

    I use a wacom cintiq 24hd button and after I installed (upgrade) the latest version of photoshop, cc 2015.1, (Windows 8.1) a couple of touch gestures don't work as they should:

    Two fingers to pan and zoom (when using two fingers to or far away, to zoom in or out) works perfectly.

    The two fingers pan does not work: whenever I use this gesture (goes up, down, left or right) I work the photo/painting on shoots off the screen. I have to select the the hand icon and use the stylus to place it in the center of my screen;

    The two fingers of pan and rotation does not work.


    I have not had a problem using all these movements in photoshop before the recent update.


    Is that what I can do on my part that could solve these problems? If someone could help me with this, I appreciate it a lot.


    Thank you

    JerHopp

    Hi JerHopp,

    Try the following steps:

    1. create a Notepad and type:

    # Use WinTab

    UseSystemStylus 0

    Save it as a text file named PSUserConfig.txt

    2. Open Run command and type appdata, and press ENTER key

    3. go to the location:

    Roaming - Adobe - Adobe Photoshop CC2015 - Adobe Photoshop CC2015 settings

    4. move the file PSUserConfig.txt to the folder settings Adobe Photoshop CC 2015

    Kind regards

    Tanuj

Maybe you are looking for

  • How to remove options open all in tabs from the bookmarks menu

    Hello I have Firefox 17.0.1. Is it possible to remove or disable the all open at the point of tabs in the bookmarks menu submenus? I chose during it by mistake, and a lot of unwanted tabs appear as enraged politicians. Thank you. Jack

  • Windows Update takes oone is the latest operating system?

    I have my computer set to do automatic updates, but often after them I have problems to get it to funtion as they did in the past.  The update knows what operating system I use, or he puts on the points to a more recent version, like Windows 7 when m

  • My wmi file is missing. I am running windows xp home with sp3 addition

    whenever I try to use the windows diagnostic utility or if I try to use any microsoft diagnostic tool always happens the same thing. Sometimes it does not find my wmi or its lack. What can I do to fix this?

  • Unable to preform IPCC Express configuration

    Does anyone know how to fix... After installing IPCC Express 3.5 2 - restart the server and the connection to perform the initial configuration - Web appadmin page gives the following error: You are not authorized to view this page You don't have per

  • Windows Explorer keeps stealing focus

    I have problems with Windows Explorer, support for the screen as the main application, but not totally. Often she does when I launch an application having worked with explore moments before. This is the case of 5 up to 30-60 seconds after that a new