@@ -113,83 +113,88 @@ pub fn should_ignore_key(key: &str) -> bool {
113
113
/// Web sends all all keys as strings, so it is up to us to figure out if it is
114
114
/// a real text input or the name of a key.
115
115
pub fn translate_key ( key : & str ) -> Option < egui:: Key > {
116
+ use egui:: Key ;
117
+
116
118
match key {
117
- "ArrowDown" => Some ( egui:: Key :: ArrowDown ) ,
118
- "ArrowLeft" => Some ( egui:: Key :: ArrowLeft ) ,
119
- "ArrowRight" => Some ( egui:: Key :: ArrowRight ) ,
120
- "ArrowUp" => Some ( egui:: Key :: ArrowUp ) ,
121
-
122
- "Esc" | "Escape" => Some ( egui:: Key :: Escape ) ,
123
- "Tab" => Some ( egui:: Key :: Tab ) ,
124
- "Backspace" => Some ( egui:: Key :: Backspace ) ,
125
- "Enter" => Some ( egui:: Key :: Enter ) ,
126
- "Space" | " " => Some ( egui:: Key :: Space ) ,
127
-
128
- "Help" | "Insert" => Some ( egui:: Key :: Insert ) ,
129
- "Delete" => Some ( egui:: Key :: Delete ) ,
130
- "Home" => Some ( egui:: Key :: Home ) ,
131
- "End" => Some ( egui:: Key :: End ) ,
132
- "PageUp" => Some ( egui:: Key :: PageUp ) ,
133
- "PageDown" => Some ( egui:: Key :: PageDown ) ,
134
-
135
- "0" => Some ( egui:: Key :: Num0 ) ,
136
- "1" => Some ( egui:: Key :: Num1 ) ,
137
- "2" => Some ( egui:: Key :: Num2 ) ,
138
- "3" => Some ( egui:: Key :: Num3 ) ,
139
- "4" => Some ( egui:: Key :: Num4 ) ,
140
- "5" => Some ( egui:: Key :: Num5 ) ,
141
- "6" => Some ( egui:: Key :: Num6 ) ,
142
- "7" => Some ( egui:: Key :: Num7 ) ,
143
- "8" => Some ( egui:: Key :: Num8 ) ,
144
- "9" => Some ( egui:: Key :: Num9 ) ,
145
-
146
- "a" | "A" => Some ( egui:: Key :: A ) ,
147
- "b" | "B" => Some ( egui:: Key :: B ) ,
148
- "c" | "C" => Some ( egui:: Key :: C ) ,
149
- "d" | "D" => Some ( egui:: Key :: D ) ,
150
- "e" | "E" => Some ( egui:: Key :: E ) ,
151
- "f" | "F" => Some ( egui:: Key :: F ) ,
152
- "g" | "G" => Some ( egui:: Key :: G ) ,
153
- "h" | "H" => Some ( egui:: Key :: H ) ,
154
- "i" | "I" => Some ( egui:: Key :: I ) ,
155
- "j" | "J" => Some ( egui:: Key :: J ) ,
156
- "k" | "K" => Some ( egui:: Key :: K ) ,
157
- "l" | "L" => Some ( egui:: Key :: L ) ,
158
- "m" | "M" => Some ( egui:: Key :: M ) ,
159
- "n" | "N" => Some ( egui:: Key :: N ) ,
160
- "o" | "O" => Some ( egui:: Key :: O ) ,
161
- "p" | "P" => Some ( egui:: Key :: P ) ,
162
- "q" | "Q" => Some ( egui:: Key :: Q ) ,
163
- "r" | "R" => Some ( egui:: Key :: R ) ,
164
- "s" | "S" => Some ( egui:: Key :: S ) ,
165
- "t" | "T" => Some ( egui:: Key :: T ) ,
166
- "u" | "U" => Some ( egui:: Key :: U ) ,
167
- "v" | "V" => Some ( egui:: Key :: V ) ,
168
- "w" | "W" => Some ( egui:: Key :: W ) ,
169
- "x" | "X" => Some ( egui:: Key :: X ) ,
170
- "y" | "Y" => Some ( egui:: Key :: Y ) ,
171
- "z" | "Z" => Some ( egui:: Key :: Z ) ,
172
-
173
- "F1" => Some ( egui:: Key :: F1 ) ,
174
- "F2" => Some ( egui:: Key :: F2 ) ,
175
- "F3" => Some ( egui:: Key :: F3 ) ,
176
- "F4" => Some ( egui:: Key :: F4 ) ,
177
- "F5" => Some ( egui:: Key :: F5 ) ,
178
- "F6" => Some ( egui:: Key :: F6 ) ,
179
- "F7" => Some ( egui:: Key :: F7 ) ,
180
- "F8" => Some ( egui:: Key :: F8 ) ,
181
- "F9" => Some ( egui:: Key :: F9 ) ,
182
- "F10" => Some ( egui:: Key :: F10 ) ,
183
- "F11" => Some ( egui:: Key :: F11 ) ,
184
- "F12" => Some ( egui:: Key :: F12 ) ,
185
- "F13" => Some ( egui:: Key :: F13 ) ,
186
- "F14" => Some ( egui:: Key :: F14 ) ,
187
- "F15" => Some ( egui:: Key :: F15 ) ,
188
- "F16" => Some ( egui:: Key :: F16 ) ,
189
- "F17" => Some ( egui:: Key :: F17 ) ,
190
- "F18" => Some ( egui:: Key :: F18 ) ,
191
- "F19" => Some ( egui:: Key :: F19 ) ,
192
- "F20" => Some ( egui:: Key :: F20 ) ,
119
+ "ArrowDown" => Some ( Key :: ArrowDown ) ,
120
+ "ArrowLeft" => Some ( Key :: ArrowLeft ) ,
121
+ "ArrowRight" => Some ( Key :: ArrowRight ) ,
122
+ "ArrowUp" => Some ( Key :: ArrowUp ) ,
123
+
124
+ "Esc" | "Escape" => Some ( Key :: Escape ) ,
125
+ "Tab" => Some ( Key :: Tab ) ,
126
+ "Backspace" => Some ( Key :: Backspace ) ,
127
+ "Enter" => Some ( Key :: Enter ) ,
128
+ "Space" | " " => Some ( Key :: Space ) ,
129
+
130
+ "Help" | "Insert" => Some ( Key :: Insert ) ,
131
+ "Delete" => Some ( Key :: Delete ) ,
132
+ "Home" => Some ( Key :: Home ) ,
133
+ "End" => Some ( Key :: End ) ,
134
+ "PageUp" => Some ( Key :: PageUp ) ,
135
+ "PageDown" => Some ( Key :: PageDown ) ,
136
+
137
+ "-" => Some ( Key :: Minus ) ,
138
+ "+" | "=" => Some ( Key :: PlusEquals ) ,
139
+
140
+ "0" => Some ( Key :: Num0 ) ,
141
+ "1" => Some ( Key :: Num1 ) ,
142
+ "2" => Some ( Key :: Num2 ) ,
143
+ "3" => Some ( Key :: Num3 ) ,
144
+ "4" => Some ( Key :: Num4 ) ,
145
+ "5" => Some ( Key :: Num5 ) ,
146
+ "6" => Some ( Key :: Num6 ) ,
147
+ "7" => Some ( Key :: Num7 ) ,
148
+ "8" => Some ( Key :: Num8 ) ,
149
+ "9" => Some ( Key :: Num9 ) ,
150
+
151
+ "a" | "A" => Some ( Key :: A ) ,
152
+ "b" | "B" => Some ( Key :: B ) ,
153
+ "c" | "C" => Some ( Key :: C ) ,
154
+ "d" | "D" => Some ( Key :: D ) ,
155
+ "e" | "E" => Some ( Key :: E ) ,
156
+ "f" | "F" => Some ( Key :: F ) ,
157
+ "g" | "G" => Some ( Key :: G ) ,
158
+ "h" | "H" => Some ( Key :: H ) ,
159
+ "i" | "I" => Some ( Key :: I ) ,
160
+ "j" | "J" => Some ( Key :: J ) ,
161
+ "k" | "K" => Some ( Key :: K ) ,
162
+ "l" | "L" => Some ( Key :: L ) ,
163
+ "m" | "M" => Some ( Key :: M ) ,
164
+ "n" | "N" => Some ( Key :: N ) ,
165
+ "o" | "O" => Some ( Key :: O ) ,
166
+ "p" | "P" => Some ( Key :: P ) ,
167
+ "q" | "Q" => Some ( Key :: Q ) ,
168
+ "r" | "R" => Some ( Key :: R ) ,
169
+ "s" | "S" => Some ( Key :: S ) ,
170
+ "t" | "T" => Some ( Key :: T ) ,
171
+ "u" | "U" => Some ( Key :: U ) ,
172
+ "v" | "V" => Some ( Key :: V ) ,
173
+ "w" | "W" => Some ( Key :: W ) ,
174
+ "x" | "X" => Some ( Key :: X ) ,
175
+ "y" | "Y" => Some ( Key :: Y ) ,
176
+ "z" | "Z" => Some ( Key :: Z ) ,
177
+
178
+ "F1" => Some ( Key :: F1 ) ,
179
+ "F2" => Some ( Key :: F2 ) ,
180
+ "F3" => Some ( Key :: F3 ) ,
181
+ "F4" => Some ( Key :: F4 ) ,
182
+ "F5" => Some ( Key :: F5 ) ,
183
+ "F6" => Some ( Key :: F6 ) ,
184
+ "F7" => Some ( Key :: F7 ) ,
185
+ "F8" => Some ( Key :: F8 ) ,
186
+ "F9" => Some ( Key :: F9 ) ,
187
+ "F10" => Some ( Key :: F10 ) ,
188
+ "F11" => Some ( Key :: F11 ) ,
189
+ "F12" => Some ( Key :: F12 ) ,
190
+ "F13" => Some ( Key :: F13 ) ,
191
+ "F14" => Some ( Key :: F14 ) ,
192
+ "F15" => Some ( Key :: F15 ) ,
193
+ "F16" => Some ( Key :: F16 ) ,
194
+ "F17" => Some ( Key :: F17 ) ,
195
+ "F18" => Some ( Key :: F18 ) ,
196
+ "F19" => Some ( Key :: F19 ) ,
197
+ "F20" => Some ( Key :: F20 ) ,
193
198
194
199
_ => None ,
195
200
}
0 commit comments