Hi all, this is a question for the more experienced users: I was looking at ways to optimize my code and I found…
I implemented this in a small example script:
dummy = LL.getCurrentDesktop().addShortcut(“dummy”,new Intent(),0,0);
myItem = function(){
this.getCenter = function(){
var r=this.getRotation()*Math.PI/180;
var sin=Math.abs(Math.sin(r));
var cos=Math.abs(Math.cos(r));
var w=this.getWidth()*this.getScaleX();
var h=this.getHeight()*this.getScaleY();
return[this.getPositionX()+(w*cos+h*sin)*0.5,this.getPositionY()+(h*cos+w*sin)*0.5];
};
};
myItem.prototype = dummy;
myDummy = new myItem();
alert(myDummy.getCenter()[0])
alert(myDummy.getPositionX()) // BOTH WORK ON SAME OBJECT AND DIDN’T DEFINE A getPositionX() IN myItem 😀
I never seen anyone use this, so I was wondering if there is anything that makes this very inefficient or I actually discovered something pretty cool.
Thanks for reading 🙂
Colin
]]>