replace unknown and special keys with none

This commit is contained in:
Teatov 2025-08-02 10:04:33 +10:00
parent e57b7829a9
commit 2217bf76d1
5 changed files with 18 additions and 23 deletions

View File

@ -64,12 +64,12 @@ static func instantiate_with_props(
node.keyboard = _keyboard node.keyboard = _keyboard
node.load_props(_props, init_pos, default_angle) node.load_props(_props, init_pos, default_angle)
if _props.physical_keycode != KEY_SPECIAL: if _props.physical_keycode != KEY_NONE:
node.name = node.name + " " + OS.get_keycode_string(_props.physical_keycode) node.name += " " + OS.get_keycode_string(_props.physical_keycode)
if _props.location != KEY_LOCATION_UNSPECIFIED: if _props.location != KEY_LOCATION_UNSPECIFIED:
node.name += ( node.name += (
" " + ("Left" if _props.location == KEY_LOCATION_LEFT else "Right") " " + ("Left" if _props.location == KEY_LOCATION_LEFT else "Right")
) )
return node return node
@ -206,9 +206,6 @@ func _set_labels(chars_dict: Dictionary[KeyProps.Char, String] = {}) -> void:
func _set_labels_text(chars_dict: Dictionary[KeyProps.Char, String]) -> void: func _set_labels_text(chars_dict: Dictionary[KeyProps.Char, String]) -> void:
if props.physical_keycode == KEY_SPECIAL:
return
if not props.is_char(): if not props.is_char():
_center_label.text = OS.get_keycode_string(props.physical_keycode) _center_label.text = OS.get_keycode_string(props.physical_keycode)
return return

View File

@ -14,11 +14,11 @@ var layout_rows: Array[Array]
var is_configuring: bool = false var is_configuring: bool = false
var layouts: Dictionary[String, AbstractLayout] = { var layouts: Dictionary[String, AbstractLayout] = {
# LayoutANSI.name: LayoutANSI.new(), LayoutANSI.name: LayoutANSI.new(),
# LayoutANSIVariant.name: LayoutANSIVariant.new(), LayoutANSIVariant.name: LayoutANSIVariant.new(),
# LayoutISO.name: LayoutISO.new(), LayoutISO.name: LayoutISO.new(),
# LayoutABNT.name: LayoutABNT.new(), LayoutABNT.name: LayoutABNT.new(),
# LayoutJIS.name: LayoutJIS.new(), LayoutJIS.name: LayoutJIS.new(),
# LayoutTest.name: LayoutTest.new(), # LayoutTest.name: LayoutTest.new(),
} }

View File

@ -31,7 +31,7 @@ func get_rows() -> Array[Array]:
] ]
+ CommonRows.letters_row_3() + CommonRows.letters_row_3()
+ [ + [
{KeyProps.KEY: KEY_UNKNOWN}, {KeyProps.KEY: KEY_NONE},
{ {
KeyProps.KEY: KEY_SHIFT, KeyProps.KEY: KEY_SHIFT,
KeyProps.W: 1.75, KeyProps.W: 1.75,

View File

@ -11,7 +11,7 @@ func get_rows() -> Array[Array]:
return [ return [
( (
CommonRows.number_row() CommonRows.number_row()
+ [{KeyProps.KEY: KEY_UNKNOWN}, {KeyProps.KEY: KEY_BACKSPACE}] + [{KeyProps.KEY: KEY_NONE}, {KeyProps.KEY: KEY_BACKSPACE}]
), ),
( (
[{KeyProps.KEY: KEY_TAB, KeyProps.W: 1.5}] [{KeyProps.KEY: KEY_TAB, KeyProps.W: 1.5}]
@ -33,7 +33,7 @@ func get_rows() -> Array[Array]:
] ]
+ CommonRows.letters_row_3() + CommonRows.letters_row_3()
+ [ + [
{KeyProps.KEY: KEY_UNKNOWN}, {KeyProps.KEY: KEY_NONE},
{ {
KeyProps.KEY: KEY_SHIFT, KeyProps.KEY: KEY_SHIFT,
KeyProps.W: 1.75, KeyProps.W: 1.75,
@ -45,10 +45,10 @@ func get_rows() -> Array[Array]:
{KeyProps.KEY: KEY_CTRL, KeyProps.W: 1.25, KeyProps.LOC: KEY_LOCATION_LEFT}, {KeyProps.KEY: KEY_CTRL, KeyProps.W: 1.25, KeyProps.LOC: KEY_LOCATION_LEFT},
{KeyProps.KEY: KEY_META, KeyProps.W: 1.25, KeyProps.LOC: KEY_LOCATION_LEFT}, {KeyProps.KEY: KEY_META, KeyProps.W: 1.25, KeyProps.LOC: KEY_LOCATION_LEFT},
{KeyProps.KEY: KEY_ALT, KeyProps.W: 1.25, KeyProps.LOC: KEY_LOCATION_LEFT}, {KeyProps.KEY: KEY_ALT, KeyProps.W: 1.25, KeyProps.LOC: KEY_LOCATION_LEFT},
{KeyProps.KEY: KEY_SPECIAL, KeyProps.W: 1.25}, {KeyProps.KEY: KEY_NONE, KeyProps.W: 1.25},
{KeyProps.KEY: KEY_SPACE, KeyProps.W: 2.5}, {KeyProps.KEY: KEY_SPACE, KeyProps.W: 2.5},
{KeyProps.KEY: KEY_SPECIAL, KeyProps.W: 1.25}, {KeyProps.KEY: KEY_NONE, KeyProps.W: 1.25},
{KeyProps.KEY: KEY_SPECIAL, KeyProps.W: 1.25}, {KeyProps.KEY: KEY_NONE, KeyProps.W: 1.25},
{KeyProps.KEY: KEY_ALT, KeyProps.W: 1.25, KeyProps.LOC: KEY_LOCATION_RIGHT}, {KeyProps.KEY: KEY_ALT, KeyProps.W: 1.25, KeyProps.LOC: KEY_LOCATION_RIGHT},
{ {
KeyProps.KEY: KEY_META, KeyProps.KEY: KEY_META,

View File

@ -42,7 +42,6 @@ const LABEL_TO_KEYCODE_MAP: Dictionary[String, Key] = {
"Pause Break": KEY_PAUSE, "Pause Break": KEY_PAUSE,
"Page Down": KEY_PAGEDOWN, "Page Down": KEY_PAGEDOWN,
"Num Lock": KEY_NUMLOCK, "Num Lock": KEY_NUMLOCK,
"Fn": KEY_SPECIAL,
"": KEY_UP, "": KEY_UP,
"": KEY_UP, "": KEY_UP,
"↑": KEY_UP, "↑": KEY_UP,
@ -168,7 +167,6 @@ func _deserialize_row(
var key_pos_dict := { var key_pos_dict := {
KEY_DICT: key_dict, POS: Vector2(key_pos_rotated.x, key_pos_rotated.z) KEY_DICT: key_dict, POS: Vector2(key_pos_rotated.x, key_pos_rotated.z)
} }
print(item as String, key_pos_dict)
if key_pos_dicts.has(keycode): if key_pos_dicts.has(keycode):
key_pos_dicts[keycode].append(key_pos_dict) key_pos_dicts[keycode].append(key_pos_dict)
@ -293,7 +291,7 @@ func _get_key_locations(key_pos_dicts: Dictionary[Key, Array]) -> void:
key_pos_dicts[KEY_BACKSLASH][0][KEY_DICT][KeyProps.KEY] = KEY_SECTION key_pos_dicts[KEY_BACKSLASH][0][KEY_DICT][KeyProps.KEY] = KEY_SECTION
continue continue
if dicts.size() == 1: if keycode == KEY_NONE or dicts.size() == 1:
continue continue
var key_pos_dict_left: Dictionary var key_pos_dict_left: Dictionary