Add Vertical Keys to layout()

This commit is contained in:
Oliver Gaskell 2021-03-25 19:37:51 +00:00
parent 44340a4743
commit 7f326f30e9
2 changed files with 21 additions and 10 deletions

View File

@ -4,29 +4,38 @@ full_size_default_layout = [
[1,-1,1,1,1,1,-0.5,1,1,1,1,-0.5,1,1,1,1,-0.5,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,2,-0.5,1,1,1,-0.5,1,1,1,1],
[1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5,-0.5,1,1,1,-0.5,1,1,1,1],
[1.75,1,1,1,1,1,1,1,1,1,1,1,2.25,-4,1,1,1,1],
[1.75,1,1,1,1,1,1,1,1,1,1,1,2.25,-4,1,1,1],
[2.25,1,1,1,1,1,1,1,1,1,1,2.75,-1.5,1,-1.5,1,1,1,1],
[1.25,1.25,1.25,6.25,1.25,1.25,1.25,1.25,-0.5,1,1,1,-0.5,2,1,1]
[1.25,1.25,1.25,6.25,1.25,1.25,1.25,1.25,-0.5,1,1,1,-0.5,2,1]
];
full_size_vertical_size = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
];
full_size_legend_size = [
[-2, 0, -2, -2, -2, -2, 0, -2, -2, -2, -2, 0, -2, -2, -2, -2, 0, -3, -3, -2],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -3, -3, 0, -2, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -3, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -3, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
];
full_size_legends = [
["esc", "", "f1", "f2", "f3", "f4", "", "f5", "f6", "f7", "f8", "", "f9", "f10", "f11", "f12", "", "ptsc", "sclk", "pse"],
["`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "⌫", "", "ins", "home", "pgup", "", "num", "/", "*", "-"],
["tab", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", "\\", "", "del", "end", "pgdn", "", "7", "8", "9", "+"],
["caps", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "enter", "", "4", "5", "6", "+"],
["caps", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "enter", "", "4", "5", "6"],
["shift", "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", "shift", "", "up", "", "1", "2", "3", "ent"],
["ctl", "win", "alt", "", "mnu", "win", "alt", "ctl", "", "lt", "dn", "rt", "", "0", ".", "ent"],
["ctl", "win", "alt", "", "mnu", "win", "alt", "ctl", "", "lt", "dn", "rt", "", "0", "."],
];
module full_size_default(profile) {
layout(full_size_default_layout, profile, full_size_legends, row_sculpting_offset=-1, legend_sizes=full_size_legend_size) children();
layout(full_size_default_layout, profile, full_size_legends, row_sculpting_offset=-1, legend_sizes=full_size_legend_size, vertical_sizes=full_size_vertical_size) children();
}

View File

@ -20,7 +20,7 @@ function double_sculpted_column(column, row_length, column_sculpt_profile) =
1hand(column, row_length) : (column_sculpt_profile == "cresting_wave") ?
cresting_wave(column, row_length) : 0;
module layout(list, profile="dcs", legends=undef, front_legends=undef, row_sculpting_offset=0, row_override=undef, column_sculpt_profile="2hands", column_override=undef, legend_sizes=undef) {
module layout(list, profile="dcs", legends=undef, front_legends=undef, row_sculpting_offset=0, row_override=undef, column_sculpt_profile="2hands", column_override=undef, legend_sizes=undef, vertical_sizes=undef) {
for (row = [0:len(list)-1]){
/* echo("**ROW**:", row); */
row_length = len(list[row]);
@ -28,6 +28,8 @@ module layout(list, profile="dcs", legends=undef, front_legends=undef, row_sculp
for(column = column_override ? column_override : [0:len(list[row])-1]) {
row_sculpting = (row_override != undef ? row_override : row) + row_sculpting_offset;
key_length = list[row][column];
key_height = vertical_sizes ? vertical_sizes[row][column] : 1;
v_offset = (key_height - 1) / 2;
column_value = double_sculpted_column(column, row_length, column_sculpt_profile);
column_distance = abs_sum([for (x = [0 : column]) list[row][x]]);
@ -35,9 +37,9 @@ module layout(list, profile="dcs", legends=undef, front_legends=undef, row_sculp
// supports negative values for nonexistent keys
if (key_length >= 1) {
translate_u(column_distance - (key_length/2), -row) {
translate_u(column_distance - (key_length/2), -row-v_offset) {
key_profile(profile, row_sculpting, column_value) u(key_length) legend(legends ? legends[row][column] : "", size=legend_sizes ? $font_size+legend_sizes[row][column] : $font_size) front_legend(front_legends ? front_legends[row][column] : "") cherry() { // (row+4) % 5 + 1
key_profile(profile, row_sculpting, column_value) u(key_length) uh(key_height) legend(legends ? legends[row][column] : "", size=legend_sizes ? $font_size+legend_sizes[row][column] : $font_size) front_legend(front_legends ? front_legends[row][column] : "") cherry() { // (row+4) % 5 + 1
$row = row;
$column = column;