HoloLite Posted December 11, 2017 Share Posted December 11, 2017 I am trying to support lower-case and upper case letters in the virtual key. One natural approach is to use shift key to alternate the 2 cases. But looking at the keyboard types/api's, I don't see how to add shift key (or any control key for that matter) to the virtual keyboard, unless I am missing something. Anyone hits into similar thing and perhaps has the solution ? Thanks Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted December 11, 2017 Share Posted December 11, 2017 Hi, @HoloLite due to the way the virtualKeyboard is made, this requires a little bit of work. But is very doable I made comments that should explain what is happening, but if you have any questions, feel free to ask them. Quick explaination; Shift is used as a Caps-lock, Clicking it once will make keys upperCase, clicking it again will turn it off and return the keys to lowerCase.https://www.babylonjs-playground.com/#S7L7FE#6 Side-Note; if a key is upperCase by default, it will also visually on the keyboard be made lowerCase by the second shift click, but it will continue to be written in upperCase. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 11, 2017 Share Posted December 11, 2017 Good job..This could be a cool option to the virtualKeyboard Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 11, 2017 Share Posted December 11, 2017 Pinging @adam who may want to look at it Quote Link to comment Share on other sites More sharing options...
HoloLite Posted December 11, 2017 Author Share Posted December 11, 2017 @aWeirdo Nice trick and it does the job! The shift can also be used to alternate numbers with alphanumerics (like !, @, # $ etc). Quote Link to comment Share on other sites More sharing options...
HoloLite Posted December 11, 2017 Author Share Posted December 11, 2017 1 hour ago, aWeirdo said: On second thought, we actually can use escaped control char like "\u21D1" as the thick up arrow sign instead of "Shift". This will make parsing for the shift char easier. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted December 11, 2017 Share Posted December 11, 2017 @HoloLite Here's one with a closed unicode arrow, added color change aswell. https://www.babylonjs-playground.com/#S7L7FE#8 HoloLite 1 Quote Link to comment Share on other sites More sharing options...
HoloLite Posted December 11, 2017 Author Share Posted December 11, 2017 Nice! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 11, 2017 Share Posted December 11, 2017 @aWeirdo fancy making it official? Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted December 12, 2017 Share Posted December 12, 2017 @Deltakosh I'll make a PR tomorrow if i have a bit of spare time. brianzinn 1 Quote Link to comment Share on other sites More sharing options...
HoloLite Posted December 12, 2017 Author Share Posted December 12, 2017 As an exercise, I implemented the custom keyboard as a TS class. It uses 2 keyboards internally, with only 1 being active at a time. This makes it easier to have different key layouts. CustomKeyboard.ts aWeirdo 1 Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted December 12, 2017 Share Posted December 12, 2017 Updated PG; http://www.babylonjs-playground.com/#S7L7FE#9 PR; https://github.com/BabylonJS/Babylon.js/pull/3368 Added a "shiftState" instead of an boolean. Allowing a more mobile-like virtual keyboard, One click = Only next letter is upperCase. // Light blue key. Two clicks = Caps-lock on. // Light blue key & border. Three clicks = Caps-lock off. // default color & no border. Arte and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 12, 2017 Share Posted December 12, 2017 Merged! aWeirdo 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.