Jump to content

Supporting Shift key for virtual keyboard


HoloLite
 Share

Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...