User Tools

Site Tools


script_circle_icons

====== 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_circle_icons [2014/02/23 20:10]
tbog [How to use the script]
script_circle_icons [2014/03/03 12:32] (current)
tbog [How to use the script]
Line 7: Line 7:
   - Make sure the items are not on a grid.   - Make sure the items are not on a grid.
   - Make a shortcut that runs this script and put a . as the first character of the label.   - Make a shortcut that runs this script and put a . as the first character of the label.
-  - Click on the shortcut and all items of type 'ai' that do not have a dot as the first character in the label will be positioned on a circle.+  - Click on the shortcut and all items of type 'Shortcut' that do not have a dot as the first character in the label will be positioned on a circle
 +  - You can change the order of the items in the circle using "Move forward/​backwards"​ button. The top-most item is at 12-o'​clock and going clockwise. 
 +  - If the order of the items is not to your liking, make changes then go to step 3.
   - You can now delete the shortcut to the script.   - You can now delete the shortcut to the script.
  
-You can change the order of the items in the circle using "Move forward/​backwards"​ button. ​The top-most item is at 12-o'​clock and going clockwise. +Note: The top-most item will set the size of all other items
- +I have tested this script on a 1080 x 1920 screen (portrait). If you have some other resolution you can change the margin values ​and the radius (read comments in the script).
-I have tested this script on a 1080 x 1920 screen (portrait). If you have some other resolution you can change the offsets ​and the radius (read comments in the script).+
 ====== Script code ====== ====== Script code ======
 <​code>​ <​code>​
Line 22: Line 23:
 { {
  var item = items.getAt(i);​  var item = items.getAt(i);​
- if ( item.getType()!='​ai' )+ if ( item.getType()!='​Shortcut' )
  {  {
- /*alert(item.getType()+"​ "​+item.getLabel());​*/+ alert(item.getType()+"​ "​+item.getLabel());​
  continue;  continue;
  }  }
Line 31: Line 32:
  a[na++] = item;  a[na++] = item;
 } }
-var x,y; +if (!na) 
-/* radius is about 400 for 1080x1920 screen */ + return; 
-var radius = 0.37 * Math.min(desktop.getWidth(),​ desktop.getHeight());​+var x, y; 
 +var size = Math.max(a[0].getWidth(),​ a[0].getHeight());​ 
 +var radius = (Math.min( desktop.getWidth(),​ desktop.getHeight() ) - size) * 0.5; 
 +var margin = 0.2 * size; 
 +radius-= margin;
 for ( var i=0; i<na; i+=1 ) for ( var i=0; i<na; i+=1 )
 { {
  x = Math.cos(Math.PI*2*i/​na-Math.PI/​2) * radius;  x = Math.cos(Math.PI*2*i/​na-Math.PI/​2) * radius;
  y = Math.sin(Math.PI*2*i/​na-Math.PI/​2 ) * radius;  y = Math.sin(Math.PI*2*i/​na-Math.PI/​2 ) * radius;
- /* move circle to the middle of the screen */ 
  x+= desktop.getWidth()/​2;​  x+= desktop.getWidth()/​2;​
- y+= desktop.getHeight()/2; + y+= desktop.getHeight()-radius
- /* offset (would be nice to know item width) */ + x-= size/2
- x-= 67+ y-size + margin; 
- y+300;+ 
 + a[i].setScale(1,​ 1); 
 + a[i].setSize(size,​ size);
  a[i].setPosition(x , y);  a[i].setPosition(x , y);
 } }
 </​code>​ </​code>​
script_circle_icons.1393186222.txt.gz · Last modified: 2014/02/23 20:10 by tbog