mirror of
https://github.com/rsheldiii/KeyV2.git
synced 2025-01-22 17:30:57 +00:00
Add auto-placement
This commit is contained in:
parent
33794d3ea9
commit
12c228fbdf
2 changed files with 26 additions and 0 deletions
|
@ -956,6 +956,19 @@ module debug() {
|
|||
|
||||
%children();
|
||||
}
|
||||
|
||||
// auto-place children in a grid.
|
||||
// For this to work all children have to be single keys, no for loops etc
|
||||
module auto_place() {
|
||||
num_children = $children;
|
||||
row_size = round(pow(num_children, 0.5));
|
||||
|
||||
for (child_index = [0:num_children-1]) {
|
||||
x = child_index % row_size;
|
||||
y = floor(child_index / row_size);
|
||||
translate_u(x,-y) children(child_index);
|
||||
}
|
||||
}
|
||||
module arrows(profile, rows = [4,4,4,3]) {
|
||||
positions = [[0, 0], [1, 0], [2, 0], [1, 1]];
|
||||
legends = ["←", "↓", "→", "↑"];
|
||||
|
|
|
@ -204,3 +204,16 @@ module debug() {
|
|||
|
||||
%children();
|
||||
}
|
||||
|
||||
// auto-place children in a grid.
|
||||
// For this to work all children have to be single keys, no for loops etc
|
||||
module auto_place() {
|
||||
num_children = $children;
|
||||
row_size = round(pow(num_children, 0.5));
|
||||
|
||||
for (child_index = [0:num_children-1]) {
|
||||
x = child_index % row_size;
|
||||
y = floor(child_index / row_size);
|
||||
translate_u(x,-y) children(child_index);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue