Docs update

This commit is contained in:
Francisco Hodge
2018-11-05 17:31:11 -05:00
parent 221c41933b
commit 4e5d36173d
11 changed files with 58441 additions and 50031 deletions
+27 -12
View File
@@ -215,7 +215,9 @@ class SimpleKeyboard {
if(!this.input[this.options.inputName])
this.input[this.options.inputName] = '';
let updatedInput = this.utilities.getUpdatedInput(button, this.input[this.options.inputName], this.options, this.caretPosition);
let updatedInput = this.utilities.getUpdatedInput(
button, this.input[this.options.inputName], this.options, this.caretPosition
);
if(this.input[this.options.inputName] !== updatedInput){
@@ -226,7 +228,9 @@ class SimpleKeyboard {
return false;
}
this.input[this.options.inputName] = updatedInput;
this.input[this.options.inputName] = this.utilities.getUpdatedInput(
button, this.input[this.options.inputName], this.options, this.caretPosition, true
);
if(debug)
console.log('Input changed:', this.input);
@@ -301,12 +305,19 @@ class SimpleKeyboard {
*/
/* istanbul ignore next */
handleButtonHold(button){
if(this.holdInteractionTimeout)
clearTimeout(this.holdInteractionTimeout);
/**
* @type {object} Timeout dictating the speed of key hold iterations
*/
this.holdInteractionTimeout = setTimeout(() => {
this.handleButtonClicked(button);
this.handleButtonHold(button);
if(this.isMouseHold){
this.handleButtonClicked(button);
this.handleButtonHold(button);
} else {
clearTimeout(this.holdInteractionTimeout);
}
}, 100);
}
@@ -551,8 +562,9 @@ class SimpleKeyboard {
let targetTagName = event.target.tagName.toLowerCase();
if(
targetTagName === "textarea" ||
targetTagName === "input"
(targetTagName === "textarea" ||
targetTagName === "input") &&
!this.options.disableCaretPositioning
){
/**
* Tracks current cursor position
@@ -726,7 +738,10 @@ class SimpleKeyboard {
*/
var buttonDOM = document.createElement('div');
buttonDOM.className += `hg-button ${fctBtnClass}${buttonThemeClass ? " "+buttonThemeClass : ""}`;
buttonDOM.onclick = () => this.handleButtonClicked(button);
buttonDOM.onclick = () => {
this.isMouseHold = false;
this.handleButtonClicked(button);
}
buttonDOM.onmousedown = (e) => this.handleButtonMouseDown(button, e);
/**
@@ -779,17 +794,17 @@ class SimpleKeyboard {
*/
this.onRender();
/**
* Handling mouseup
*/
document.onmouseup = () => this.handleButtonMouseUp();
if(!this.initialized){
/**
* Ensures that onInit is only called once per instantiation
*/
this.initialized = true;
/**
* Handling mouseup
*/
document.onmouseup = () => this.handleButtonMouseUp();
/**
* Calling onInit
*/