Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Member
Posts: 1
Registered: ‎09-09-2013
My Device: BlackBerry Z10
My Carrier: Telenor

MapView and onTouch not working in 10.2

[ Edited ]

Hey,

 

I have a simple MapView from which I need information when the user has started to pan the map and when the map was released. Prior to 10.2 i used the onTouch signal to get the event but it's no longer working for me in 10.2 and I can't for the life of me understand why that is. The release notes for 10.2 have been of no help. 

 

Example of what I'm trying to accomplish:

 

MapView {
   onTouch: {
      if (event.isDown() || event.touchType == TouchType.Down) {
         // Started panning
      } else if (event.isUp() || event.touchType = TouchType.Cancel) {
         // Ended panning
      }
   } 
}

 

Is there another way of getting these two events?

 

EDIT:

 

I might add that onTouchCapture, onTouchEnter and onTouchExit aren't working for me either.

 

 

Kind regards,

Fedza

 

 

 

Retired
Posts: 13
Registered: ‎08-30-2011
My Device: BlackBerry Q10
My Carrier: O2

Re: MapView and onTouch not working in 10.2

If you set touchPropagationMode: TouchPropagationMode.PassThrough, then the events should pass through to the parent node where you can catch the touches:

 

Page {

Container {

    layout: DockLayout {

    }

    MapView {

        touchPropagationMode: TouchPropagationMode.PassThrough

        horizontalAlignment: HorizontalAlignment.Fill

        verticalAlignment: VerticalAlignment.Fill

    }

    onTouch: {

        if (event.isDown() || event.touchType == TouchType.Down) {

            console.log("panning started!");

        } else if (event.isUp() || event.touchType == TouchType.Cancel) {

            console.log("panning ended!");

        }

    }

}

}