User Tools

Site Tools


script_rotating_app_wheel

**This is an old revision of the document!** ----

A PCRE internal error occured. This might be caused by a faulty plugin

====== About the script ====== * Purpose : This script will take all app shortcuts and place them in a circle. * Author : TBog * Link: www.google.com/+BogdanTautuTBog ====== How to use the script ====== - All items that participate in the wheel must be off the grid and pinned. - Make 2 shortcuts and place one to the far left and one to the far right. They will delimit the scroll space. Name them with a dot character. - Set the script to the Position changed event of the container (desktop). - 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. ====== Script code ====== <code> var c = LL.getEvent().getContainer(); var a = []; var na = 0; var offsetRot = c.getPositionX() / c.getWidth() * Math.PI * -2; var items = c.getItems(); for ( var i=items.getLength()-1; i>=0; i-=1 ) { var item = items.getAt(i); if ( item.getType()!='Shortcut' ) { /*alert(item.getType());*/ continue; } if ( item.getLabel().substr(0,1)=='.' ) continue; a[na++] = item; } var x,y; var w2 = c.getWidth()/2; var h2 = c.getHeight()/2; var radius = Math.min(w2, h2) * 0.8; for ( var i=0; i<na; i+=1 ) { x = Math.cos(Math.PI*2*i/na-Math.PI/2+offsetRot) * radius; y = Math.sin(Math.PI*2*i/na-Math.PI/2+offsetRot) * radius; /* move circle to the middle of the screen */ x+= w2; y+= h2; /* offset to item pivot */ x-= item.getWidth()/2; y-= item.getHeight()/2; a[i].setPosition(x, y); } </code>

script_rotating_app_wheel.1394578899.txt.gz · Last modified: 2014/03/11 23:01 by tbog