You’ll want to set it to the ‘position changed’ event for your desktop.. Assuming you have a left panel, you’ll need to set panelW to the width of the panel.. And finally, set the item ID on the first line to the item who’s icon you want to change
//Curtis, add this as a new script and call it ‘get id’. set it to ‘item menu’ in the script editor.. Then long click on a shortcut -> Scripts -> get id
TrianguloY That was on the to do list.. I’m glad it worked well for you!!
There’s a scale issue with my old MDPI tablet.. Where the icon is way too large and I’m working to fix (eventually).. Maybe PM me the code for the clockwise rotation and I can include it in the future
I’ll be dammed I actually learned where to look and it works on my device. now to find a good use for it thanks Ren Shore. setting the panel width can be a pain in the ass if you don’t know your panel size but if you have a full panel all you need is screen size. in my case 1280
< ![CDATA[
var item = LL.getItemById(0x8d0007);
img=LL.createImage(100,100);
item.setImage(img);
canvas = img.draw();
var con=LL.getEvent().getContainer();
var dtp=LL.getCurrentDesktop();
var x=dtp.getPositionX();
var panelW=540;
var p = new Paint();
p.setAntiAlias(true);
p.setStrokeWidth(5);
p.setColor(0xffffffff);
var canvas = img.draw();
var rot=x<0?(-x*180/(panelW))+180:180;
item.setRotation(0);
var lines=
[
[
[ 30,39,70,39 ],//before
[ 33,52,50,35 ]//after
],
[
[ 30,50,70,50 ],
[ 35,50,65,50 ]
],
[
[ 30,61,70,61 ],
[ 33,49,51,67 ]
]
];
canvas.rotate(rot,50,50);
for(i=0;i
var A=[0,0,0,0];
for(j=0;j< =3;j++){
a=lines[i][0][j];
b=lines[i][1][j];
A[j]=x>=0?a:a+((b-a)*(-x/panelW));
}
canvas.drawLine(A[0],A[1],A[2],A[3],p);
}
img.update();
]]>
< ![CDATA[
Just a heads up.. I haven’t tested it on any other device densities.. Let me know how it comes out!
]]>
< ![CDATA[
how do we configure this script? ill try it out and tell you how it works on my device
]]>
< ![CDATA[
You’ll want to set it to the ‘position changed’ event for your desktop.. Assuming you have a left panel, you’ll need to set panelW to the width of the panel.. And finally, set the item ID on the first line to the item who’s icon you want to change
]]>
< ![CDATA[
ok ill leave it to someone who already knows the ID because im not goingbto fight just to find it
]]>
< ![CDATA[
//Curtis, add this as a new script and call it ‘get id’. set it to ‘item menu’ in the script editor.. Then long click on a shortcut -> Scripts -> get id
prompt(“Item ID:”,”0x”+ LL.getEvent().getItem().getId().toString(16));
]]>
< ![CDATA[
Impressive stuff!
]]>
< ![CDATA[
I don’t know how to express my admiration.
Bravo
One question: the picture is 512×512, but why all the drawing coordinates are as if it were 100×100?
]]>
< ![CDATA[
TrianguloY copy paste error.. Editing comment now
]]>
< ![CDATA[
Has anyone tested it on anything other than xhdpi?
]]>
< ![CDATA[
Ren Shore
Me (nexus 4)
And with a little modification: it turns clockwise when opening, and also when closing 😉
Works fantastic and smooth. Good job again 🙂
]]>
< ![CDATA[
TrianguloY That was on the to do list.. I’m glad it worked well for you!!
There’s a scale issue with my old MDPI tablet.. Where the icon is way too large and I’m working to fix (eventually).. Maybe PM me the code for the clockwise rotation and I can include it in the future
]]>
< ![CDATA[
if(item.getTag(“arrow”)==null)rot=-rot;
if(x>=0)item.setTag(“arrow”,”-“);
if(x< =-panelW)item.setTag("arrow",null);
This, where the item.setRotation line is (which is not necessary, I guess a remind of the old code)
My icon is exactly 100×100 (when I added it it was 95×95, so I changed it) and it is perfectly defined.
Edit:
I also added this to directly open/close the panel when clicking (you may want to replace “SHORTCUT” with “I_CLICK”)
if(LL.getEvent().getSource()==”SHORTCUT”){
con.setPosition(con.getPositionX()==0?-panelW:0,con.getPositionY(),1,true);
return;
}
]]>
< ![CDATA[
I’ll be dammed I actually learned where to look and it works on my device. now to find a good use for it thanks Ren Shore. setting the panel width can be a pain in the ass if you don’t know your panel size but if you have a full panel all you need is screen size. in my case 1280
]]>