Layout allows children

now you can do stuff like:

```
gherkin_bump_layout("g20") {
  upside_down() key();
};
```

and it'll work! you still have to specify the profile in the layout itself because row and column are not special variables... hm
This commit is contained in:
Bob 2020-01-11 23:31:01 -05:00
parent cb7a301052
commit 425ae8af34
2 changed files with 39 additions and 7 deletions

View File

@ -16,5 +16,7 @@ gherkin_bump_legends = [
];
module gherkin_bump_layout(profile, row_sculpting_offset=1, column_override=undef) {
layout(gherkin_bump_mapping, profile, legends=gherkin_bump_legends, row_sculpting_offset=row_sculpting_offset, column_override=column_override, column_sculpt_profile="cresting_wave");
layout(gherkin_bump_mapping, profile, legends=gherkin_bump_legends, row_sculpting_offset=row_sculpting_offset, column_override=column_override, column_sculpt_profile="cresting_wave") {
children();
};
}

View File

@ -6,7 +6,7 @@ function abs_sum(list, x=0) =
abs_sum([for (x = [1: len(list) - 1]) list[x]], x+abs(list[0]));
function 2hands(index, total) = ((index+0.5) % (total/2)) - (total/4);
function cresting_wave(index, total, mod=5) = (index < total/2) ? (((index + 0.5) / total)*mod) : -(mod - ((index + 0.5) / total * mod));
function cresting_wave(index, total, mod=4) = (index < total/2) ? (((index + 0.5) / total)*mod) : -(mod - ((index + 0.5) / total * mod));
function 1hand(index, total) = (index % (total)) - (total/2);
@ -38,15 +38,45 @@ module layout(list, profile="dcs", legends=undef, row_sculpting_offset=0, row_ov
translate_u(column_distance - (key_length/2), -row) {
key_profile(profile, row_sculpting, column_value) u(key_length) legend(legends ? legends[row][column] : "") cherry() { // (row+4) % 5 + 1
if (key_length == 6.25) {
spacebar() key();
spacebar() {
if ($children) {
children();
} else {
key();
}
}
} else if (key_length == 2.25) {
lshift() key();
lshift() {
if ($children) {
children();
} else {
key();
}
}
} else if (key_length == 2) {
backspace() key();
backspace() {
if ($children) {
children();
} else {
key();
}
}
} else if (key_length == 2.75) {
rshift() key();
rshift() {
if ($children) {
children();
} else {
key();
}
}
} else {
key();
{
if ($children) {
children();
} else {
key();
}
}
}
}
}