Comments (18)
Francisco,
I see. What you are saying is that physical keyboard maps to the virtual key value, where I am looking for keys to map to virtual key position or index. The use case is a language learning application, and the idea is that the user can get used to typing their querty keyboard and have the virtual keyboard act as a kind of visual superimposition, so that the student can get physical sensation of typing the the Arabic word.
So I suspected I would have to do some mapping of physical keys to virtual keyboard and it sounds like that is what you are saying too. My question is, given that I've built event handlers into my script for physical keyboard interaction, what method can I use to highlight and/or trigger click events on virtual keys so I can set-up my mapping? I read through the docs but I don't see a way to do it outlined there.
Thanks and beautiful keyboard!!!
from simple-keyboard.
from simple-keyboard.
from simple-keyboard.
Hello @tehChromic,
It's hard to debug your specific issue without a reproducible example. If you could visit the demos page, edit one of the demos as to show the issue and share the link, then I'd definitely take a look.
Also, one way to check if physicalKeyboardHighlight
is globally broken for your OS/Browser is to try out the following demo:
https://franciscohodge.com/projects/simple-keyboard/demo-showcase/full-keyboard/
If the keys are not highlighting for you in that page, then it's definitely is a bug to be investigated.
I'll close the ticket for now and reopen it once you provide the repro as described above.
Regards,
Francisco Hodge
from simple-keyboard.
Thanks for prompt reply and direction Francisco!
I've dug in and discovered that my physical keyboard words as expected in the demo. However I've found that using 'arabic' layout causes the issue - the physical keyboard produces no response in the simplekeyboard and the input produces english letters.
Here is a Codepen: https://codesandbox.io/s/simplekeyboardjsdemos-trd8b
Here are the only pieces of code I've changed from the demo:
let KeyboardLayouts = window.SimpleKeyboardLayouts.default;
/**
* Available layouts
* https://github.com/hodgef/simple-keyboard-layouts/tree/master/src/lib/layouts
*/
let layout = new KeyboardLayouts().get("arabic");
// ...
let keyboard = new Keyboard(".simple-keyboard-main",
Object.assign({}, commonKeyboardOptions, { layout: layout })
)
from simple-keyboard.
Hello @tehChromic,
Thanks for the follow up, although I'm a bit unsure of what you're trying to achieve.
If you have a QWERTY physical keyboard and simple-keyboard set up with an Arabic layout, then physicalKeyboardHighlight won't highlight any Arabic keys in simple-keyboard.
For instance, when you hit the "q" key in your physical keyboard, no key will be highlighted in simple-keyboard as the key "q" won't exist in the Arabic simple-keyboard layout.
Regards,
Francisco Hodge
from simple-keyboard.
Thank you for the clarification, I understand now :)
I think this would have to be done through custom highlighting. I'll try something out and report back shortly.
from simple-keyboard.
Hello @tehChromic,
Here's a very rough attempt:
It basically grabs the position of the pressed button (within a qwerty layout) then goes and highlights the button at that position in simple-keyboard.
If you take this as a base, just know that it's a rough/incomplete idea and you'd have to improve it to fit your needs. Hope it helps though!
Regards,
Francisco Hodge
from simple-keyboard.
from simple-keyboard.
Hello @tehChromic,
Here's an improved version of my example, using the layouts from simple-keyboard-layouts
and set up as a simple-keyboard module.
Edit (>2.24.1 version):
https://codesandbox.io/s/simple-keyboard-layouts-demo-npm-4s4uv
Hope that helps!
Regards,
Francisco Hodge
from simple-keyboard.
from simple-keyboard.
Hello @tehChromic,
Thanks! Mappings in shift seem to be working. You basically have to hold down shift then press the desired button. The example is a bit barebones and quickly put together though, so it won't cover all bases (e.g.: There will be bugs). I hope however that you can take that and turn it into how you want it to work.
Regards,
Francisco Hodge
from simple-keyboard.
from simple-keyboard.
Indeed this releasing shift behavior would need to be made custom. This and some other custom approaches are explored in this test sandbox.
Regards,
Francisco Hodge
from simple-keyboard.
from simple-keyboard.
That is something that totally flew under my radar, thanks for bringing it up! I'll ship this asap and update this ticket.
Thanks,
Francisco Hodge
from simple-keyboard.
Hey @tehChromic,
The method destroy
is now available as of version 2.22.0:
https://github.com/hodgef/simple-keyboard/releases/tag/2.22.0
Regards,
Francisco Hodge
from simple-keyboard.
from simple-keyboard.
Related Issues (20)
- Prevent showing system keyboard on tablets HOT 3
- Support for mouse element HOT 2
- Japanese Flick Input (Mobile) HOT 3
- excludeFromLayout doesnt work HOT 2
- can i use in vue3? HOT 1
- Keyboard button not showing with tailwind HOT 2
- Not responsive on mobile HOT 1
- CSS partialy Apply HOT 1
- BackSpace Issue HOT 1
- need more layers (right alt) HOT 2
- Button Hold : Allow additional keys via options HOT 6
- `layoutCandidates` is not case sensitive HOT 1
- When simple-keyboard is used with accessibility voice over turned on, hitting q enters 1 in input HOT 1
- Simple-keyboard Not Rendering HOT 2
- When set layoutCandidatesPageSize = 15, There is an issue with the background color of the candidate box
- Not displaying keyboard outside app.component HOT 1
- Virtual Keyboard, keys are coming all white HOT 1
- Can this component be dragged by the mouse motor? HOT 2
- When multiple virtual keyboard instances are used, only one instance can get activeInputElement HOT 1
- Is there any working example for the integration of Japanese keyboard with IME input HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simple-keyboard.