mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-31 08:35:23 +02:00
Replace most trivial uses of slice() with faster list_head() and list_tail()
This commit is contained in:
@@ -294,9 +294,9 @@ module distribute(spacing=undef, sizes=undef, dir=RIGHT, l=undef)
|
||||
spc = !is_undef(l)? ((l - sum(gaps)) / ($children-1)) : default(spacing, 10);
|
||||
gaps2 = [for (gap = gaps) gap+spc];
|
||||
spos = dir * -sum(gaps2)/2;
|
||||
spacings = cumsum([0, each gaps2]);
|
||||
for (i=[0:1:$children-1]) {
|
||||
totspc = sum(concat([0], slice(gaps2, 0, i)));
|
||||
$pos = spos + totspc * dir;
|
||||
$pos = spos + spacings[i] * dir;
|
||||
$idx = i;
|
||||
translate($pos) children(i);
|
||||
}
|
||||
@@ -339,9 +339,9 @@ module xdistribute(spacing=10, sizes=undef, l=undef)
|
||||
spc = !is_undef(l)? ((l - sum(gaps)) / ($children-1)) : default(spacing, 10);
|
||||
gaps2 = [for (gap = gaps) gap+spc];
|
||||
spos = dir * -sum(gaps2)/2;
|
||||
spacings = cumsum([0, each gaps2]);
|
||||
for (i=[0:1:$children-1]) {
|
||||
totspc = sum(concat([0], slice(gaps2, 0, i)));
|
||||
$pos = spos + totspc * dir;
|
||||
$pos = spos + spacings[i] * dir;
|
||||
$idx = i;
|
||||
translate($pos) children(i);
|
||||
}
|
||||
@@ -384,9 +384,9 @@ module ydistribute(spacing=10, sizes=undef, l=undef)
|
||||
spc = !is_undef(l)? ((l - sum(gaps)) / ($children-1)) : default(spacing, 10);
|
||||
gaps2 = [for (gap = gaps) gap+spc];
|
||||
spos = dir * -sum(gaps2)/2;
|
||||
spacings = cumsum([0, each gaps2]);
|
||||
for (i=[0:1:$children-1]) {
|
||||
totspc = sum(concat([0], slice(gaps2, 0, i)));
|
||||
$pos = spos + totspc * dir;
|
||||
$pos = spos + spacings[i] * dir;
|
||||
$idx = i;
|
||||
translate($pos) children(i);
|
||||
}
|
||||
@@ -429,9 +429,9 @@ module zdistribute(spacing=10, sizes=undef, l=undef)
|
||||
spc = !is_undef(l)? ((l - sum(gaps)) / ($children-1)) : default(spacing, 10);
|
||||
gaps2 = [for (gap = gaps) gap+spc];
|
||||
spos = dir * -sum(gaps2)/2;
|
||||
spacings = cumsum([0, each gaps2]);
|
||||
for (i=[0:1:$children-1]) {
|
||||
totspc = sum(concat([0], slice(gaps2, 0, i)));
|
||||
$pos = spos + totspc * dir;
|
||||
$pos = spos + spacings[i] * dir;
|
||||
$idx = i;
|
||||
translate($pos) children(i);
|
||||
}
|
||||
|
Reference in New Issue
Block a user