From a73652008713440cfa9d5ddd763158d5cd4008b7 Mon Sep 17 00:00:00 2001 From: Ada Date: Tue, 8 Apr 2025 01:40:29 +1000 Subject: [PATCH] Move copy/paste, add cursor keys --- interface/resources/config/keyboard.json | 518 +++++++++++++++++- .../resources/meshes/keyboard/key_down.png | Bin 0 -> 2294 bytes .../resources/meshes/keyboard/key_left.png | Bin 0 -> 2268 bytes .../resources/meshes/keyboard/key_right.png | Bin 0 -> 2276 bytes .../resources/meshes/keyboard/key_up.png | Bin 0 -> 2300 bytes interface/src/ui/Keyboard.cpp | 45 +- interface/src/ui/Keyboard.h | 6 +- 7 files changed, 555 insertions(+), 14 deletions(-) create mode 100644 interface/resources/meshes/keyboard/key_down.png create mode 100644 interface/resources/meshes/keyboard/key_left.png create mode 100644 interface/resources/meshes/keyboard/key_right.png create mode 100644 interface/resources/meshes/keyboard/key_up.png diff --git a/interface/resources/config/keyboard.json b/interface/resources/config/keyboard.json index 6a6cc4d6b7..4528003602 100644 --- a/interface/resources/config/keyboard.json +++ b/interface/resources/config/keyboard.json @@ -820,9 +820,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.65333323516845703, + "x": -0.026292800903320312, "y": 0.019300000742077827, - "z": -0.02 + "z": 0.09745675086975098 }, "modelURL": "meshes/keyboard/SM_key.fbx", "texture": { @@ -841,13 +841,13 @@ "type": "cut", "dimensions": { "x": 0.04787999764084816, - "z": 0.020519999787211418, + "z": 0.02051999792456627, "y": 0.04787999764084816 }, "position": { - "x": -0.70333323516845703, + "x": -0.08203601837158203, "y": 0.019300000742077827, - "z": -0.02 + "z": 0.09745675086975098 }, "modelURL": "meshes/keyboard/SM_key.fbx", "texture": { @@ -870,9 +870,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.65333323516845703, + "x": -0.47769832611083984, "y": 0.019300000742077827, - "z": -0.07 + "z": 0.09745675086975098 }, "modelURL": "meshes/keyboard/SM_key.fbx", "texture": { @@ -895,9 +895,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.70333323516845703, + "x": -0.5332040786743164, "y": 0.019300000742077827, - "z": -0.07 + "z": 0.09745675086975098 }, "modelURL": "meshes/keyboard/SM_key.fbx", "texture": { @@ -911,6 +911,106 @@ "z": 0.707 } }, + { + "key": "Up", + "type": "cursor_up", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.68333323516845703, + "y": 0.019300000742077827, + "z": -0.02282185554504395 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_up.png", + "file10": "meshes/keyboard/key_up.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Left", + "type": "cursor_left", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.63333323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_left.png", + "file10": "meshes/keyboard/key_left.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Down", + "type": "cursor_down", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.68333323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_down.png", + "file10": "meshes/keyboard/key_down.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Right", + "type": "cursor_right", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.73333323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_right.png", + "file10": "meshes/keyboard/key_right.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, { "key": "numbers", "type": "layer", @@ -1689,6 +1789,206 @@ "z": 0.707 } }, + { + "key": "Select All", + "type": "select_all", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.026292800903320312, + "y": 0.019300000742077827, + "z": 0.09745675086975098 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_select_all.png", + "file10": "meshes/keyboard/key_select_all.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Cut", + "type": "cut", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.02051999792456627, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.08203601837158203, + "y": 0.019300000742077827, + "z": 0.09745675086975098 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_cut.png", + "file10": "meshes/keyboard/key_cut.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Copy", + "type": "copy", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.47769832611083984, + "y": 0.019300000742077827, + "z": 0.09745675086975098 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_copy.png", + "file10": "meshes/keyboard/key_copy.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Paste", + "type": "paste", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.5332040786743164, + "y": 0.019300000742077827, + "z": 0.09745675086975098 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_paste.png", + "file10": "meshes/keyboard/key_paste.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Up", + "type": "cursor_up", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.68333323516845703, + "y": 0.019300000742077827, + "z": -0.02282185554504395 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_up.png", + "file10": "meshes/keyboard/key_up.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Left", + "type": "cursor_left", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.63333323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_left.png", + "file10": "meshes/keyboard/key_left.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Down", + "type": "cursor_down", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.68333323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_down.png", + "file10": "meshes/keyboard/key_down.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Right", + "type": "cursor_right", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.73333323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_right.png", + "file10": "meshes/keyboard/key_right.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, { "key": "numbers", "type": "layer", @@ -2515,6 +2815,206 @@ "z": 0.707 } }, + { + "key": "Select All", + "type": "select_all", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.026292800903320312, + "y": 0.019300000742077827, + "z": 0.09745675086975098 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_select_all.png", + "file10": "meshes/keyboard/key_select_all.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Cut", + "type": "cut", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.02051999792456627, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.08203601837158203, + "y": 0.019300000742077827, + "z": 0.09745675086975098 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_cut.png", + "file10": "meshes/keyboard/key_cut.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Copy", + "type": "copy", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.47769832611083984, + "y": 0.019300000742077827, + "z": 0.09745675086975098 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_copy.png", + "file10": "meshes/keyboard/key_copy.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Paste", + "type": "paste", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.5332040786743164, + "y": 0.019300000742077827, + "z": 0.09745675086975098 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_paste.png", + "file10": "meshes/keyboard/key_paste.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Up", + "type": "cursor_up", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.68333323516845703, + "y": 0.019300000742077827, + "z": -0.02282185554504395 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_up.png", + "file10": "meshes/keyboard/key_up.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Left", + "type": "cursor_left", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.63333323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_left.png", + "file10": "meshes/keyboard/key_left.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Down", + "type": "cursor_down", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.68333323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_down.png", + "file10": "meshes/keyboard/key_down.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Right", + "type": "cursor_right", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.73333323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_right.png", + "file10": "meshes/keyboard/key_right.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, { "key": "numbers", "type": "layer", diff --git a/interface/resources/meshes/keyboard/key_down.png b/interface/resources/meshes/keyboard/key_down.png new file mode 100644 index 0000000000000000000000000000000000000000..fd9cc215e2884cceede805eb77165769e64d39cb GIT binary patch literal 2294 zcmds2VN8`(7=F&V-~H~9dx0Z4xQWCU%<>1fbhRwd_z;-f7WAdL=J@kDr!;4BH&$R! z9D`^Y6l*P~vbZjqRMTi|U`6ufZPkx(Y-Q8D+r^rtI0_>gBHY`~?Y1kf4X*s_$N9GJ zocDd7=Y8JuzGuHtu`xMmc@ltRZ&}GEfI=>&0{FA;`)L46d}Ui}0OuWY5ghJt1FYLy zQuI{ak7L21XGisAEf@Kd$-mh%etyWe=Dx2c+snK1SXz7Mp+`a!dGD4TEZEvn`?@FP z*u*@L%U+JKS5`2h;)vd<=@+B>YoN=4An_eMSe)I(9vgX0hB8Fr50=bai2hKm5UlEZZB9}X_jAd0FZErkp{c5ujZLSR?l>0Lcj1k0*K zM*)Lx;yG17bY18sjDfYGzp*Nr!nGk%706c5wVS+|V{K2B{=Pm9TD`F{*m_(dZCh$i zrb?2{ZM_OXj#Yks+(Gcx0TkINg61o&y*7dz{~trq{gc--!y2q~ZHE&KoZP*19CMglsb@N%_FgDt@K5?@uCktK2SIbGI9teoehD+_iT-F0QV_V($exJo zisS!q@n6$ty-Hmx7~Bujh6){m`EEEAjMoQ3W7!G}(`ioGC|s2~z|uIxQ740TFKuQF z7E}esditeo7jv1}s%TSt5AEoU98yXP)EqSGtGu)bk7L0Vf;@ zbq#@aIm@LoPjgZ8)!gJ?jaAw?h&=0>r+Kc1D*kyBjs1ErWu}$LWPkAb`Iq_Kcl?*W z{q5^8q1ZAyr{U(|q&l?}RXl_zqHh+!4P&cM55^_L>>*&JQUi}FpIqyNR%i8sx}pEP zdp@bSVVH6VY$kTdBm^Us3~c<*_r^Q2io~f(CQufmE=kJ3zFOjo*;Uk~(0!v5eJSFA zk&tV_v%uv(Vc%eJU=?!7lqC%PsA#yH&OUdikp!n2$m z=7ejgT+g;pV>;Z}RD`-l9enb_f;~X2i(-nXB#%hg?{rtiula6p|a3{gmEZec>) z|9|C%lhy24?A;`aYnDYG5pKs&l?6U|;c4{rfApCHA+UtgsE3Deqmv&%L_%}{0Wh#Z zsuBjSC3=PjW@T)B{9wEgwa|t(cx<4cZCqQ!)jJx%^qE~P%g&uf0o?KqHv=2ULL7im z6$f)(wTV`&H=OVgEP$V_tsp^{6igBaJe#3Gmq77GC27ut-g9kUxn(}Z2EY8!K}E&& z8d}_>1H9!bS+h3s9pZmu=KtnW%&m1C9nW;N Jo^I}Y>kl(0WYGWs literal 0 HcmV?d00001 diff --git a/interface/resources/meshes/keyboard/key_right.png b/interface/resources/meshes/keyboard/key_right.png new file mode 100644 index 0000000000000000000000000000000000000000..aa082807c3bd3b951b99121684c90de245ea74b6 GIT binary patch literal 2276 zcmcIlZ)_7~9DeS0ZC}=vU4huSX7n0EvMV`&psk(+-S)2qF_n7%pMV54t8Z-C?yD{NPA1Gb^K=s}dwg8yTK>Yt5a+W#O`QS^V(k z?tbs@p6B_!&-?z~?oEvwErq3p04xplp3MLYbr2(f+y2XU0W9;?KerPwuT%$vW5-JX z@0HQ`e-_#=0XG!uxpG}|Dq!(LQC%?F|=8%Yx zNq!W13#b=UeVs$0yWaVFa34}$=z7lS#qLAbbB@5l=uXV~HjhVnQRpGfja3ZGgszK> zY{)9p@xS|u4W*Z-$69Y!VP|LV1P=y#dPaD9$8SRO>&g-3EfLuJshd!sqZT|ULF3m$ z3_Dy$k8tM=@L93^=Qwsp>*Ce$g075jKeMesGJr(5uu=O<O*i+z-Ix2WGPr^B=j}a#WB^9!!;r&05!G$Jw^*%MWpMc z!5s`f{42G~-sEa%+A@0j-2)h3J(&u)1f;)p&MI z4&Hn3kG3h3%~?UvgwTVou%#SWYHo!-DA&pUb=v%D&Dk?rh{fA zyB$6T{oB~k1_Gg+Q-$D@)`*2)%4weOwEq7Gc@h0<9x)3~Eur1zfv(rp^kNI^T-xQ8 l=WV067<#e1N+5vnP4UA!jvc=mg@efC~aOVI3 literal 0 HcmV?d00001 diff --git a/interface/resources/meshes/keyboard/key_up.png b/interface/resources/meshes/keyboard/key_up.png new file mode 100644 index 0000000000000000000000000000000000000000..65b7e6707c0d38ff220a08f69f1c324696b76145 GIT binary patch literal 2300 zcmc&#ZERCz6n@@&Z=2VxjaNrz!)SLW8VF%Q6c`S57dBuE*)oVG5Ogac2vL->shf!F zy9JvOHktkq{K(jX3H;fdj%+LgTGGf+65JHySSPHC*@w>EDP*0N)x1}dw)oLDCi3I` zao_WtbDneFbDy)nxM;08X?79-b3uOI20#Em)Ck~u<)z;M+~vsMR1PGk@I&z42Nr;~ z7UZpbvT|U2u&?k(Rd%hf*-$vR?&&&T?Sb8kTj$Y?E48y|N5yc?@MKAY{nf*}dR$-q zu&3Kiu>OjbfC8$X2Qt6_NPq%>AciSHcsNO1(ZldCr@y<4%~MURtmq_Uh~9P+Z+re* z+E~qxW*O!rB>arGB85Z5H4uUN_PIFIa^boba_xRaEj~Y5cKTbZXbFBH69ufzzsT5> zIsxW)|2`}T7;yv+K!!S^-A5E)rC(M7*HQ(n*1u?>3J9VM^-D)8w`P^AKn=eb-LgCxZ|Lp&c4Ojo?%1z6Z#>_|akc3x80o(-?*8;6gA9AX zCon)aoxGWqLOP(pqfG?g$>cn?c++L5n%2o(_uWerc*d`erE|YyCY_T#&^@j9@pEm8 ziV{wqO`5%(3NSgdp5-OXe?0hxnZmKvY;DlldDFKi3;5*0mY&k-lGUJ?U!GgIciGRJ zr#-MW83Ni2{KY(Y$;iM`yXvzmWY}rfbapa_q*ZQi+@A>wRf2%Q8A7n+q2R}yp(~An zjdeP`S9vd)T_AWdpzI0M9ryEAv1X3AVPk$+ibu#F>=uj!q5 z#&mSS`$Fz43EDL_b-1ZMlN}L9FTRNZOFotXX=@HG7YX*Q0R?NIfnY^7N>7RCmzX(D zsrt*`5;@~)p?7&`?E7!FmF9hI@FC3Wq&Aoy_8q0ch@6v*PnwNSuR8)3lC zTe{fvz(HPo^>An8h@R7d#!yA-s|b0%3N$mfp;#spOAA3D3|;ksYl zRdae9`9@k{9D3{JcTH6?pc-r>LinS|$FX=4AQs*(-0T06&+zVyoW$G6#56^7j|q>c e?oKs`4LpI26-CmuZI2uSfP&RUd9ADLHGcq6pJRpq literal 0 HcmV?d00001 diff --git a/interface/src/ui/Keyboard.cpp b/interface/src/ui/Keyboard.cpp index 3d7d4bf264..a4d346fd2c 100644 --- a/interface/src/ui/Keyboard.cpp +++ b/interface/src/ui/Keyboard.cpp @@ -88,6 +88,10 @@ static const QString SELECT_ALL_STRING = "select_all"; static const QString COPY_STRING = "copy"; static const QString CUT_STRING = "cut"; static const QString PASTE_STRING = "paste"; +static const QString CURSOR_UP_STRING = "cursor_up"; +static const QString CURSOR_RIGHT_STRING = "cursor_right"; +static const QString CURSOR_DOWN_STRING = "cursor_down"; +static const QString CURSOR_LEFT_STRING = "cursor_left"; static const QString KEY_HOVER_HIGHLIGHT = "keyHoverHiglight"; static const QString KEY_PRESSED_HIGHLIGHT = "keyPressesHighlight"; @@ -216,6 +220,14 @@ Key::Type Key::getKeyTypeFromString(const QString& keyTypeString) { return Type::CUT; } else if (keyTypeString == PASTE_STRING) { return Type::PASTE; + } else if (keyTypeString == CURSOR_UP_STRING) { + return Type::CURSOR_UP; + } else if (keyTypeString == CURSOR_RIGHT_STRING) { + return Type::CURSOR_RIGHT; + } else if (keyTypeString == CURSOR_DOWN_STRING) { + return Type::CURSOR_DOWN; + } else if (keyTypeString == CURSOR_LEFT_STRING) { + return Type::CURSOR_LEFT; } return Type::CHARACTER; @@ -520,7 +532,8 @@ bool Keyboard::shouldProcessPointerEvent(const PointerEvent& event) const { return ((isStylusEvent && preferMalletsOverLasers) || (isLaserEvent && !preferMalletsOverLasers)); } -void Keyboard::handleShortcut(Key::Type keyType) { +void Keyboard::handleSpecialKey(Key::Type keyType) { + Qt::KeyboardModifier keyMod = Qt::ControlModifier; int keyCode; switch (keyType) { case Key::Type::SELECT_ALL: @@ -539,14 +552,34 @@ void Keyboard::handleShortcut(Key::Type keyType) { keyCode = Qt::Key_V; break; + case Key::Type::CURSOR_UP: + keyCode = Qt::Key_Up; + keyMod = Qt::NoModifier; + break; + + case Key::Type::CURSOR_RIGHT: + keyCode = Qt::Key_Right; + keyMod = Qt::NoModifier; + break; + + case Key::Type::CURSOR_DOWN: + keyCode = Qt::Key_Down; + keyMod = Qt::NoModifier; + break; + + case Key::Type::CURSOR_LEFT: + keyCode = Qt::Key_Left; + keyMod = Qt::NoModifier; + break; + // shouldn't reach here default: return; } // Qt automatically remaps ⌘A, ⌘C, etc. to ^A and ^C on macOS - QKeyEvent* pressEvent = new QKeyEvent(QEvent::KeyPress, keyCode, Qt::ControlModifier); - QKeyEvent* releaseEvent = new QKeyEvent(QEvent::KeyRelease, keyCode, Qt::ControlModifier); + QKeyEvent* pressEvent = new QKeyEvent(QEvent::KeyPress, keyCode, keyMod); + QKeyEvent* releaseEvent = new QKeyEvent(QEvent::KeyRelease, keyCode, keyMod); if (_inputToHudUI) { QCoreApplication::postEvent(qApp->getPrimaryWidget(), pressEvent); @@ -629,7 +662,11 @@ void Keyboard::handleTriggerBegin(const QUuid& id, const PointerEvent& event) { case Key::Type::COPY: case Key::Type::CUT: case Key::Type::PASTE: - handleShortcut(key.getKeyType()); + case Key::Type::CURSOR_UP: + case Key::Type::CURSOR_RIGHT: + case Key::Type::CURSOR_DOWN: + case Key::Type::CURSOR_LEFT: + handleSpecialKey(key.getKeyType()); return; case Key::Type::CHARACTER: if (keyString != " ") { diff --git a/interface/src/ui/Keyboard.h b/interface/src/ui/Keyboard.h index 0b0de6110f..81f2e13019 100644 --- a/interface/src/ui/Keyboard.h +++ b/interface/src/ui/Keyboard.h @@ -45,6 +45,10 @@ public: COPY, CUT, PASTE, + CURSOR_UP, + CURSOR_RIGHT, + CURSOR_DOWN, + CURSOR_LEFT, }; static Key::Type getKeyTypeFromString(const QString& keyTypeString); @@ -165,7 +169,7 @@ private: void startLayerSwitchTimer(); bool isLayerSwitchTimerFinished() const; - void handleShortcut(Key::Type keyType); + void handleSpecialKey(Key::Type keyType); bool _raised { false }; bool _resetKeyboardPositionOnRaise { true };