User Tools

Site Tools


script_scrollbar_interactive

====== Differences ====== This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
script_scrollbar_interactive [2014/05/03 20:22]
tbog [Photo examples]
script_scrollbar_interactive [2014/05/07 13:07] (current)
tbog [Script code]
Line 96: Line 96:
 <​code>​ <​code>​
 var thickness = 50; var thickness = 50;
 +
 +function getContainerCellCountX(c)
 +{
 +  var items = c.getItems();​
 +  var I = items.getLength() - 1;
 +  var max = Number.MIN_VALUE;​
 +  var min = Number.MAX_VALUE;​
 +  while ( I >= 0 )
 +  {
 +    var item = items.getAt(I--);​
 +    if ( !item.getProperties().getBoolean("​i.onGrid"​) )
 +      continue;
 +    var r = item.getCell();​
 +    max = Math.max(max,​ r.getRight());​
 +    min = Math.min(min,​ r.getLeft());​
 +  }
 +  return max - min;
 +}
  
 var c = LL.getEvent().getContainer();​ var c = LL.getEvent().getContainer();​
Line 102: Line 120:
 sb.setSize(thickness,​ c.getHeight());​ sb.setSize(thickness,​ c.getHeight());​
 var width = c.getOpener().getProperties().getInteger("​f.wW"​);​ var width = c.getOpener().getProperties().getInteger("​f.wW"​);​
-var space = width - c.getWidth();+var space = width - getContainerCellCountX(c) * c.getCellWidth()
 +var padding = space - thickness;
  
-alert("​found "+space+" space"​);​+alert("​found ​width "+width+"space "​+space+";​ will use "​+padding+"​ padding");
  
 sb.setPosition(width - thickness, 0); sb.setPosition(width - thickness, 0);
 +
 +c.setPosition(0,​ 0);
 </​code>​ </​code>​
script_scrollbar_interactive.1399148520.txt.gz · Last modified: 2014/05/03 20:22 by tbog