mirror of
https://github.com/hodgef/simple-keyboard.git
synced 2025-02-01 02:53:07 +08:00
Add physicalKeyboardHighlightPressUsePointerEvents. Fixes #1506
This commit is contained in:
parent
d7427c63d6
commit
7834087992
@ -107,6 +107,8 @@ class SimpleKeyboard {
|
||||
* @property {boolean} physicalKeyboardHighlightPress Presses keys highlighted by physicalKeyboardHighlight
|
||||
* @property {string} physicalKeyboardHighlightTextColor Define the text color that the physical keyboard highlighted key should have.
|
||||
* @property {string} physicalKeyboardHighlightBgColor Define the background color that the physical keyboard highlighted key should have.
|
||||
* @property {boolean} physicalKeyboardHighlightPressUseClick Whether physicalKeyboardHighlightPress should use clicks to trigger buttons.
|
||||
* @property {boolean} physicalKeyboardHighlightPressUsePointerEvents Whether physicalKeyboardHighlightPress should use pointer events to trigger buttons.
|
||||
* @property {boolean} preventMouseDownDefault Calling preventDefault for the mousedown events keeps the focus on the input.
|
||||
* @property {boolean} preventMouseUpDefault Calling preventDefault for the mouseup events.
|
||||
* @property {boolean} stopMouseDownPropagation Stops pointer down events on simple-keyboard buttons from bubbling to parent elements.
|
||||
|
@ -145,6 +145,11 @@ export interface KeyboardOptions {
|
||||
*/
|
||||
physicalKeyboardHighlightPressUseClick?: boolean;
|
||||
|
||||
/**
|
||||
* Whether physicalKeyboardHighlightPress should use pointer events to trigger buttons.
|
||||
*/
|
||||
physicalKeyboardHighlightPressUsePointerEvents?: boolean;
|
||||
|
||||
/**
|
||||
* Define the text color that the physical keyboard highlighted key should have.
|
||||
*/
|
||||
|
@ -53,7 +53,10 @@ class PhysicalKeyboard {
|
||||
options.physicalKeyboardHighlightTextColor || "black";
|
||||
|
||||
if (options.physicalKeyboardHighlightPress) {
|
||||
if (options.physicalKeyboardHighlightPressUseClick) {
|
||||
if (options.physicalKeyboardHighlightPressUsePointerEvents) {
|
||||
buttonDOM.onpointerdown();
|
||||
buttonDOM.onpointerup();
|
||||
} else if (options.physicalKeyboardHighlightPressUseClick) {
|
||||
buttonDOM.click();
|
||||
} else {
|
||||
instance.handleButtonClicked(buttonName, event);
|
||||
|
Loading…
Reference in New Issue
Block a user