User Tools

Site Tools


script_always_there_bar

**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 is a script that place an item (in the video a panel) always on top of the screen. Scroll down the desktop to show it. Scroll up to hide. * Author : [[https://plus.google.com/u/1/105066926163073195690|TrianguloY]] * Link: https://plus.google.com/u/1/105066926163073195690/posts/DPufvGD2SjF (With video) ====== How to use the script ====== Instructions: * Copy paste this script as a new one. * IMPORTANT: you need to label "always-bar" the item you want to move * Pin that item and detach it from the screen * Set the script in the position change event of the desired container Settings: you can change the velocity the item is scrolled. Just change the numbers of the first part of the script, nothing more. ====== Script code ====== <code> /*Settings */ //this number means the velocity of showing/hidding respectively //1 is the default ( like the desktop ) the bigger, the faster (avoid negative numbers, between (0,1) will be slower ) var vs = 1;//show var vh = 1;//hide var cont = LL.getEvent().getContainer(); //item to move var bar = cont.getItemByLabel("always-bar"); if(bar==null){alert("Warning: no item with label 'always-bar' found.");return;} /* current position // in case don't exist //difference //save */ var contpos = cont.getPositionY(); var prev = parseInt(bar.getTag()); var d = contpos-prev; bar.setTag(contpos); var barpos = bar.getPositionY(); var size=bar.getScaleY() * bar.getHeight(); var posx=bar.getPositionX(); /*hide the bar */ if(d>0 && barpos>-size){ if(barpos-d*vh<-size || barpos<-size){ bar.setPosition(posx,-size); }else{ bar.setPosition(posx,barpos-d*vh); } } /*show the bar */ if(d<0 && barpos<0){ if(barpos-d*vs>0 || barpos>0){ bar.setPosition(posx,0); }else{ bar.setPosition(posx,barpos-d*vs); } } </code>

script_always_there_bar.1398533718.txt.gz · Last modified: 2014/04/26 17:35 by trianguloy