mirror of
https://github.com/hodgef/simple-keyboard.git
synced 2025-03-16 08:21:07 +08:00
Fix full keyboard numpad cursor positioning
This commit is contained in:
parent
2693030203
commit
0512e2c624
@ -151,7 +151,7 @@ class Utilities {
|
|||||||
output = this.addStringAt(output, "\n", caretPos, moveCaret);
|
output = this.addStringAt(output, "\n", caretPos, moveCaret);
|
||||||
|
|
||||||
else if(button.includes("numpad") && Number.isInteger(Number(button[button.length - 2]))){
|
else if(button.includes("numpad") && Number.isInteger(Number(button[button.length - 2]))){
|
||||||
output = this.addStringAt(output, button[button.length - 2], caretPos);
|
output = this.addStringAt(output, button[button.length - 2], caretPos, moveCaret);
|
||||||
}
|
}
|
||||||
else if(button === "{numpaddivide}")
|
else if(button === "{numpaddivide}")
|
||||||
output = this.addStringAt(output, '/', caretPos, moveCaret);
|
output = this.addStringAt(output, '/', caretPos, moveCaret);
|
||||||
@ -184,12 +184,12 @@ class Utilities {
|
|||||||
* @param {boolean} minus Whether the cursor should be moved to the left or not.
|
* @param {boolean} minus Whether the cursor should be moved to the left or not.
|
||||||
*/
|
*/
|
||||||
updateCaretPos(length, minus){
|
updateCaretPos(length, minus){
|
||||||
|
let newCaretPos = this.updateCaretPosAction(this.simpleKeyboardInstance, length, minus);
|
||||||
|
|
||||||
if(this.simpleKeyboardInstance.options.syncInstanceInputs){
|
if(this.simpleKeyboardInstance.options.syncInstanceInputs){
|
||||||
this.simpleKeyboardInstance.dispatch(instance => {
|
this.simpleKeyboardInstance.dispatch(instance => {
|
||||||
this.updateCaretPosAction(instance, length, minus);
|
instance.caretPosition = newCaretPos;
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
this.updateCaretPosAction(this.simpleKeyboardInstance, length, minus);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,6 +211,8 @@ class Utilities {
|
|||||||
if(this.simpleKeyboardInstance.options.debug){
|
if(this.simpleKeyboardInstance.options.debug){
|
||||||
console.log("Caret at:", instance.caretPosition, `(${instance.keyboardDOMClass})`);
|
console.log("Caret at:", instance.caretPosition, `(${instance.keyboardDOMClass})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return instance.caretPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user