I’m trying to get the coordinates of the center of a rotated item and to calculate them I need the width and height…
I’m trying to get the coordinates of the center of a rotated item and to calculate them I need the width and height of the box of the item, but there is no string for this in the API. Item.getWidth and getHeight don’t work because the item is rotated. Am I missing something here or is there just no way the can be done easily.
]]>
« An annoyance: (Previous Post)
< ![CDATA[
function center(item){
var r=item.getRotation()*Math.PI/180;
var sin=Math.abs(Math.sin(r));
var cos=Math.abs(Math.cos(r));
var w=item.getWidth()*item.getScaleX();
var h=item.getHeight()*item.getScaleY();
return[item.getPositionX()+(w*cos+h*sin)*0.5,item.getPositionY()+(h*cos+w*sin)*0.5];
}
(Copy-paste from http://www.pierrox.net/android/applications/lightning_launcher/wiki/doku.php?id=script_multitool)
]]>
< ![CDATA[
Wow thanks for the fast response! I hadn’t looked there.
]]>
< ![CDATA[
Ah, memories 🙂
]]>
< ![CDATA[
TrianguloY I don’t even know what it’s for in the multitool script XD. Soo long ago 😉
]]>
< ![CDATA[
Well, it is a ‘tool’ 😛
]]>
< ![CDATA[
TrianguloY
just searched through: It’s just displayed as information.
]]>