User Tools

Site Tools


script_wheel_of_items

====== Differences ====== This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
script_wheel_of_items [2014/04/21 13:50]
trianguloy
script_wheel_of_items [2018/08/14 16:56] (current)
f43nd1r fix link
Line 2: Line 2:
   * Purpose : This is a customizable wheel of items. ​   * Purpose : This is a customizable wheel of items. ​
   * Author : [[https://​plus.google.com/​u/​1/​105066926163073195690|TrianguloY]]   * Author : [[https://​plus.google.com/​u/​1/​105066926163073195690|TrianguloY]]
-  * Link: https://​plus.google.com/​u/​1/​105066926163073195690/​posts/​dMG96rAsFt6 (With video) +  * Link: https://​plus.google.com/​+TrianguloY/​posts/​dMG96rAsFt6 (With video) 
 +  * [[http://​www.pierrox.net/​android/​applications/​lightning_launcher/​wiki/​doku.php?​id=script_wheel_of_items#​modifications|Modification]]
 ====== How to use the script ====== ====== How to use the script ======
  
Line 20: Line 20:
  
 This script will use all the items in the container, that's why I recommend to use a panel. This script will use all the items in the container, that's why I recommend to use a panel.
 +
  
 ====== Script code ====== ====== Script code ======
-<code>+<sxh javascript>
 /*Config: */ /*Config: */
 var h = 0; //​horizontal alignment (-1 , 0 , 1 ) var h = 0; //​horizontal alignment (-1 , 0 , 1 )
Line 67: Line 68:
  
 } }
-</​code>​+</sxh> 
 + 
 +====== Modifications ====== 
 +  * Ready-to-use and possibility of having different settings in different containers. No need to set up settings! Follow all other instructions with the code below 
 + by [[http://​www.google.com/​+LukasMorawietz|F43nd1r]] 
 + 
 +=== modified script === 
 +<sxh javascript;>​ 
 +var event = LL.getEvent();​ 
 +var desktop = event.getContainer();​ 
 + var data=JSON.parse(desktop.getTag()||"​null"​);​ 
 + ​if(data==null) 
 + { 
 +data=new Object(); 
 + ​data.h=parseInt(prompt("​No Settings found.\nInput your horizontal Alignment (-1 , 0 , 1 )",​0))||0;​ 
 + ​data.v=parseInt(prompt("​Input your vertical Alignment (-1 , 0 , 1 )",​0))||0;​ 
 + ​data.r=parseInt(prompt("​Input your rotation offset ( 0 = default) in angles, not very implemented (0 or 180 recommended) ",​0))||0;​ 
 + ​data.f=parseInt(prompt("​Input your sensitivity",​2))||2;​ 
 + } 
 +desktop.setTag(JSON.stringify(data));​ 
 +var h=data.h; 
 +var v=data.v; 
 +var r=data.r; 
 +var f=data.f; 
 +var a = desktop.getItems();​ 
 +var na = a.getLength();​ 
 +var radius = Math.min( desktop.getHeight()/​ (v==0?4:2) , desktop.getWidth()/​ (h==0?4:2) ); 
 +var alt = 0.5; 
 +var size = [ radius*(2-alt)*Math.PI/​na , radius*2 ]; 
 +var desf = (desktop.getPositionX()* (v>​0?​-1:​1)+desktop.getPositionY()*(h>​0?​-1:​1) )*Math.PI/​desktop.getWidth();​ 
 +desf*=f; 
 + 
 +for ( var i=0; i<na; i+=1 )  
 +{  
 +var t = a.getAt(i);​ size=[t.getWidth(),​t.getHeight()];​ 
 +var angle = Math.PI*2*i/​na-desf;​ 
 +var x = Math.cos( angle -Math.PI/2 ) * radius; 
 +var y = Math.sin( angle -Math.PI/2 ) * radius; 
 +var rot = angle*180/​Math.PI+r;​ 
 +x+= (h<0? 0 : desktop.getWidth()/​ (h==0? 2 : 1) ) ; 
 +y+= (v>0? 0: desktop.getHeight()/​ (v==0? 2 : 1) ); 
 + x-= size[0]/​2;​ 
 + y-= size[1]/​2;​ 
 +  
 + t.setRotation(0);​ 
 + t.setSize(size[0] ,​size[1]);​ 
 + t.setPosition(x,​ y); 
 + t.setRotation(rot);​ 
 +} 
 +</sxh>
script_wheel_of_items.1398088240.txt.gz · Last modified: 2014/04/21 13:50 by trianguloy