|  |  |  | @ -20,11 +20,13 @@ const KeyScaner = /** @class */ (function () { | 
			
		
	
		
			
				
					|  |  |  |  |     this.dom = _dom; | 
			
		
	
		
			
				
					|  |  |  |  |     _dom.addEventListener('keydown', this.onKeyDown.bind(this)); | 
			
		
	
		
			
				
					|  |  |  |  |     _dom.addEventListener('keyup', this.onKeyUp.bind(this)); | 
			
		
	
		
			
				
					|  |  |  |  |     _dom.addEventListener('keypress', this.onKeyPress.bind(this)); | 
			
		
	
		
			
				
					|  |  |  |  |     this.interval = setInterval(this.onTick.bind(this), 100); | 
			
		
	
		
			
				
					|  |  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   KeyScaner.prototype.appendChar = function (c) { | 
			
		
	
		
			
				
					|  |  |  |  |     this.keybufs.push(c); | 
			
		
	
		
			
				
					|  |  |  |  |     // console.log('appendChar:', c, this.keybufs)
 | 
			
		
	
		
			
				
					|  |  |  |  |   }; | 
			
		
	
		
			
				
					|  |  |  |  |   KeyScaner.prototype.onKeyDown = function (ev) { | 
			
		
	
		
			
				
					|  |  |  |  |     this.lastTime = new Date().getTime(); | 
			
		
	
	
		
			
				
					|  |  |  | @ -73,7 +75,14 @@ const KeyScaner = /** @class */ (function () { | 
			
		
	
		
			
				
					|  |  |  |  |   }; | 
			
		
	
		
			
				
					|  |  |  |  |   KeyScaner.prototype.onKeyUp = function (ev) { | 
			
		
	
		
			
				
					|  |  |  |  |     this.lastTime = new Date().getTime(); | 
			
		
	
		
			
				
					|  |  |  |  |         if (ev.key == "Alt") { | 
			
		
	
		
			
				
					|  |  |  |  |     if (ev.charCode === 29) { | 
			
		
	
		
			
				
					|  |  |  |  |       var str = this.altBuf.join(""); | 
			
		
	
		
			
				
					|  |  |  |  |       var num = parseInt(str); | 
			
		
	
		
			
				
					|  |  |  |  |       var c = String.fromCharCode(num); | 
			
		
	
		
			
				
					|  |  |  |  |       this.appendChar(c); | 
			
		
	
		
			
				
					|  |  |  |  |       this.altBuf = []; | 
			
		
	
		
			
				
					|  |  |  |  |       console.log('onKeyUp success:', ev.charCode, this.keybufs); | 
			
		
	
		
			
				
					|  |  |  |  |     } else if (ev.key == "Alt") { | 
			
		
	
		
			
				
					|  |  |  |  |       if (this.altBuf && this.altBuf.length > 0) { | 
			
		
	
		
			
				
					|  |  |  |  |         var str = this.altBuf.join(""); | 
			
		
	
		
			
				
					|  |  |  |  |         var num = parseInt(str); | 
			
		
	
	
		
			
				
					|  |  |  | @ -85,6 +94,27 @@ const KeyScaner = /** @class */ (function () { | 
			
		
	
		
			
				
					|  |  |  |  |       this.isShift = false; | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  |   }; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   KeyScaner.prototype.onKeyPress = function (ev) { | 
			
		
	
		
			
				
					|  |  |  |  |     this.lastTime = new Date().getTime(); | 
			
		
	
		
			
				
					|  |  |  |  |     const char = String.fromCharCode(ev.charCode); | 
			
		
	
		
			
				
					|  |  |  |  |     console.log('KeyPress:', ev.charCode, char); | 
			
		
	
		
			
				
					|  |  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |  |      *   if (ev.charCode === 29) { | 
			
		
	
		
			
				
					|  |  |  |  |       this.appendChar(char); | 
			
		
	
		
			
				
					|  |  |  |  |       // console.log('KeyPress success:', ev.charCode, this.keybufs);
 | 
			
		
	
		
			
				
					|  |  |  |  |     } else | 
			
		
	
		
			
				
					|  |  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |  |     if (char == '\n') { | 
			
		
	
		
			
				
					|  |  |  |  |       this.completeInput(); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     // if (ev.charCode === 49) {
 | 
			
		
	
		
			
				
					|  |  |  |  |     //   const char = String.fromCharCode(ev.charCode);
 | 
			
		
	
		
			
				
					|  |  |  |  |     //   this.appendChar(char);
 | 
			
		
	
		
			
				
					|  |  |  |  |     // }
 | 
			
		
	
		
			
				
					|  |  |  |  |   }; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   KeyScaner.prototype.completeInput = function () { | 
			
		
	
		
			
				
					|  |  |  |  |     var text = this.keybufs.join(""); | 
			
		
	
		
			
				
					|  |  |  |  |     this.keybufs = []; | 
			
		
	
	
		
			
				
					|  |  |  | @ -104,6 +134,7 @@ const KeyScaner = /** @class */ (function () { | 
			
		
	
		
			
				
					|  |  |  |  |   KeyScaner.prototype.dispose = function () { | 
			
		
	
		
			
				
					|  |  |  |  |     this.dom.removeEventListener('keydown', this.onKeyDown); | 
			
		
	
		
			
				
					|  |  |  |  |     this.dom.removeEventListener('keyup', this.onKeyUp); | 
			
		
	
		
			
				
					|  |  |  |  |     this.dom.removeEventListener('keypress', this.onKeyPress); | 
			
		
	
		
			
				
					|  |  |  |  |     clearInterval(this.interval); | 
			
		
	
		
			
				
					|  |  |  |  |   }; | 
			
		
	
		
			
				
					|  |  |  |  |   return KeyScaner; | 
			
		
	
	
		
			
				
					|  |  |  | 
 |