User Tools

Site Tools


script_universal_page_indicator

====== About the script ====== * Purpose : Display Indicators for horizontal/vertical Scroll * Author : [[https://plus.google.com/u/0/+gerdreuter/|Gerd Reuter]] * Link: https://plus.google.com/u/0/+gerdreuter/posts/3KChfMXLpbt (With video) ====== How to use the script ====== Universal Page/scroll Indicator Horizontal/Vertical or both together. I wrote a Script which makes it very easy so setup an Scroll/Page Indicator. It works Horizontal or Vertical. Indepent whether "Snap to pages" is set or not. Usable for seperate Horizontal or Vertical or Both together. Works for Desktop or other Containers like Panels or Folders. Setup: Pined panel for Horizontal.(label hpanel) or Vertical (label vpanel) scroll. Customize as you like In the panel a Shurtcut label hpointer or vpointer should be placed at the left (horizontal) or top (vertical). Customize as you like Set PositionChange Event from the Container to this Script. Suggestions or Improvements are welcome ;-) You can download Script or Template (from the Video with Script) here: https://drive.google.com/folderview?id=0BwdfIpCyi8ZVQVVpMnJwaHlocmc&usp=sharing <code> var cont=LL. getEvent(). getContainer() ; //vertical var vpanel='vpanel'; var vpointer='vpointer'; //horizontal var hpanel='hpanel'; var hpointer='hpointer'; //vertical only when panels exists if (cont. getItemByLabel(vpanel)) { var ctop=cont. getBoundingBox(). getTop() ; var cbot=cont. getBoundingBox(). getBottom(); var cheight=cont. getHeight() ; var totalv=cbot-cheight; var actpv=cont. getPositionY() ; if (ctop<0) { totalv=totalv+(ctop*-1) ; actpv=actpv+(ctop*-1) ; } var pctv=actpv/totalv; var ipnlv=cont. getItemByLabel(vpanel). getContainer() ; var ipnlvheight=ipnlv. getHeight() ; var ipnlvp=ipnlv. getItemByLabel(vpointer) ; var ipnlvpheight=ipnlvp. getHeight() ; var ptotalv=ipnlvheight-ipnlvpheight; var newpy=Math. round(ptotalv*pctv) *-1; ipnlv. setPosition(0,newpy); } //horizontal only when panels exists if (cont. getItemByLabel(hpanel)) { var cleft=cont. getBoundingBox(). getLeft() ; var cright=cont. getBoundingBox(). getRight(); var cwidth=cont. getWidth() ; var totalh=cright-cwidth; var actph=cont. getPositionX() ; if (cleft<0) { totalh=totalh+(cleft*-1) ; actph=actph+(cleft*-1) ; } var pcth=actph/totalh; var ipnlh=cont. getItemByLabel(hpanel). getContainer() ; var ipnlhwidth=ipnlh. getWidth() ; var ipnlhp=ipnlh. getItemByLabel(hpointer) ; var ipnlhpwidth=ipnlhp. getWidth() ; var ptotalh=ipnlhwidth-ipnlhpwidth ; var newpx=Math. round(ptotalh*pcth) *-1; ipnlh. setPosition(newpx,0); } </code>

script_universal_page_indicator.txt · Last modified: 2014/05/15 07:00 by werksmannschaft