====== Differences ====== This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
script_rotating_app_wheel [2014/03/11 23:01] tbog created |
script_rotating_app_wheel [2014/03/13 03:00] (current) tbog [Script code] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== About the script ====== | ====== About the script ====== | ||
| - | * Purpose : This script will take all app shortcuts and place them in a circle. | + | * Purpose : This script will take all app shortcuts and place them in a circle. When you scroll the container (desktop) the circle will rotate. |
| * Author : TBog | * Author : TBog | ||
| * Link: www.google.com/+BogdanTautuTBog | * Link: www.google.com/+BogdanTautuTBog | ||
| Line 7: | Line 7: | ||
| - All items that participate in the wheel must be off the grid and pinned. | - All items that participate in the wheel must be off the grid and pinned. | ||
| + | - The desktop must be set to scroll horizontal only | ||
| - 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. | - 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). | - 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. | - 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. | ||
| + | Caution: on my device (stock i9505 with android 4.4.2) LLX v9.9.7 crashes after i rotate a couple of times. Others do not have this issue. | ||
| + | TODO: after the crash is fixed i will improve the following: | ||
| + | * Make the scrolling infinite | ||
| + | * Make a setup script (will need to be able to create shortcuts from script) | ||
| + | * Make the visible item count customizable and hide excess items | ||
| ====== Script code ====== | ====== Script code ====== | ||
| <code> | <code> | ||
| Line 16: | Line 22: | ||
| var a = []; | var a = []; | ||
| var na = 0; | var na = 0; | ||
| + | /*how much to rotate, to increase speed multiply with something greater than 1*/ | ||
| var offsetRot = c.getPositionX() / c.getWidth() * Math.PI * -2; | var offsetRot = c.getPositionX() / c.getWidth() * Math.PI * -2; | ||
| var items = c.getItems(); | var items = c.getItems(); | ||
| Line 42: | Line 49: | ||
| y+= h2; | y+= h2; | ||
| /* offset to item pivot */ | /* offset to item pivot */ | ||
| - | x-= item.getWidth()/2; | + | x-= a[i].getWidth()/2; |
| - | y-= item.getHeight()/2; | + | y-= a[i].getHeight()/2; |
| a[i].setPosition(x, y); | a[i].setPosition(x, y); | ||
| } | } | ||
| </code> | </code> | ||