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

Adobe AIR Development

Reply
Developer
zezke
Posts: 1,004
Registered: ‎12-12-2010
My Device: Z10 (red Limited Edition)

Zoom on a point

Hi everybody,

 

has anybody been able to get the zoom gesture working perfectly? By perfectly I mean the ability to zoom in on the center point between the fingers when using the zoom gesture (for example when zooming in on an image). I don't get it perfect. This is my current code:

 

private function onZoom(event:TransformGestureEvent):void
{
	//Determine scale factor
	var scaleFactor:Number = (event.scaleX + event.scaleY)/2;
	var transformMatrix:Matrix = drawingPanel.transform.matrix;
	transformMatrix.tx -= event.localX;
	transformMatrix.ty -= event.localY;
	transformMatrix.scale(scaleFactor, scaleFactor);
	transformMatrix.tx += event.localX;
	transformMatrix.ty += event.localY;
	drawingPanel.transform.matrix = transformMatrix;
}

 Thanks in advance

 

 

 

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!