Fix buttonHold issue

This commit is contained in:
Francisco Hodge 2018-11-19 09:29:49 -05:00
parent 366f4cd98e
commit d38433be1c

View File

@ -519,6 +519,10 @@ class SimpleKeyboard {
caretEventHandler(event){ caretEventHandler(event){
let targetTagName; let targetTagName;
if(this.isMouseHold){
this.isMouseHold = false;
}
if(event.target.tagName){ if(event.target.tagName){
targetTagName = event.target.tagName.toLowerCase(); targetTagName = event.target.tagName.toLowerCase();
} }
@ -767,6 +771,12 @@ class SimpleKeyboard {
*/ */
this.onRender(); this.onRender();
if(!this.initialized){
/**
* Ensures that onInit is only called once per instantiation
*/
this.initialized = true;
/** /**
* Handling mouseup * Handling mouseup
*/ */
@ -774,12 +784,6 @@ class SimpleKeyboard {
document.onmouseup = () => this.handleButtonMouseUp(); document.onmouseup = () => this.handleButtonMouseUp();
} }
if(!this.initialized){
/**
* Ensures that onInit is only called once per instantiation
*/
this.initialized = true;
/** /**
* Calling onInit * Calling onInit
*/ */