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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Contributor
Posts: 8
Registered: ‎02-27-2013
My Device: BlackBerry 10 Dev Alpha
My Carrier: no
Accepted Solution

How to use the property PivotX and PivotY in cascades

Hi,

My target is to rotate the line on my angle.

 

img1

1. I have received two points: A(x1; y1) and B(x2; y2);


2. I have calculated the size of vector AB and the angle of point A:
AB = Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2));
angleA = 44*


3. I set up the line on the coordinate plane (width = AB, height = 3px):
myLine.layoutProperties.positionX = x1;
myLine.layoutProperties.positionY = y1;


4. I have to rotate the line on the angle which has being found.
The start point of line must be the point A, the end point - point B. But, I failed =(
I try to use the rotationZ, but i dont know how to work with its propertyes PivotX and PivotY.
On default PivotX = 0 and PivotY = 0. When I try to set up PivotX = x1 and PivotY = y1 I get incorrect result.

With PivotX = 0 and PivotY = 0 I get it (myLine.rotationZ = 44):

 

img2

Please, help me =)

 

Highlighted
New Contributor
Posts: 8
Registered: ‎02-27-2013
My Device: BlackBerry 10 Dev Alpha
My Carrier: no

Re: How to use the property PivotX and PivotY in cascades

P.S.: my line is the image(3px*600px), when I set up it to the coordinate plane the line has the size: 

myLine.preferredHeight = 3;
myLine.preferredWidth = AB;

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

Re: How to use the property PivotX and PivotY in cascades

That might be happening because setting pivotX and pivotY to zero makes the rotation around the center of the element. In the case of this image that equals to its central point (300, 1.5), but not it's top left point. Try setting the pivotX to -(image.width/2), which will be: -300; and pivotY to -(image.height/2), which is -1.5; and then rotate again. 

 

Please see more details on that topic here:

http://developer.blackberry.com/native/reference/cascades/bb__cascades__visualnode.html