How to use indexPos method in fast-check-monorepo

Best JavaScript code snippet using fast-check-monorepo

augr-keyboard-tracker-fast.js

Source:augr-keyboard-tracker-fast.js Github

copy

Full Screen

1var colors = [0xff0000, 0x00ff00, 0x0000ff];2var baseBoneRotation = (new THREE.Quaternion).setFromEuler(new THREE.Euler(Math.PI / 2, 0, 0));3var sessionManager = {4 connection: null,5 hand: {6 position: null,7 fistClosed: false,8 lastMove : "hover",9 lastMoveCounter: 3000,10 lastPosition: null,11 inGrasp: []12 },13 pressed: null,14 statusShown: false,15 screenCount: 1,16 outputTextStream: [],17 outputDisplayContainerVisible: true18};19var objectManager = {20 "letter-q-container": {21 type: "a-entity:a-plane",22 id: "letter-q-container",23 position: "-1 0.5 -3",24 posArray: [25 0,26 0.5,27 -328 ],29 marginArray: [30 -30,31 30,32 30,33 130,34 -100,35 5036 ],37 rotation: "0 0 0",38 color: "gray",39 hoverColor: "#FF0000",40 hovering: false,41 touchColor: "#FF0000",42 touching: false43 },44 "letter-w-container": {45 type: "a-entity:a-plane",46 id: "letter-w-container",47 position: "-1 0.5 -3",48 posArray: [49 0,50 0.5,51 -352 ],53 marginArray: [54 -30,55 30,56 30,57 130,58 -100,59 5060 ],61 rotation: "0 0 0",62 color: "gray",63 hoverColor: "#FF0000",64 hovering: false,65 touchColor: "#FF0000",66 touching: false67 },68 "letter-e-container": {69 type: "a-entity:a-plane",70 id: "letter-e-container",71 position: "-1 0.5 -3",72 posArray: [73 0,74 0.5,75 -376 ],77 marginArray: [78 -30,79 30,80 30,81 130,82 -100,83 5084 ],85 rotation: "0 0 0",86 color: "gray",87 hoverColor: "#FF0000",88 hovering: false,89 touchColor: "#FF0000",90 touching: false91 },92 "letter-r-container": {93 type: "a-entity:a-plane",94 id: "letter-r-container",95 position: "-1 0.5 -3",96 posArray: [97 0,98 0.5,99 -3100 ],101 marginArray: [102 -30,103 30,104 30,105 130,106 -100,107 50108 ],109 rotation: "0 0 0",110 color: "gray",111 hoverColor: "#FF0000",112 hovering: false,113 touchColor: "#FF0000",114 touching: false115 },116 "letter-t-container": {117 type: "a-entity:a-plane",118 id: "letter-t-container",119 position: "-1 0.5 -3",120 posArray: [121 0,122 0.5,123 -3124 ],125 marginArray: [126 -30,127 30,128 30,129 130,130 -100,131 50132 ],133 rotation: "0 0 0",134 color: "gray",135 hoverColor: "#FF0000",136 hovering: false,137 touchColor: "#FF0000",138 touching: false139 },140 "letter-y-container": {141 type: "a-entity:a-plane",142 id: "letter-q-container",143 position: "-1 0.5 -3",144 posArray: [145 0,146 0.5,147 -3148 ],149 marginArray: [150 -30,151 30,152 30,153 130,154 -100,155 50156 ],157 rotation: "0 0 0",158 color: "gray",159 hoverColor: "#FF0000",160 hovering: false,161 touchColor: "#FF0000",162 touching: false163 },164 "letter-u-container": {165 type: "a-entity:a-plane",166 id: "letter-q-container",167 position: "-1 0.5 -3",168 posArray: [169 0,170 0.5,171 -3172 ],173 marginArray: [174 -30,175 30,176 30,177 130,178 -100,179 50180 ],181 rotation: "0 0 0",182 color: "gray",183 hoverColor: "#FF0000",184 hovering: false,185 touchColor: "#FF0000",186 touching: false187 },188 "letter-i-container": {189 type: "a-entity:a-plane",190 id: "letter-q-container",191 position: "-1 0.5 -3",192 posArray: [193 0,194 0.5,195 -3196 ],197 marginArray: [198 -30,199 30,200 30,201 130,202 -100,203 50204 ],205 rotation: "0 0 0",206 color: "gray",207 hoverColor: "#FF0000",208 hovering: false,209 touchColor: "#FF0000",210 touching: false211 },212 "letter-o-container": {213 type: "a-entity:a-plane",214 id: "letter-q-container",215 position: "-1 0.5 -3",216 posArray: [217 0,218 0.5,219 -3220 ],221 marginArray: [222 -30,223 30,224 30,225 130,226 -100,227 50228 ],229 rotation: "0 0 0",230 color: "gray",231 hoverColor: "#FF0000",232 hovering: false,233 touchColor: "#FF0000",234 touching: false235 },236 "letter-p-container": {237 type: "a-entity:a-plane",238 id: "letter-q-container",239 position: "-1 0.5 -3",240 posArray: [241 0,242 0.5,243 -3244 ],245 marginArray: [246 -30,247 30,248 30,249 130,250 -100,251 50252 ],253 rotation: "0 0 0",254 color: "gray",255 hoverColor: "#FF0000",256 hovering: false,257 touchColor: "#FF0000",258 touching: false259 },260 "letter-a-container": {261 type: "a-entity:a-plane",262 id: "letter-q-container",263 position: "-1 0.5 -3",264 posArray: [265 0,266 0.5,267 -3268 ],269 marginArray: [270 -30,271 30,272 30,273 130,274 -100,275 50276 ],277 rotation: "0 0 0",278 color: "gray",279 hoverColor: "#FF0000",280 hovering: false,281 touchColor: "#FF0000",282 touching: false283 },284 "letter-s-container": {285 type: "a-entity:a-plane",286 id: "letter-q-container",287 position: "-1 0.5 -3",288 posArray: [289 0,290 0.5,291 -3292 ],293 marginArray: [294 -30,295 30,296 30,297 130,298 -100,299 50300 ],301 rotation: "0 0 0",302 color: "gray",303 hoverColor: "#FF0000",304 hovering: false,305 touchColor: "#FF0000",306 touching: false307 },308 "letter-d-container": {309 type: "a-entity:a-plane",310 id: "letter-q-container",311 position: "-1 0.5 -3",312 posArray: [313 0,314 0.5,315 -3316 ],317 marginArray: [318 -30,319 30,320 30,321 130,322 -100,323 50324 ],325 rotation: "0 0 0",326 color: "gray",327 hoverColor: "#FF0000",328 hovering: false,329 touchColor: "#FF0000",330 touching: false331 },332 "letter-f-container": {333 type: "a-entity:a-plane",334 id: "letter-q-container",335 position: "-1 0.5 -3",336 posArray: [337 0,338 0.5,339 -3340 ],341 marginArray: [342 -30,343 30,344 30,345 130,346 -100,347 50348 ],349 rotation: "0 0 0",350 color: "gray",351 hoverColor: "#FF0000",352 hovering: false,353 touchColor: "#FF0000",354 touching: false355 },356 "letter-g-container": {357 type: "a-entity:a-plane",358 id: "letter-q-container",359 position: "-1 0.5 -3",360 posArray: [361 0,362 0.5,363 -3364 ],365 marginArray: [366 -30,367 30,368 30,369 130,370 -100,371 50372 ],373 rotation: "0 0 0",374 color: "gray",375 hoverColor: "#FF0000",376 hovering: false,377 touchColor: "#FF0000",378 touching: false379 },380 "letter-h-container": {381 type: "a-entity:a-plane",382 id: "letter-q-container",383 position: "-1 0.5 -3",384 posArray: [385 0,386 0.5,387 -3388 ],389 marginArray: [390 -30,391 30,392 30,393 130,394 -100,395 50396 ],397 rotation: "0 0 0",398 color: "gray",399 hoverColor: "#FF0000",400 hovering: false,401 touchColor: "#FF0000",402 touching: false403 },404 "letter-j-container": {405 type: "a-entity:a-plane",406 id: "letter-q-container",407 position: "-1 0.5 -3",408 posArray: [409 0,410 0.5,411 -3412 ],413 marginArray: [414 -30,415 30,416 30,417 130,418 -100,419 50420 ],421 rotation: "0 0 0",422 color: "gray",423 hoverColor: "#FF0000",424 hovering: false,425 touchColor: "#FF0000",426 touching: false427 },428 "letter-k-container": {429 type: "a-entity:a-plane",430 id: "letter-q-container",431 position: "-1 0.5 -3",432 posArray: [433 0,434 0.5,435 -3436 ],437 marginArray: [438 -30,439 30,440 30,441 130,442 -100,443 50444 ],445 rotation: "0 0 0",446 color: "gray",447 hoverColor: "#FF0000",448 hovering: false,449 touchColor: "#FF0000",450 touching: false451 },452 "letter-l-container": {453 type: "a-entity:a-plane",454 id: "letter-q-container",455 position: "-1 0.5 -3",456 posArray: [457 0,458 0.5,459 -3460 ],461 marginArray: [462 -30,463 30,464 30,465 130,466 -100,467 50468 ],469 rotation: "0 0 0",470 color: "gray",471 hoverColor: "#FF0000",472 hovering: false,473 touchColor: "#FF0000",474 touching: false475 },476 "letter-z-container": {477 type: "a-entity:a-plane",478 id: "letter-q-container",479 position: "-1 0.5 -3",480 posArray: [481 0,482 0.5,483 -3484 ],485 marginArray: [486 -30,487 30,488 30,489 130,490 -100,491 50492 ],493 rotation: "0 0 0",494 color: "gray",495 hoverColor: "#FF0000",496 hovering: false,497 touchColor: "#FF0000",498 touching: false499 },500 "letter-x-container": {501 type: "a-entity:a-plane",502 id: "letter-q-container",503 position: "-1 0.5 -3",504 posArray: [505 0,506 0.5,507 -3508 ],509 marginArray: [510 -30,511 30,512 30,513 130,514 -100,515 50516 ],517 rotation: "0 0 0",518 color: "gray",519 hoverColor: "#FF0000",520 hovering: false,521 touchColor: "#FF0000",522 touching: false523 },524 "letter-c-container": {525 type: "a-entity:a-plane",526 id: "letter-q-container",527 position: "-1 0.5 -3",528 posArray: [529 0,530 0.5,531 -3532 ],533 marginArray: [534 -30,535 30,536 30,537 130,538 -100,539 50540 ],541 rotation: "0 0 0",542 color: "gray",543 hoverColor: "#FF0000",544 hovering: false,545 touchColor: "#FF0000",546 touching: false547 },548 "letter-v-container": {549 type: "a-entity:a-plane",550 id: "letter-q-container",551 position: "-1 0.5 -3",552 posArray: [553 0,554 0.5,555 -3556 ],557 marginArray: [558 -30,559 30,560 30,561 130,562 -100,563 50564 ],565 rotation: "0 0 0",566 color: "gray",567 hoverColor: "#FF0000",568 hovering: false,569 touchColor: "#FF0000",570 touching: false571 },572 "letter-b-container": {573 type: "a-entity:a-plane",574 id: "letter-q-container",575 position: "-1 0.5 -3",576 posArray: [577 0,578 0.5,579 -3580 ],581 marginArray: [582 -30,583 30,584 30,585 130,586 -100,587 50588 ],589 rotation: "0 0 0",590 color: "gray",591 hoverColor: "#FF0000",592 hovering: false,593 touchColor: "#FF0000",594 touching: false595 },596 "letter-n-container": {597 type: "a-entity:a-plane",598 id: "letter-q-container",599 position: "-1 0.5 -3",600 posArray: [601 0,602 0.5,603 -3604 ],605 marginArray: [606 -30,607 30,608 30,609 130,610 -100,611 50612 ],613 rotation: "0 0 0",614 color: "gray",615 hoverColor: "#FF0000",616 hovering: false,617 touchColor: "#FF0000",618 touching: false619 },620 "letter-m-container": {621 type: "a-entity:a-plane",622 id: "letter-q-container",623 position: "-1 0.5 -3",624 posArray: [625 0,626 0.5,627 -3628 ],629 marginArray: [630 -30,631 30,632 30,633 130,634 -100,635 50636 ],637 rotation: "0 0 0",638 color: "gray",639 hoverColor: "#FF0000",640 hovering: false,641 touchColor: "#FF0000",642 touching: false643 },644 "punctuation-container": {645 type: "a-entity:a-plane",646 id: "letter-q-container",647 position: "-1 0.5 -3",648 posArray: [649 0,650 0.5,651 -3652 ],653 marginArray: [654 -30,655 30,656 30,657 130,658 -100,659 50660 ],661 rotation: "0 0 0",662 color: "gray",663 hoverColor: "#FF0000",664 hovering: false,665 touchColor: "#FF0000",666 touching: false667 },668 "punctuation-container": {669 type: "a-entity:a-plane",670 id: "letter-q-container",671 position: "-1 0.5 -3",672 posArray: [673 0,674 0.5,675 -3676 ],677 marginArray: [678 -30,679 30,680 30,681 130,682 -100,683 50684 ],685 rotation: "0 0 0",686 color: "gray",687 hoverColor: "#FF0000",688 hovering: false,689 touchColor: "#FF0000",690 touching: false691 },692 "punctuation-container": {693 type: "a-entity:a-plane",694 id: "letter-q-container",695 position: "-1 0.5 -3",696 posArray: [697 0,698 0.5,699 -3700 ],701 marginArray: [702 -30,703 30,704 30,705 130,706 -100,707 50708 ],709 rotation: "0 0 0",710 color: "gray",711 hoverColor: "#FF0000",712 hovering: false,713 touchColor: "#FF0000",714 touching: false715 },716 "punctuation-container": {717 type: "a-entity:a-plane",718 id: "letter-q-container",719 position: "-1 0.5 -3",720 posArray: [721 0,722 0.5,723 -3724 ],725 marginArray: [726 -30,727 30,728 30,729 130,730 -100,731 50732 ],733 rotation: "0 0 0",734 color: "gray",735 hoverColor: "#FF0000",736 hovering: false,737 touchColor: "#FF0000",738 touching: false739 },740 "symbol-container": {741 type: "a-entity:a-plane",742 id: "letter-q-container",743 position: "-1 0.5 -3",744 posArray: [745 0,746 0.5,747 -3748 ],749 marginArray: [750 -30,751 30,752 30,753 130,754 -100,755 50756 ],757 rotation: "0 0 0",758 color: "gray",759 hoverColor: "#FF0000",760 hovering: false,761 touchColor: "#FF0000",762 touching: false763 },764 "symbol-container": {765 type: "a-entity:a-plane",766 id: "letter-q-container",767 position: "-1 0.5 -3",768 posArray: [769 0,770 0.5,771 -3772 ],773 marginArray: [774 -30,775 30,776 30,777 130,778 -100,779 50780 ],781 rotation: "0 0 0",782 color: "gray",783 hoverColor: "#FF0000",784 hovering: false,785 touchColor: "#FF0000",786 touching: false787 }788};789// all units in mm790var initScene = function () {791 window.scene = new THREE.Scene();792 window.renderer = new THREE.WebGLRenderer({793 alpha: true794 });795 window.renderer.setClearColor(0x000000, 0);796 window.renderer.setSize(window.innerWidth, window.innerHeight);797 window.renderer.domElement.style.position = 'absolute';798 window.renderer.domElement.style.zIndex = '100';799 window.renderer.domElement.style.top = 0;800 window.renderer.domElement.style.left = 0;801 window.renderer.domElement.style.width = '100%';802 window.renderer.domElement.style.height = '100%';803 document.body.appendChild(window.renderer.domElement);804 var directionalLight = new THREE.DirectionalLight( 0xffffff, 1 );805 directionalLight.position.set( 0, 0.5, 1 );806 window.scene.add(directionalLight);807 window.camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000);808 window.camera.position.fromArray([0, 100, 500]);809 window.camera.lookAt(new THREE.Vector3(0, 160, 0));810 window.addEventListener('resize', function () {811 camera.aspect = window.innerWidth / window.innerHeight;812 camera.updateProjectionMatrix();813 renderer.setSize(window.innerWidth, window.innerHeight);814 renderer.render(scene, camera);815 }, false);816 scene.add(camera);817 renderer.render(scene, camera);818 setTimeout(function(){819 var viewerTracker = [820 document.getElementById("webcam-0-container"),821 ];822 }, 150);823};824Leap.loop({background: true}, {825 hand: function (hand) {826 hand.fingers.forEach(function (finger) {827 // This is the meat of the example - Positioning `the cylinders on every frame:828 finger.data('boneMeshes').forEach(function(mesh, i){829 var bone = finger.bones[i];830 mesh.position.fromArray(bone.center());831 mesh.setRotationFromMatrix(832 (new THREE.Matrix4).fromArray( bone.matrix() )833 );834 mesh.quaternion.multiply(baseBoneRotation);835 });836 finger.data('jointMeshes').forEach(function(mesh, i){837 var bone = finger.bones[i];838 if (bone) {839 mesh.position.fromArray(bone.prevJoint);840 }841 else{842 // special case for the finger tip joint sphere:843 bone = finger.bones[i-1];844 mesh.position.fromArray(bone.nextJoint);845 }846 });847 });848 sessionManager.hand.position = hand.palmPosition;849 // range test850 if(sessionManager.hand.lastPosition==null){851 sessionManager.hand.lastPosition = [];852 sessionManager.hand.lastPosition.push(sessionManager.hand.position[0]);853 sessionManager.hand.lastPosition.push(sessionManager.hand.position[1]);854 sessionManager.hand.lastPosition.push(sessionManager.hand.position[2]);855 }856 let obj = objectManager;857 if(sessionManager.pressed==null){858 sessionManager.pressed = [];859 sessionManager.pressCount == -1;860 }861 if(hand.indexFinger.extended){862 let indexPos = hand.indexFinger.distal.center();863 if(indexPos[0]>120&&indexPos[0]<155&&indexPos[1]>195&&indexPos[1]<220){864 //console.log("delete");865 sessionManager.pressed.push("delete", sessionManager.pressCount);866 if(sessionManager.pressed.indexOf("delete")>-1){867 document.getElementById("system-delete-container").setAttribute("material", "color", "white");868 document.getElementById("system-delete-container").setAttribute("text", "color", "black");869 console.log("holding down delete");870 if(sessionManager.pressCount==null){871 sessionManager.pressCount = -1;872 }873 else if(sessionManager.pressCount >= -1){874 sessionManager.pressCount++;875 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){ /* approximately 25 cycles per 1000 ms */876 console.log("pressed delete");877 document.getElementById("system-delete-container").setAttribute("material", "color", "red");878 document.getElementById("system-delete-container").setAttribute("text", "color", "white");879 if(sessionManager.pressCount==16){880 if(sessionManager.outputTextStream.length>0){881 sessionManager.outputTextStream.pop();882 }883 let textStream = ""884 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){885 (function(){886 textStream+=sessionManager.outputTextStream[streamSize];887 })();888 }889 document.getElementById("output-display-container").setAttribute("text", "value", textStream);890 }891 }892 if(sessionManager.pressCount>45){893 console.log("long pressed P");894 document.getElementById("letter-p-container").setAttribute("material", "color", "orange");895 document.getElementById("letter-p-container").setAttribute("text", "color", "black");896 }897 }898 }899 }900 else if(indexPos[0]>95&&indexPos[0]<115&&indexPos[1]>195&&indexPos[1]<220){901 //console.log("P");902 sessionManager.pressed.push("P", sessionManager.pressCount);903 if(sessionManager.pressed.indexOf("P")>-1){904 document.getElementById("letter-p-container").setAttribute("material", "color", "white");905 document.getElementById("letter-p-container").setAttribute("text", "color", "black");906 console.log("holding down P");907 if(sessionManager.pressCount==null){908 sessionManager.pressCount = -1;909 }910 else if(sessionManager.pressCount >= -1){911 sessionManager.pressCount++;912 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){ /* approximately 25 cycles per 1000 ms */913 console.log("pressed P");914 document.getElementById("letter-p-container").setAttribute("material", "color", "red");915 document.getElementById("letter-p-container").setAttribute("text", "color", "white");916 if(sessionManager.pressCount==16){917 sessionManager.outputTextStream.push("P");918 let textStream = ""919 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){920 (function(){921 textStream+=sessionManager.outputTextStream[streamSize];922 })();923 }924 document.getElementById("output-display-container").setAttribute("text", "value", textStream);925 }926 }927 if(sessionManager.pressCount>45){928 console.log("long pressed P");929 document.getElementById("letter-p-container").setAttribute("material", "color", "orange");930 document.getElementById("letter-p-container").setAttribute("text", "color", "black");931 }932 }933 }934 }935 else if(indexPos[0]>65&&indexPos[0]<90&&indexPos[1]>190&&indexPos[1]<220){936 //console.log("O");937 sessionManager.pressed.push("O");938 if(sessionManager.pressed.indexOf("O")>-1){939 document.getElementById("letter-o-container").setAttribute("material", "color", "white");940 document.getElementById("letter-o-container").setAttribute("text", "color", "black");941 console.log("holding down O");942 if(sessionManager.pressCount==null){943 sessionManager.pressCount = -1;944 }945 else if(sessionManager.pressCount >= -1){946 sessionManager.pressCount++;947 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){948 console.log("pressed O");949 document.getElementById("letter-o-container").setAttribute("material", "color", "red");950 document.getElementById("letter-o-container").setAttribute("text", "color", "white");951 if(sessionManager.pressCount==16){952 sessionManager.outputTextStream.push("O");953 let textStream = ""954 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){955 (function(){956 textStream+=sessionManager.outputTextStream[streamSize];957 })();958 }959 document.getElementById("output-display-container").setAttribute("text", "value", textStream);960 }961 }962 if(sessionManager.pressCount>45){963 console.log("long pressed O");964 document.getElementById("letter-o-container").setAttribute("material", "color", "orange");965 document.getElementById("letter-o-container").setAttribute("text", "color", "black");966 }967 }968 }969 }970 else if(indexPos[0]>40&&indexPos[0]<60&&indexPos[1]>190&&indexPos[1]<220){971 //console.log("I");972 sessionManager.pressed.push("I");973 if(sessionManager.pressed.indexOf("I")>-1){974 document.getElementById("letter-i-container").setAttribute("material", "color", "white");975 document.getElementById("letter-i-container").setAttribute("text", "color", "black");976 console.log("holding down I");977 if(sessionManager.pressCount==null){978 sessionManager.pressCount = -1;979 }980 else if(sessionManager.pressCount >= -1){981 sessionManager.pressCount++;982 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){983 console.log("pressed I");984 document.getElementById("letter-i-container").setAttribute("material", "color", "red");985 document.getElementById("letter-i-container").setAttribute("text", "color", "white");986 if(sessionManager.pressCount==16){987 sessionManager.outputTextStream.push("I");988 let textStream = ""989 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){990 (function(){991 textStream+=sessionManager.outputTextStream[streamSize];992 })();993 }994 document.getElementById("output-display-container").setAttribute("text", "value", textStream);995 }996 }997 if(sessionManager.pressCount>45){998 console.log("long pressed I");999 document.getElementById("letter-i-container").setAttribute("material", "color", "orange");1000 document.getElementById("letter-i-container").setAttribute("text", "color", "black");1001 }1002 }1003 }1004 }1005 else if(indexPos[0]>15&&indexPos[0]<35&&indexPos[1]>190&&indexPos[1]<220){1006 // console.log("U");1007 sessionManager.pressed.push("U");1008 if(sessionManager.pressed.indexOf("U")>-1){1009 document.getElementById("letter-u-container").setAttribute("material", "color", "white");1010 document.getElementById("letter-u-container").setAttribute("text", "color", "black");1011 console.log("holding down U");1012 if(sessionManager.pressCount==null){1013 sessionManager.pressCount = -1;1014 }1015 else if(sessionManager.pressCount >= -1){1016 sessionManager.pressCount++;1017 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1018 console.log("pressed U");1019 document.getElementById("letter-u-container").setAttribute("material", "color", "red");1020 document.getElementById("letter-u-container").setAttribute("text", "color", "white");1021 if(sessionManager.pressCount==16){1022 sessionManager.outputTextStream.push("U");1023 let textStream = ""1024 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1025 (function(){1026 textStream+=sessionManager.outputTextStream[streamSize];1027 })();1028 }1029 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1030 }1031 }1032 if(sessionManager.pressCount>45){1033 console.log("long pressed U");1034 document.getElementById("letter-u-container").setAttribute("material", "color", "orange");1035 document.getElementById("letter-u-container").setAttribute("text", "color", "black");1036 }1037 }1038 }1039 }1040 else if(indexPos[0]>-12&&indexPos[0]<10&&indexPos[1]>190&&indexPos[1]<220){1041 // console.log("Y");1042 sessionManager.pressed.push("Y");1043 if(sessionManager.pressed.indexOf("Y")>-1){1044 document.getElementById("letter-y-container").setAttribute("material", "color", "white");1045 document.getElementById("letter-y-container").setAttribute("text", "color", "black");1046 console.log("holding down Y");1047 if(sessionManager.pressCount==null){1048 sessionManager.pressCount = -1;1049 }1050 else if(sessionManager.pressCount >= -1){1051 sessionManager.pressCount++;1052 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1053 console.log("pressed Y");1054 document.getElementById("letter-y-container").setAttribute("material", "color", "red");1055 document.getElementById("letter-y-container").setAttribute("text", "color", "white");1056 if(sessionManager.pressCount==16){1057 sessionManager.outputTextStream.push("Y");1058 let textStream = ""1059 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1060 (function(){1061 textStream+=sessionManager.outputTextStream[streamSize];1062 })();1063 }1064 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1065 }1066 }1067 if(sessionManager.pressCount>45){1068 console.log("long pressed Y");1069 document.getElementById("letter-y-container").setAttribute("material", "color", "orange");1070 document.getElementById("letter-y-container").setAttribute("text", "color", "black");1071 }1072 }1073 }1074 }1075 else if(indexPos[0]>-43&&indexPos[0]<-17&&indexPos[1]>190&&indexPos[1]<220){1076 // console.log("T");1077 sessionManager.pressed.push("T");1078 if(sessionManager.pressed.indexOf("T")>-1){1079 document.getElementById("letter-t-container").setAttribute("material", "color", "white");1080 document.getElementById("letter-t-container").setAttribute("text", "color", "black");1081 console.log("holding down T");1082 if(sessionManager.pressCount==null){1083 sessionManager.pressCount = -1;1084 }1085 else if(sessionManager.pressCount >= -1){1086 sessionManager.pressCount++;1087 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1088 console.log("pressed T");1089 document.getElementById("letter-t-container").setAttribute("material", "color", "red");1090 document.getElementById("letter-t-container").setAttribute("text", "color", "white");1091 if(sessionManager.pressCount==16){1092 sessionManager.outputTextStream.push("T");1093 let textStream = ""1094 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1095 (function(){1096 textStream+=sessionManager.outputTextStream[streamSize];1097 })();1098 }1099 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1100 }1101 }1102 if(sessionManager.pressCount>45){1103 console.log("long pressed T");1104 document.getElementById("letter-t-container").setAttribute("material", "color", "orange");1105 document.getElementById("letter-t-container").setAttribute("text", "color", "black");1106 }1107 }1108 }1109 }1110 else if(indexPos[0]>-70&&indexPos[0]<-48&&indexPos[1]>190&&indexPos[1]<220){1111 // console.log("R");1112 sessionManager.pressed.push("R");1113 if(sessionManager.pressed.indexOf("R")>-1){1114 document.getElementById("letter-r-container").setAttribute("material", "color", "white");1115 document.getElementById("letter-r-container").setAttribute("text", "color", "black");1116 console.log("holding down R");1117 if(sessionManager.pressCount==null){1118 sessionManager.pressCount = -1;1119 }1120 else if(sessionManager.pressCount >= -1){1121 sessionManager.pressCount++;1122 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1123 console.log("pressed R");1124 document.getElementById("letter-r-container").setAttribute("material", "color", "red");1125 document.getElementById("letter-r-container").setAttribute("text", "color", "white");1126 if(sessionManager.pressCount==16){1127 sessionManager.outputTextStream.push("R");1128 let textStream = ""1129 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1130 (function(){1131 textStream+=sessionManager.outputTextStream[streamSize];1132 })();1133 }1134 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1135 }1136 }1137 if(sessionManager.pressCount>45){1138 console.log("long pressed R");1139 document.getElementById("letter-r-container").setAttribute("material", "color", "orange");1140 document.getElementById("letter-r-container").setAttribute("text", "color", "black");1141 }1142 }1143 }1144 }1145 else if(indexPos[0]>-95&&indexPos[0]<-75&&indexPos[1]>190&&indexPos[1]<220){1146 // console.log("E");1147 sessionManager.pressed.push("E");1148 if(sessionManager.pressed.indexOf("E")>-1){1149 document.getElementById("letter-e-container").setAttribute("material", "color", "white");1150 document.getElementById("letter-e-container").setAttribute("text", "color", "black");1151 console.log("holding down E");1152 if(sessionManager.pressCount==null){1153 sessionManager.pressCount = -1;1154 }1155 else if(sessionManager.pressCount >= -1){1156 sessionManager.pressCount++;1157 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1158 console.log("pressed E");1159 document.getElementById("letter-e-container").setAttribute("material", "color", "red");1160 document.getElementById("letter-e-container").setAttribute("text", "color", "white");1161 if(sessionManager.pressCount==16){1162 sessionManager.outputTextStream.push("E");1163 let textStream = ""1164 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1165 (function(){1166 textStream+=sessionManager.outputTextStream[streamSize];1167 })();1168 }1169 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1170 }1171 }1172 if(sessionManager.pressCount>45){1173 console.log("long pressed E");1174 document.getElementById("letter-e-container").setAttribute("material", "color", "orange");1175 document.getElementById("letter-e-container").setAttribute("text", "color", "black");1176 }1177 }1178 }1179 }1180 else if(indexPos[0]>-130&&indexPos[0]<-105&&indexPos[1]>190&&indexPos[1]<220){1181 // console.log("W");1182 sessionManager.pressed.push("W");1183 if(sessionManager.pressed.indexOf("W")>-1){1184 document.getElementById("letter-w-container").setAttribute("material", "color", "white");1185 document.getElementById("letter-w-container").setAttribute("text", "color", "black");1186 console.log("holding down W");1187 if(sessionManager.pressCount==null){1188 sessionManager.pressCount = -1;1189 }1190 else if(sessionManager.pressCount >= -1){1191 sessionManager.pressCount++;1192 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1193 console.log("pressed W");1194 document.getElementById("letter-w-container").setAttribute("material", "color", "red");1195 document.getElementById("letter-w-container").setAttribute("text", "color", "white");1196 if(sessionManager.pressCount==16){1197 sessionManager.outputTextStream.push("W");1198 let textStream = ""1199 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1200 (function(){1201 textStream+=sessionManager.outputTextStream[streamSize];1202 })();1203 }1204 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1205 }1206 }1207 if(sessionManager.pressCount>45){1208 console.log("long pressed W");1209 document.getElementById("letter-w-container").setAttribute("material", "color", "orange");1210 document.getElementById("letter-w-container").setAttribute("text", "color", "black");1211 }1212 }1213 }1214 }1215 else if(indexPos[0]>-155&&indexPos[0]<-135&&indexPos[1]>190&&indexPos[1]<220){1216 //console.log("Q");1217 sessionManager.pressed.push("Q");1218 if(sessionManager.pressed.indexOf("Q")>-1){1219 document.getElementById("letter-q-container").setAttribute("material", "color", "white");1220 document.getElementById("letter-q-container").setAttribute("text", "color", "black");1221 console.log("holding down Q");1222 if(sessionManager.pressCount==null){1223 sessionManager.pressCount = -1;1224 }1225 else if(sessionManager.pressCount >= -1){1226 sessionManager.pressCount++;1227 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1228 console.log("pressed Q");1229 document.getElementById("letter-q-container").setAttribute("material", "color", "red");1230 document.getElementById("letter-q-container").setAttribute("text", "color", "white");1231 if(sessionManager.pressCount==16){1232 sessionManager.outputTextStream.push("Q");1233 let textStream = ""1234 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1235 (function(){1236 textStream+=sessionManager.outputTextStream[streamSize];1237 })();1238 }1239 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1240 }1241 }1242 if(sessionManager.pressCount>45){1243 console.log("long pressed Q");1244 document.getElementById("letter-q-container").setAttribute("material", "color", "orange");1245 document.getElementById("letter-q-container").setAttribute("text", "color", "black");1246 }1247 }1248 }1249 }1250 else if(indexPos[0]>-195&&indexPos[0]<-160&&indexPos[1]>190&&indexPos[1]<220){1251 //console.log("tab");1252 sessionManager.pressed.push("tab");1253 if(sessionManager.pressed.indexOf("tab")>-1){1254 document.getElementById("system-tab-container").setAttribute("material", "color", "white");1255 document.getElementById("system-tab-container").setAttribute("text", "color", "black");1256 console.log("holding down tab");1257 if(sessionManager.pressCount==null){1258 sessionManager.pressCount = -1;1259 }1260 else if(sessionManager.pressCount >= -1){1261 sessionManager.pressCount++;1262 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1263 console.log("pressed tab");1264 document.getElementById("system-tab-container").setAttribute("material", "color", "red");1265 document.getElementById("system-tab-container").setAttribute("text", "color", "white");1266 if(sessionManager.pressCount==16){1267 sessionManager.outputTextStream.push("tab");1268 }1269 }1270 if(sessionManager.pressCount>45){1271 console.log("long pressed tab");1272 document.getElementById("system-tab-container").setAttribute("material", "color", "orange");1273 document.getElementById("system-tab-container").setAttribute("text", "color", "black");1274 }1275 }1276 }1277 }1278 else if(indexPos[0]>95&&indexPos[0]<115&&indexPos[1]>165&&indexPos[1]<180){1279 //console.log(":");1280 sessionManager.pressed.push(":");1281 if(sessionManager.pressed.indexOf(":")>-1){1282 document.getElementById("punctuation-colon-container").setAttribute("material", "color", "white");1283 document.getElementById("punctuation-colon-container").setAttribute("text", "color", "black");1284 console.log("holding down :");1285 if(sessionManager.pressCount==null){1286 sessionManager.pressCount = -1;1287 }1288 else if(sessionManager.pressCount >= -1){1289 sessionManager.pressCount++;1290 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1291 console.log("pressed :");1292 document.getElementById("punctuation-colon-container").setAttribute("material", "color", "red");1293 document.getElementById("punctuation-colon-container").setAttribute("text", "color", "white");1294 if(sessionManager.pressCount==16){1295 sessionManager.outputTextStream.push(":");1296 let textStream = ""1297 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1298 (function(){1299 textStream+=sessionManager.outputTextStream[streamSize];1300 })();1301 }1302 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1303 }1304 }1305 if(sessionManager.pressCount>45){1306 console.log("long pressed :");1307 document.getElementById("punctuation-colon-container").setAttribute("material", "color", "orange");1308 document.getElementById("punctuation-colon-container").setAttribute("text", "color", "black");1309 }1310 }1311 }1312 }1313 else if(indexPos[0]>65&&indexPos[0]<90&&indexPos[1]>165&&indexPos[1]<180){1314 //console.log("L");1315 sessionManager.pressed.push("L");1316 if(sessionManager.pressed.indexOf("L")>-1){1317 document.getElementById("letter-l-container").setAttribute("material", "color", "white");1318 document.getElementById("letter-l-container").setAttribute("text", "color", "black");1319 console.log("holding down L");1320 if(sessionManager.pressCount==null){1321 sessionManager.pressCount = -1;1322 }1323 else if(sessionManager.pressCount >= -1){1324 sessionManager.pressCount++;1325 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1326 console.log("pressed L");1327 document.getElementById("letter-l-container").setAttribute("material", "color", "red");1328 document.getElementById("letter-l-container").setAttribute("text", "color", "white");1329 if(sessionManager.pressCount==16){1330 sessionManager.outputTextStream.push("L");1331 let textStream = ""1332 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1333 (function(){1334 textStream+=sessionManager.outputTextStream[streamSize];1335 })();1336 }1337 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1338 }1339 }1340 if(sessionManager.pressCount>45){1341 console.log("long pressed L");1342 document.getElementById("letter-l-container").setAttribute("material", "color", "orange");1343 document.getElementById("letter-l-container").setAttribute("text", "color", "black");1344 }1345 }1346 }1347 }1348 else if(indexPos[0]>40&&indexPos[0]<60&&indexPos[1]>165&&indexPos[1]<180){1349 // console.log("K");1350 sessionManager.pressed.push("K");1351 if(sessionManager.pressed.indexOf("K")>-1){1352 document.getElementById("letter-k-container").setAttribute("material", "color", "white");1353 document.getElementById("letter-k-container").setAttribute("text", "color", "black");1354 console.log("holding down K");1355 if(sessionManager.pressCount==null){1356 sessionManager.pressCount = -1;1357 }1358 else if(sessionManager.pressCount >= -1){1359 sessionManager.pressCount++;1360 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1361 console.log("pressed K");1362 document.getElementById("letter-k-container").setAttribute("material", "color", "red");1363 document.getElementById("letter-k-container").setAttribute("text", "color", "white");1364 if(sessionManager.pressCount==16){1365 sessionManager.outputTextStream.push("K");1366 let textStream = ""1367 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1368 (function(){1369 textStream+=sessionManager.outputTextStream[streamSize];1370 })();1371 }1372 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1373 }1374 }1375 if(sessionManager.pressCount>45){1376 console.log("long pressed K");1377 document.getElementById("letter-k-container").setAttribute("material", "color", "orange");1378 document.getElementById("letter-k-container").setAttribute("text", "color", "black");1379 }1380 }1381 }1382 }1383 else if(indexPos[0]>15&&indexPos[0]<35&&indexPos[1]>165&&indexPos[1]<180){1384 //console.log("J");1385 sessionManager.pressed.push("J");1386 if(sessionManager.pressed.indexOf("J")>-1){1387 document.getElementById("letter-j-container").setAttribute("material", "color", "white");1388 document.getElementById("letter-j-container").setAttribute("text", "color", "black");1389 console.log("holding down J");1390 if(sessionManager.pressCount==null){1391 sessionManager.pressCount = -1;1392 }1393 else if(sessionManager.pressCount >= -1){1394 sessionManager.pressCount++;1395 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1396 console.log("pressed J");1397 document.getElementById("letter-j-container").setAttribute("material", "color", "red");1398 document.getElementById("letter-j-container").setAttribute("text", "color", "white");1399 if(sessionManager.pressCount==16){1400 sessionManager.outputTextStream.push("J");1401 let textStream = ""1402 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1403 (function(){1404 textStream+=sessionManager.outputTextStream[streamSize];1405 })();1406 }1407 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1408 }1409 }1410 if(sessionManager.pressCount>45){1411 console.log("long pressed J");1412 document.getElementById("letter-j-container").setAttribute("material", "color", "orange");1413 document.getElementById("letter-j-container").setAttribute("text", "color", "black");1414 }1415 }1416 }1417 }1418 else if(indexPos[0]>-12&&indexPos[0]<10&&indexPos[1]>165&&indexPos[1]<180){1419 //console.log("H");1420 sessionManager.pressed.push("H");1421 if(sessionManager.pressed.indexOf("H")>-1){1422 document.getElementById("letter-h-container").setAttribute("material", "color", "white");1423 document.getElementById("letter-h-container").setAttribute("text", "color", "black");1424 console.log("holding down H");1425 if(sessionManager.pressCount==null){1426 sessionManager.pressCount = -1;1427 }1428 else if(sessionManager.pressCount >= -1){1429 sessionManager.pressCount++;1430 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1431 console.log("pressed H");1432 document.getElementById("letter-h-container").setAttribute("material", "color", "red");1433 document.getElementById("letter-h-container").setAttribute("text", "color", "white");1434 if(sessionManager.pressCount==16){1435 sessionManager.outputTextStream.push("H");1436 let textStream = ""1437 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1438 (function(){1439 textStream+=sessionManager.outputTextStream[streamSize];1440 })();1441 }1442 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1443 }1444 }1445 if(sessionManager.pressCount>45){1446 console.log("long pressed H");1447 document.getElementById("letter-h-container").setAttribute("material", "color", "orange");1448 document.getElementById("letter-h-container").setAttribute("text", "color", "black");1449 }1450 }1451 }1452 }1453 else if(indexPos[0]>-43&&indexPos[0]<-17&&indexPos[1]>165&&indexPos[1]<180){1454 //console.log("G");1455 sessionManager.pressed.push("G");1456 if(sessionManager.pressed.indexOf("G")>-1){1457 document.getElementById("letter-g-container").setAttribute("material", "color", "white");1458 document.getElementById("letter-g-container").setAttribute("text", "color", "black");1459 console.log("holding down G");1460 if(sessionManager.pressCount==null){1461 sessionManager.pressCount = -1;1462 }1463 else if(sessionManager.pressCount >= -1){1464 sessionManager.pressCount++;1465 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1466 console.log("pressed G");1467 document.getElementById("letter-g-container").setAttribute("material", "color", "red");1468 document.getElementById("letter-g-container").setAttribute("text", "color", "white");1469 if(sessionManager.pressCount==16){1470 sessionManager.outputTextStream.push("G");1471 let textStream = ""1472 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1473 (function(){1474 textStream+=sessionManager.outputTextStream[streamSize];1475 })();1476 }1477 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1478 }1479 }1480 if(sessionManager.pressCount>45){1481 console.log("long pressed G");1482 document.getElementById("letter-g-container").setAttribute("material", "color", "orange");1483 document.getElementById("letter-g-container").setAttribute("text", "color", "black");1484 }1485 }1486 }1487 }1488 else if(indexPos[0]>-70&&indexPos[0]<-48&&indexPos[1]>165&&indexPos[1]<180){1489 // console.log("F");1490 sessionManager.pressed.push("F");1491 if(sessionManager.pressed.indexOf("F")>-1){1492 document.getElementById("letter-f-container").setAttribute("material", "color", "white");1493 document.getElementById("letter-f-container").setAttribute("text", "color", "black");1494 console.log("holding down F");1495 if(sessionManager.pressCount==null){1496 sessionManager.pressCount = -1;1497 }1498 else if(sessionManager.pressCount >= -1){1499 sessionManager.pressCount++;1500 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1501 console.log("pressed F");1502 document.getElementById("letter-f-container").setAttribute("material", "color", "red");1503 document.getElementById("letter-f-container").setAttribute("text", "color", "white");1504 if(sessionManager.pressCount==16){1505 sessionManager.outputTextStream.push("F");1506 let textStream = ""1507 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1508 (function(){1509 textStream+=sessionManager.outputTextStream[streamSize];1510 })();1511 }1512 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1513 }1514 }1515 if(sessionManager.pressCount>45){1516 console.log("long pressed F");1517 document.getElementById("letter-f-container").setAttribute("material", "color", "orange");1518 document.getElementById("letter-f-container").setAttribute("text", "color", "black");1519 }1520 }1521 }1522 }1523 else if(indexPos[0]>-95&&indexPos[0]<-75&&indexPos[1]>165&&indexPos[1]<180){1524 // console.log("D");1525 sessionManager.pressed.push("D");1526 if(sessionManager.pressed.indexOf("D")>-1){1527 document.getElementById("letter-d-container").setAttribute("material", "color", "white");1528 document.getElementById("letter-d-container").setAttribute("text", "color", "black");1529 console.log("holding down D");1530 if(sessionManager.pressCount==null){1531 sessionManager.pressCount = -1;1532 }1533 else if(sessionManager.pressCount >= -1){1534 sessionManager.pressCount++;1535 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1536 console.log("pressed D");1537 document.getElementById("letter-d-container").setAttribute("material", "color", "red");1538 document.getElementById("letter-d-container").setAttribute("text", "color", "white");1539 if(sessionManager.pressCount==16){1540 sessionManager.outputTextStream.push("D");1541 let textStream = ""1542 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1543 (function(){1544 textStream+=sessionManager.outputTextStream[streamSize];1545 })();1546 }1547 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1548 }1549 }1550 if(sessionManager.pressCount>45){1551 console.log("long pressed D");1552 document.getElementById("letter-d-container").setAttribute("material", "color", "orange");1553 document.getElementById("letter-d-container").setAttribute("text", "color", "black");1554 }1555 }1556 }1557 }1558 else if(indexPos[0]>-130&&indexPos[0]<-105&&indexPos[1]>165&&indexPos[1]<180){1559 // console.log("S");1560 sessionManager.pressed.push("S");1561 if(sessionManager.pressed.indexOf("S")>-1){1562 document.getElementById("letter-s-container").setAttribute("material", "color", "white");1563 document.getElementById("letter-s-container").setAttribute("text", "color", "black");1564 console.log("holding down S");1565 if(sessionManager.pressCount==null){1566 sessionManager.pressCount = -1;1567 }1568 else if(sessionManager.pressCount >= -1){1569 sessionManager.pressCount++;1570 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1571 console.log("pressed S");1572 document.getElementById("letter-s-container").setAttribute("material", "color", "red");1573 document.getElementById("letter-s-container").setAttribute("text", "color", "white");1574 if(sessionManager.pressCount==16){1575 sessionManager.outputTextStream.push("S");1576 let textStream = ""1577 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1578 (function(){1579 textStream+=sessionManager.outputTextStream[streamSize];1580 })();1581 }1582 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1583 }1584 }1585 if(sessionManager.pressCount>45){1586 console.log("long pressed S");1587 document.getElementById("letter-s-container").setAttribute("material", "color", "orange");1588 document.getElementById("letter-s-container").setAttribute("text", "color", "black");1589 }1590 }1591 }1592 }1593 else if(indexPos[0]>-155&&indexPos[0]<-135&&indexPos[1]>165&&indexPos[1]<180){1594 // console.log("A");1595 sessionManager.pressed.push("A");1596 if(sessionManager.pressed.indexOf("A")>-1){1597 document.getElementById("letter-a-container").setAttribute("material", "color", "white");1598 document.getElementById("letter-a-container").setAttribute("text", "color", "black");1599 console.log("holding down A");1600 if(sessionManager.pressCount==null){1601 sessionManager.pressCount = -1;1602 }1603 else if(sessionManager.pressCount >= -1){1604 sessionManager.pressCount++;1605 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1606 console.log("pressed A");1607 document.getElementById("letter-a-container").setAttribute("material", "color", "red");1608 document.getElementById("letter-a-container").setAttribute("text", "color", "white");1609 if(sessionManager.pressCount==16){1610 sessionManager.outputTextStream.push("A");1611 let textStream = ""1612 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1613 (function(){1614 textStream+=sessionManager.outputTextStream[streamSize];1615 })();1616 }1617 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1618 }1619 }1620 if(sessionManager.pressCount>45){1621 console.log("long pressed A");1622 document.getElementById("letter-a-container").setAttribute("material", "color", "orange");1623 document.getElementById("letter-a-container").setAttribute("text", "color", "black");1624 }1625 }1626 }1627 }1628 else if(indexPos[0]>-195&&indexPos[0]<-160&&indexPos[1]>165&&indexPos[1]<180){1629 console.log("caps lock");1630 sessionManager.pressed.push("caps-lock");1631 if(sessionManager.pressed.indexOf("caps-lock")>-1){1632 document.getElementById("system-capslock-container").setAttribute("material", "color", "white");1633 document.getElementById("system-capslock-container").setAttribute("text", "color", "black");1634 console.log("holding down caps lock");1635 if(sessionManager.pressCount==null){1636 sessionManager.pressCount = -1;1637 }1638 else if(sessionManager.pressCount >= -1){1639 sessionManager.pressCount++;1640 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1641 console.log("pressed caps lock");1642 document.getElementById("system-capslock-container").setAttribute("material", "color", "red");1643 document.getElementById("system-capslock-container").setAttribute("text", "color", "white");1644 if(sessionManager.pressCount==16){1645 console.log("caps lock effect");1646 }1647 }1648 if(sessionManager.pressCount>45){1649 console.log("long pressed caps lock");1650 document.getElementById("system-capslock-container").setAttribute("material", "color", "orange");1651 document.getElementById("system-capslock-container").setAttribute("text", "color", "black");1652 }1653 }1654 }1655 }1656 else if(indexPos[0]>95&&indexPos[0]<115&&indexPos[1]>135&&indexPos[1]<160){1657 //console.log(":");1658 sessionManager.pressed.push("?");1659 if(sessionManager.pressed.indexOf("?")>-1){1660 document.getElementById("punctuation-question-container").setAttribute("material", "color", "white");1661 document.getElementById("punctuation-question-container").setAttribute("text", "color", "black");1662 console.log("holding down ?");1663 if(sessionManager.pressCount==null){1664 sessionManager.pressCount = -1;1665 }1666 else if(sessionManager.pressCount >= -1){1667 sessionManager.pressCount++;1668 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1669 console.log("pressed ?");1670 document.getElementById("punctuation-question-container").setAttribute("material", "color", "red");1671 document.getElementById("punctuation-question-container").setAttribute("text", "color", "white");1672 if(sessionManager.pressCount==16){1673 sessionManager.outputTextStream.push("?");1674 let textStream = ""1675 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1676 (function(){1677 textStream+=sessionManager.outputTextStream[streamSize];1678 })();1679 }1680 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1681 }1682 }1683 if(sessionManager.pressCount>45){1684 console.log("long pressed ?");1685 document.getElementById("punctuation-question-container").setAttribute("material", "color", "orange");1686 document.getElementById("punctuation-question-container").setAttribute("text", "color", "black");1687 }1688 }1689 }1690 }1691 else if(indexPos[0]>65&&indexPos[0]<90&&indexPos[1]>135&&indexPos[1]<160){1692 //console.log("greater than");1693 sessionManager.pressed.push("greater-than");1694 if(sessionManager.pressed.indexOf("greater-than")>-1){1695 document.getElementById("symbol-greaterthan-container").setAttribute("material", "color", "white");1696 document.getElementById("symbol-greaterthan-container").setAttribute("text", "color", "black");1697 console.log("holding down greater than|period");1698 if(sessionManager.pressCount==null){1699 sessionManager.pressCount = -1;1700 }1701 else if(sessionManager.pressCount >= -1){1702 sessionManager.pressCount++;1703 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1704 console.log("pressed >|.");1705 document.getElementById("symbol-greaterthan-container").setAttribute("material", "color", "red");1706 document.getElementById("symbol-greaterthan-container").setAttribute("text", "color", "white");1707 if(sessionManager.pressCount==16){1708 sessionManager.outputTextStream.push(">");1709 let textStream = ""1710 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1711 (function(){1712 textStream+=sessionManager.outputTextStream[streamSize];1713 })();1714 }1715 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1716 }1717 }1718 if(sessionManager.pressCount>45){1719 console.log("long pressed >|.");1720 document.getElementById("symbol-greaterthan-container").setAttribute("material", "color", "orange");1721 document.getElementById("symbol-greaterthan-container").setAttribute("text", "color", "black");1722 }1723 }1724 }1725 }1726 else if(indexPos[0]>40&&indexPos[0]<60&&indexPos[1]>135&&indexPos[1]<160){1727 // console.log("less than");1728 sessionManager.pressed.push("less-than");1729 if(sessionManager.pressed.indexOf("less-than")>-1){1730 document.getElementById("symbol-lessthan-container").setAttribute("material", "color", "white");1731 document.getElementById("symbol-lessthan-container").setAttribute("text", "color", "black");1732 console.log("holding down less than|comma");1733 if(sessionManager.pressCount==null){1734 sessionManager.pressCount = -1;1735 }1736 else if(sessionManager.pressCount >= -1){1737 sessionManager.pressCount++;1738 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1739 console.log("pressed <|,");1740 document.getElementById("symbol-lessthan-container").setAttribute("material", "color", "red");1741 document.getElementById("symbol-lessthan-container").setAttribute("text", "color", "white");1742 if(sessionManager.pressCount==16){1743 sessionManager.outputTextStream.push("<");1744 let textStream = ""1745 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1746 (function(){1747 textStream+=sessionManager.outputTextStream[streamSize];1748 })();1749 }1750 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1751 }1752 }1753 if(sessionManager.pressCount>45){1754 console.log("long pressed <|,");1755 document.getElementById("symbol-lessthan-container").setAttribute("material", "color", "orange");1756 document.getElementById("symbol-lessthan-container").setAttribute("text", "color", "black");1757 }1758 }1759 }1760 }1761 else if(indexPos[0]>15&&indexPos[0]<35&&indexPos[1]>135&&indexPos[1]<160){1762 //console.log("M");1763 sessionManager.pressed.push("M");1764 if(sessionManager.pressed.indexOf("M")>-1){1765 document.getElementById("letter-m-container").setAttribute("material", "color", "white");1766 document.getElementById("letter-m-container").setAttribute("text", "color", "black");1767 console.log("holding down M");1768 if(sessionManager.pressCount==null){1769 sessionManager.pressCount = -1;1770 }1771 else if(sessionManager.pressCount >= -1){1772 sessionManager.pressCount++;1773 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1774 console.log("pressed M");1775 document.getElementById("letter-m-container").setAttribute("material", "color", "red");1776 document.getElementById("letter-m-container").setAttribute("text", "color", "white");1777 if(sessionManager.pressCount==16){1778 sessionManager.outputTextStream.push("M");1779 let textStream = ""1780 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1781 (function(){1782 textStream+=sessionManager.outputTextStream[streamSize];1783 })();1784 }1785 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1786 }1787 }1788 if(sessionManager.pressCount>45){1789 console.log("long pressed M");1790 document.getElementById("letter-m-container").setAttribute("material", "color", "orange");1791 document.getElementById("letter-m-container").setAttribute("text", "color", "black");1792 }1793 }1794 }1795 }1796 else if(indexPos[0]>-12&&indexPos[0]<10&&indexPos[1]>135&&indexPos[1]<160){1797 //console.log("N");1798 sessionManager.pressed.push("N");1799 if(sessionManager.pressed.indexOf("N")>-1){1800 document.getElementById("letter-n-container").setAttribute("material", "color", "white");1801 document.getElementById("letter-n-container").setAttribute("text", "color", "black");1802 console.log("holding down N");1803 if(sessionManager.pressCount==null){1804 sessionManager.pressCount = -1;1805 }1806 else if(sessionManager.pressCount >= -1){1807 sessionManager.pressCount++;1808 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1809 console.log("pressed N");1810 document.getElementById("letter-n-container").setAttribute("material", "color", "red");1811 document.getElementById("letter-n-container").setAttribute("text", "color", "white");1812 if(sessionManager.pressCount==16){1813 sessionManager.outputTextStream.push("N");1814 let textStream = ""1815 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1816 (function(){1817 textStream+=sessionManager.outputTextStream[streamSize];1818 })();1819 }1820 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1821 }1822 }1823 if(sessionManager.pressCount>45){1824 console.log("long pressed N");1825 document.getElementById("letter-n-container").setAttribute("material", "color", "orange");1826 document.getElementById("letter-n-container").setAttribute("text", "color", "black");1827 }1828 }1829 }1830 }1831 else if(indexPos[0]>-43&&indexPos[0]<-17&&indexPos[1]>135&&indexPos[1]<160){1832 //console.log("B");1833 sessionManager.pressed.push("B");1834 if(sessionManager.pressed.indexOf("B")>-1){1835 document.getElementById("letter-b-container").setAttribute("material", "color", "white");1836 document.getElementById("letter-b-container").setAttribute("text", "color", "black");1837 console.log("holding down B");1838 if(sessionManager.pressCount==null){1839 sessionManager.pressCount = -1;1840 }1841 else if(sessionManager.pressCount >= -1){1842 sessionManager.pressCount++;1843 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1844 console.log("pressed B");1845 document.getElementById("letter-b-container").setAttribute("material", "color", "red");1846 document.getElementById("letter-b-container").setAttribute("text", "color", "white");1847 if(sessionManager.pressCount==16){1848 sessionManager.outputTextStream.push("B");1849 let textStream = ""1850 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1851 (function(){1852 textStream+=sessionManager.outputTextStream[streamSize];1853 })();1854 }1855 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1856 }1857 }1858 if(sessionManager.pressCount>45){1859 console.log("long pressed B");1860 document.getElementById("letter-b-container").setAttribute("material", "color", "orange");1861 document.getElementById("letter-b-container").setAttribute("text", "color", "black");1862 }1863 }1864 }1865 }1866 else if(indexPos[0]>-70&&indexPos[0]<-48&&indexPos[1]>135&&indexPos[1]<160){1867 // console.log("V");1868 sessionManager.pressed.push("V");1869 if(sessionManager.pressed.indexOf("V")>-1){1870 document.getElementById("letter-v-container").setAttribute("material", "color", "white");1871 document.getElementById("letter-v-container").setAttribute("text", "color", "black");1872 console.log("holding down V");1873 if(sessionManager.pressCount==null){1874 sessionManager.pressCount = -1;1875 }1876 else if(sessionManager.pressCount >= -1){1877 sessionManager.pressCount++;1878 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1879 console.log("pressed V");1880 document.getElementById("letter-v-container").setAttribute("material", "color", "red");1881 document.getElementById("letter-v-container").setAttribute("text", "color", "white");1882 if(sessionManager.pressCount==16){1883 sessionManager.outputTextStream.push("V");1884 let textStream = ""1885 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1886 (function(){1887 textStream+=sessionManager.outputTextStream[streamSize];1888 })();1889 }1890 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1891 }1892 }1893 if(sessionManager.pressCount>45){1894 console.log("long pressed V");1895 document.getElementById("letter-v-container").setAttribute("material", "color", "orange");1896 document.getElementById("letter-v-container").setAttribute("text", "color", "black");1897 }1898 }1899 }1900 }1901 else if(indexPos[0]>-95&&indexPos[0]<-75&&indexPos[1]>135&&indexPos[1]<160){1902 // console.log("C");1903 sessionManager.pressed.push("C");1904 if(sessionManager.pressed.indexOf("C")>-1){1905 document.getElementById("letter-c-container").setAttribute("material", "color", "white");1906 document.getElementById("letter-c-container").setAttribute("text", "color", "black");1907 console.log("holding down C");1908 if(sessionManager.pressCount==null){1909 sessionManager.pressCount = -1;1910 }1911 else if(sessionManager.pressCount >= -1){1912 sessionManager.pressCount++;1913 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1914 console.log("pressed C");1915 document.getElementById("letter-c-container").setAttribute("material", "color", "red");1916 document.getElementById("letter-c-container").setAttribute("text", "color", "white");1917 if(sessionManager.pressCount==16){1918 sessionManager.outputTextStream.push("C");1919 let textStream = ""1920 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1921 (function(){1922 textStream+=sessionManager.outputTextStream[streamSize];1923 })();1924 }1925 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1926 }1927 }1928 if(sessionManager.pressCount>45){1929 console.log("long pressed C");1930 document.getElementById("letter-c-container").setAttribute("material", "color", "orange");1931 document.getElementById("letter-c-container").setAttribute("text", "color", "black");1932 }1933 }1934 }1935 }1936 else if(indexPos[0]>-130&&indexPos[0]<-105&&indexPos[1]>135&&indexPos[1]<160){1937 // console.log("X");1938 sessionManager.pressed.push("X");1939 if(sessionManager.pressed.indexOf("X")>-1){1940 document.getElementById("letter-x-container").setAttribute("material", "color", "white");1941 document.getElementById("letter-x-container").setAttribute("text", "color", "black");1942 console.log("holding down X");1943 if(sessionManager.pressCount==null){1944 sessionManager.pressCount = -1;1945 }1946 else if(sessionManager.pressCount >= -1){1947 sessionManager.pressCount++;1948 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1949 console.log("pressed X");1950 document.getElementById("letter-x-container").setAttribute("material", "color", "red");1951 document.getElementById("letter-x-container").setAttribute("text", "color", "white");1952 if(sessionManager.pressCount==16){1953 sessionManager.outputTextStream.push("X");1954 let textStream = ""1955 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1956 (function(){1957 textStream+=sessionManager.outputTextStream[streamSize];1958 })();1959 }1960 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1961 }1962 }1963 if(sessionManager.pressCount>45){1964 console.log("long pressed X");1965 document.getElementById("letter-x-container").setAttribute("material", "color", "orange");1966 document.getElementById("letter-x-container").setAttribute("text", "color", "black");1967 }1968 }1969 }1970 }1971 else if(indexPos[0]>-155&&indexPos[0]<-135&&indexPos[1]>135&&indexPos[1]<160){1972 // console.log("Z");1973 sessionManager.pressed.push("Z");1974 if(sessionManager.pressed.indexOf("Z")>-1){1975 document.getElementById("letter-z-container").setAttribute("material", "color", "white");1976 document.getElementById("letter-z-container").setAttribute("text", "color", "black");1977 console.log("holding down Z");1978 if(sessionManager.pressCount==null){1979 sessionManager.pressCount = -1;1980 }1981 else if(sessionManager.pressCount >= -1){1982 sessionManager.pressCount++;1983 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){1984 console.log("pressed Z");1985 document.getElementById("letter-z-container").setAttribute("material", "color", "red");1986 document.getElementById("letter-z-container").setAttribute("text", "color", "white");1987 if(sessionManager.pressCount==16){1988 sessionManager.outputTextStream.push("Z");1989 let textStream = ""1990 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1991 (function(){1992 textStream+=sessionManager.outputTextStream[streamSize];1993 })();1994 }1995 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1996 }1997 }1998 if(sessionManager.pressCount>45){1999 console.log("long pressed Z");2000 document.getElementById("letter-z-container").setAttribute("material", "color", "orange");2001 document.getElementById("letter-z-container").setAttribute("text", "color", "black");2002 }2003 }2004 }2005 }2006 else if(indexPos[0]>-195&&indexPos[0]<-160&&indexPos[1]>135&&indexPos[1]<160){2007 console.log("shift");2008 sessionManager.pressed.push("shift");2009 if(sessionManager.pressed.indexOf("shift")>-1){2010 document.getElementById("system-leftshift-container").setAttribute("material", "color", "white");2011 document.getElementById("system-leftshift-container").setAttribute("text", "color", "black");2012 console.log("holding down left shift");2013 if(sessionManager.pressCount==null){2014 sessionManager.pressCount = -1;2015 }2016 else if(sessionManager.pressCount >= -1){2017 sessionManager.pressCount++;2018 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){2019 console.log("pressed shift");2020 document.getElementById("system-leftshift-container").setAttribute("material", "color", "red");2021 document.getElementById("system-leftshift-container").setAttribute("text", "color", "white");2022 if(sessionManager.pressCount==16){2023 console.log("shift effect!")2024 }2025 }2026 if(sessionManager.pressCount>45){2027 console.log("long pressed shift");2028 document.getElementById("system-leftshift-container").setAttribute("material", "color", "orange");2029 document.getElementById("system-leftshift-container").setAttribute("text", "color", "black");2030 }2031 }2032 }2033 }2034 else if(indexPos[0]>165&&indexPos[0]<185&&indexPos[1]>105&&indexPos[1]<130){2035 // console.log("RD");2036 sessionManager.pressed.push("RD");2037 if(sessionManager.pressed.indexOf("RD")>-1){2038 document.getElementById("dpad-right-container").setAttribute("material", "color", "white");2039 document.getElementById("dpad-right-container").setAttribute("text", "color", "black");2040 //console.log("holding down RD");2041 if(sessionManager.pressCount==null){2042 sessionManager.pressCount = -1;2043 }2044 else if(sessionManager.pressCount >= -1){2045 sessionManager.pressCount++;2046 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){2047 console.log("pressed RD");2048 document.getElementById("dpad-right-container").setAttribute("material", "color", "red");2049 document.getElementById("dpad-right-container").setAttribute("text", "color", "white");2050 if(sessionManager.pressCount==16){2051 console.log("dpad right effect!")2052 }2053 }2054 if(sessionManager.pressCount>45){2055 console.log("long pressed RD");2056 document.getElementById("dpad-right-container").setAttribute("material", "color", "orange");2057 document.getElementById("dpad-right-container").setAttribute("text", "color", "black");2058 }2059 }2060 }2061 }2062 else if(indexPos[0]>143&&indexPos[0]<160&&indexPos[1]>95&&indexPos[1]<120){2063 // console.log("DD");2064 sessionManager.pressed.push("DD");2065 if(sessionManager.pressed.indexOf("DD")>-1){2066 document.getElementById("dpad-down-container").setAttribute("material", "color", "white");2067 document.getElementById("dpad-down-container").setAttribute("text", "color", "black");2068 //console.log("holding down DD");2069 if(sessionManager.pressCount==null){2070 sessionManager.pressCount = -1;2071 }2072 else if(sessionManager.pressCount >= -1){2073 sessionManager.pressCount++;2074 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){2075 console.log("pressed DD");2076 document.getElementById("dpad-down-container").setAttribute("material", "color", "red");2077 document.getElementById("dpad-down-container").setAttribute("text", "color", "white");2078 if(sessionManager.pressCount==16){2079 console.log("dpad down effect!")2080 }2081 }2082 if(sessionManager.pressCount>45){2083 console.log("long pressed DD");2084 document.getElementById("dpad-down-container").setAttribute("material", "color", "orange");2085 document.getElementById("dpad-down-container").setAttribute("text", "color", "black");2086 }2087 }2088 }2089 }2090 else if(indexPos[0]>143&&indexPos[0]<160&&indexPos[1]>125&&indexPos[1]<145){2091 // console.log("UD");2092 sessionManager.pressed.push("UD");2093 if(sessionManager.pressed.indexOf("UD")>-1){2094 document.getElementById("dpad-up-container").setAttribute("material", "color", "white");2095 document.getElementById("dpad-up-container").setAttribute("text", "color", "black");2096 console.log("holding down UD");2097 if(sessionManager.pressCount==null){2098 sessionManager.pressCount = -1;2099 }2100 else if(sessionManager.pressCount >= -1){2101 sessionManager.pressCount++;2102 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){2103 console.log("pressed UD");2104 document.getElementById("dpad-up-container").setAttribute("material", "color", "red");2105 document.getElementById("dpad-up-container").setAttribute("text", "color", "white");2106 if(sessionManager.pressCount==16){2107 console.log("dpad up effect!")2108 }2109 }2110 if(sessionManager.pressCount>45){2111 console.log("long pressed UD");2112 document.getElementById("dpad-up-container").setAttribute("material", "color", "orange");2113 document.getElementById("dpad-up-container").setAttribute("text", "color", "black");2114 }2115 }2116 }2117 }2118 else if(indexPos[0]>120&&indexPos[0]<140&&indexPos[1]>105&&indexPos[1]<130){2119 // console.log("LD");2120 sessionManager.pressed.push("LD");2121 if(sessionManager.pressed.indexOf("LD")>-1){2122 document.getElementById("dpad-left-container").setAttribute("material", "color", "white");2123 document.getElementById("dpad-left-container").setAttribute("text", "color", "black");2124 console.log("holding down LD");2125 if(sessionManager.pressCount==null){2126 sessionManager.pressCount = -1;2127 }2128 else if(sessionManager.pressCount >= -1){2129 sessionManager.pressCount++;2130 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){2131 console.log("pressed LD");2132 document.getElementById("dpad-left-container").setAttribute("material", "color", "red");2133 document.getElementById("dpad-left-container").setAttribute("text", "color", "white");2134 if(sessionManager.pressCount==16){2135 console.log("dpad left effect!")2136 }2137 }2138 if(sessionManager.pressCount>45){2139 console.log("long pressed LD");2140 document.getElementById("dpad-left-container").setAttribute("material", "color", "orange");2141 document.getElementById("dpad-left-container").setAttribute("text", "color", "black");2142 }2143 }2144 }2145 }2146 else if(indexPos[0]>95&&indexPos[0]<115&&indexPos[1]>105&&indexPos[1]<130){2147 // console.log("ROPT");2148 sessionManager.pressed.push("ROPT");2149 if(sessionManager.pressed.indexOf("ROPT")>-1){2150 document.getElementById("system-rightoption-container").setAttribute("material", "color", "white");2151 document.getElementById("system-rightoption-container").setAttribute("text", "color", "black");2152 console.log("holding down ROPT");2153 if(sessionManager.pressCount==null){2154 sessionManager.pressCount = -1;2155 }2156 else if(sessionManager.pressCount >= -1){2157 sessionManager.pressCount++;2158 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){2159 console.log("pressed ROPT");2160 document.getElementById("system-rightoption-container").setAttribute("material", "color", "red");2161 document.getElementById("system-rightoption-container").setAttribute("text", "color", "white");2162 if(sessionManager.pressCount==16){2163 console.log("right option effect!")2164 }2165 }2166 if(sessionManager.pressCount>45){2167 console.log("long pressed ROPT");2168 document.getElementById("system-rightoption-container").setAttribute("material", "color", "orange");2169 document.getElementById("system-rightoption-container").setAttribute("text", "color", "black");2170 }2171 }2172 }2173 }2174 else if(indexPos[0]>65&&indexPos[0]<90&&indexPos[1]>105&&indexPos[1]<130){2175 // console.log("RCMD");2176 sessionManager.pressed.push("RCMD");2177 if(sessionManager.pressed.indexOf("RCMD")>-1){2178 document.getElementById("system-rightcommand-container").setAttribute("material", "color", "white");2179 document.getElementById("system-rightcommand-container").setAttribute("text", "color", "black");2180 console.log("holding down RCMD");2181 if(sessionManager.pressCount==null){2182 sessionManager.pressCount = -1;2183 }2184 else if(sessionManager.pressCount >= -1){2185 sessionManager.pressCount++;2186 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){2187 console.log("pressed RCMD");2188 document.getElementById("system-rightcommand-container").setAttribute("material", "color", "red");2189 document.getElementById("system-rightcommand-container").setAttribute("text", "color", "white");2190 if(sessionManager.pressCount==16){2191 console.log("right command effect!")2192 }2193 }2194 if(sessionManager.pressCount>45){2195 console.log("long pressed RCMD");2196 document.getElementById("system-rightcommand-container").setAttribute("material", "color", "orange");2197 document.getElementById("system-rightcommand-container").setAttribute("text", "color", "black");2198 }2199 }2200 }2201 }2202 else if(indexPos[0]>-85&&indexPos[0]<60&&indexPos[1]>105&&indexPos[1]<130){2203 // console.log("SPCE");2204 sessionManager.pressed.push("SPCE");2205 if(sessionManager.pressed.indexOf("SPCE")>-1){2206 document.getElementById("space-bar-container").setAttribute("material", "color", "white");2207 document.getElementById("space-bar-container").setAttribute("text", "color", "black");2208 console.log("holding down SPCE");2209 if(sessionManager.pressCount==null){2210 sessionManager.pressCount = -1;2211 }2212 else if(sessionManager.pressCount >= -1){2213 sessionManager.pressCount++;2214 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){2215 console.log("pressed SPCE");2216 document.getElementById("space-bar-container").setAttribute("material", "color", "red");2217 document.getElementById("space-bar-container").setAttribute("text", "color", "white");2218 if(sessionManager.pressCount==16){2219 sessionManager.outputTextStream.push(" ");2220 let textStream = ""2221 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){2222 (function(){2223 textStream+=sessionManager.outputTextStream[streamSize];2224 })();2225 }2226 document.getElementById("output-display-container").setAttribute("text", "value", textStream);2227 }2228 }2229 if(sessionManager.pressCount>45){2230 console.log("long pressed SPCE");2231 document.getElementById("letter-q-container").setAttribute("material", "color", "orange");2232 document.getElementById("letter-q-container").setAttribute("text", "color", "black");2233 }2234 }2235 }2236 }2237 else if(indexPos[0]>-105&&indexPos[0]<-90&&indexPos[1]>105&&indexPos[1]<130){2238 // console.log("CMD");2239 sessionManager.pressed.push("CMD");2240 if(sessionManager.pressed.indexOf("CMD")>-1){2241 document.getElementById("system-leftcommand-container").setAttribute("material", "color", "white");2242 document.getElementById("system-leftcommand-container").setAttribute("text", "color", "black");2243 console.log("holding down left CMD button");2244 if(sessionManager.pressCount==null){2245 sessionManager.pressCount = -1;2246 }2247 else if(sessionManager.pressCount >= -1){2248 sessionManager.pressCount++;2249 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){2250 console.log("pressed CMD");2251 document.getElementById("system-leftcommand-container").setAttribute("material", "color", "red");2252 document.getElementById("system-leftcommand-container").setAttribute("text", "color", "white");2253 if(sessionManager.pressCount==16){2254 console.log("left command effect!")2255 }2256 }2257 if(sessionManager.pressCount>45){2258 console.log("long pressed CMD");2259 document.getElementById("letter-q-container").setAttribute("material", "color", "orange");2260 document.getElementById("letter-q-container").setAttribute("text", "color", "black");2261 }2262 }2263 }2264 }2265 else if(indexPos[0]>-130&&indexPos[0]<-110&&indexPos[1]>105&&indexPos[1]<130){2266 // console.log("OPTION");2267 sessionManager.pressed.push("OPTION");2268 if(sessionManager.pressed.indexOf("OPTION")>-1){2269 document.getElementById("system-leftoption-container").setAttribute("material", "color", "white");2270 document.getElementById("system-leftoption-container").setAttribute("text", "color", "black");2271 console.log("holding downleft OPTION button");2272 if(sessionManager.pressCount==null){2273 sessionManager.pressCount = -1;2274 }2275 else if(sessionManager.pressCount >= -1){2276 sessionManager.pressCount++;2277 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){2278 console.log("pressed OPTION");2279 document.getElementById("system-leftoption-container").setAttribute("material", "color", "red");2280 document.getElementById("system-leftoption-container").setAttribute("text", "color", "white");2281 if(sessionManager.pressCount==16){2282 console.log("left option effect!")2283 }2284 }2285 if(sessionManager.pressCount>45){2286 console.log("long pressed OPTION");2287 document.getElementById("letter-q-container").setAttribute("material", "color", "orange");2288 document.getElementById("letter-q-container").setAttribute("text", "color", "black");2289 }2290 }2291 }2292 }2293 else if(indexPos[0]>-155&&indexPos[0]<-135&&indexPos[1]>105&&indexPos[1]<130){2294 // console.log("CTRL");2295 sessionManager.pressed.push("CTRL");2296 if(sessionManager.pressed.indexOf("CTRL")>-1){2297 document.getElementById("system-leftcontrol-container").setAttribute("material", "color", "white");2298 document.getElementById("system-leftcontrol-container").setAttribute("text", "color", "black");2299 console.log("holding down left CTRL button");2300 if(sessionManager.pressCount==null){2301 sessionManager.pressCount = -1;2302 }2303 else if(sessionManager.pressCount >= -1){2304 sessionManager.pressCount++;2305 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){2306 console.log("pressed CTRL");2307 document.getElementById("system-leftcontrol-container").setAttribute("material", "color", "red");2308 document.getElementById("system-leftcontrol-container").setAttribute("text", "color", "white");2309 if(sessionManager.pressCount==16){2310 console.log("left control effect!")2311 }2312 }2313 if(sessionManager.pressCount>45){2314 console.log("long pressed CTRL");2315 document.getElementById("letter-q-container").setAttribute("material", "color", "orange");2316 document.getElementById("letter-q-container").setAttribute("text", "color", "black");2317 }2318 }2319 }2320 }2321 else if(indexPos[0]>-195&&indexPos[0]<-160&&indexPos[1]>105&&indexPos[1]<130){2322 console.log("FN");2323 sessionManager.pressed.push("FN");2324 if(sessionManager.pressed.indexOf("FN")>-1){2325 document.getElementById("system-function-container").setAttribute("material", "color", "white");2326 document.getElementById("system-function-container").setAttribute("text", "color", "black");2327 console.log("holding down FN button");2328 if(sessionManager.pressCount==null){2329 sessionManager.pressCount = -1;2330 }2331 else if(sessionManager.pressCount >= -1){2332 sessionManager.pressCount++;2333 if(sessionManager.pressCount>15&&sessionManager.pressCount<45){2334 console.log("pressed FN");2335 document.getElementById("system-function-container").setAttribute("material", "color", "red");2336 document.getElementById("system-function-container").setAttribute("text", "color", "white");2337 if(sessionManager.pressCount==16){2338 console.log("function effect!")2339 }2340 }2341 if(sessionManager.pressCount>45){2342 console.log("long pressed FN");2343 document.getElementById("letter-q-container").setAttribute("material", "color", "orange");2344 document.getElementById("letter-q-container").setAttribute("text", "color", "black");2345 }2346 }2347 }2348 }2349 else if(indexPos[0]>150&&indexPos[0]<170&&indexPos[1]>150&&indexPos[1]<170){2350 console.log("toggle #output-display-container");2351 if(sessionManager.outputTimeOut){2352 console.log("wait to press button after timeout");2353 }2354 else{2355 if(sessionManager.outputDisplayContainerVisible){2356 document.getElementById("output-display-container").setAttribute("material", "opacity", 0);2357 sessionManager.outputDisplayContainerVisible = false;2358 }2359 else{2360 document.getElementById("output-display-container").setAttribute("material", "opacity", 1.0);2361 sessionManager.outputDisplayContainerVisible = true;2362 }2363 sessionManager.outputTimeOut = true;2364 setTimeout(function(){2365 sessionManager.outputTimeOut = false;2366 }, 2000);2367 }2368 }2369 else if(indexPos[0]>170&&indexPos[0]<190&&indexPos[1]>210&&indexPos[1]<230){2370 console.log("export as LYOKO");2371 }2372 else if(indexPos[0]>170&&indexPos[0]<190&&indexPos[1]>240&&indexPos[1]<260){2373 console.log("export as TXT");2374 }2375 else{2376 //2377 // console.log(indexPos[1]);2378 if(sessionManager.pressed.length>0){2379 sessionManager.pressed = [];2380 sessionManager.pressCount = -1;2381 let buttons = document.getElementsByClassName("keyboard-button-container");2382 for(var q=0; q<buttons.length; q++){2383 (function(){2384 buttons.item(q).setAttribute("material", "color", "black");2385 buttons.item(q).setAttribute("text", "color", "white");2386 })();2387 }2388 }2389 }2390 /*2391 *2392 * for every item in the object objectManager2393 * check its margins2394 * if the center of the indexFinger's distal bone is within the margins of the object2395 * change the object's background color to black and text color to white2396 * other wise keep the background color gray2397 *2398 */2399 }2400 renderer.render(scene, camera);2401}})2402.use('handHold')2403.use('handEntry')2404.on('handFound', function(hand){2405 hand.fingers.forEach(function (finger) {2406 var boneMeshes = [];2407 var jointMeshes = [];2408 finger.bones.forEach(function(bone) {2409 var boneMesh = new THREE.Mesh(2410 new THREE.CylinderGeometry(5, 5, bone.length),2411 new THREE.MeshPhongMaterial()2412 );2413 boneMesh.material.color.setHex(0xffffff);2414 scene.add(boneMesh);2415 boneMeshes.push(boneMesh);2416 });2417 for (var i = 0; i < finger.bones.length + 1; i++) {2418 var jointMesh = new THREE.Mesh(2419 new THREE.SphereGeometry(8),2420 new THREE.MeshPhongMaterial()2421 );2422 jointMesh.material.color.setHex(0x00ff00);2423 scene.add(jointMesh);2424 jointMeshes.push(jointMesh);2425 }2426 finger.data('boneMeshes', boneMeshes);2427 finger.data('jointMeshes', jointMeshes);2428 });2429})2430.on('handLost', function(hand){2431 hand.fingers.forEach(function (finger) {2432 var boneMeshes = finger.data('boneMeshes');2433 var jointMeshes = finger.data('jointMeshes');2434 boneMeshes.forEach(function(mesh){2435 scene.remove(mesh);2436 });2437 jointMeshes.forEach(function(mesh){2438 scene.remove(mesh);2439 });2440 finger.data({2441 boneMeshes: null,2442 boneMeshes: null2443 });2444 });2445 sessionManager.pressCount == -1;2446 sessionManager.pressed = [];2447 console.log(JSON.stringify(sessionManager.outputTextStream));2448 renderer.render(scene, camera);2449})...

Full Screen

Full Screen

augr-keyboard-tracker.js

Source:augr-keyboard-tracker.js Github

copy

Full Screen

1var colors = [0xff0000, 0x00ff00, 0x0000ff];2var baseBoneRotation = (new THREE.Quaternion).setFromEuler(new THREE.Euler(Math.PI / 2, 0, 0));3var sessionManager = {4 connection: null,5 hand: {6 position: null,7 fistClosed: false,8 lastMove : "hover",9 lastMoveCounter: 3000,10 lastPosition: null,11 inGrasp: []12 },13 pressed: null,14 statusShown: false,15 screenCount: 1,16 outputTextStream: []17};18var objectManager = {19 "letter-q-container": {20 type: "a-entity:a-plane",21 id: "letter-q-container",22 position: "-1 0.5 -3",23 posArray: [24 0,25 0.5,26 -327 ],28 marginArray: [29 -30,30 30,31 30,32 130,33 -100,34 5035 ],36 rotation: "0 0 0",37 color: "gray",38 hoverColor: "#FF0000",39 hovering: false,40 touchColor: "#FF0000",41 touching: false42 },43 "letter-w-container": {44 type: "a-entity:a-plane",45 id: "letter-w-container",46 position: "-1 0.5 -3",47 posArray: [48 0,49 0.5,50 -351 ],52 marginArray: [53 -30,54 30,55 30,56 130,57 -100,58 5059 ],60 rotation: "0 0 0",61 color: "gray",62 hoverColor: "#FF0000",63 hovering: false,64 touchColor: "#FF0000",65 touching: false66 },67 "letter-e-container": {68 type: "a-entity:a-plane",69 id: "letter-e-container",70 position: "-1 0.5 -3",71 posArray: [72 0,73 0.5,74 -375 ],76 marginArray: [77 -30,78 30,79 30,80 130,81 -100,82 5083 ],84 rotation: "0 0 0",85 color: "gray",86 hoverColor: "#FF0000",87 hovering: false,88 touchColor: "#FF0000",89 touching: false90 },91 "letter-r-container": {92 type: "a-entity:a-plane",93 id: "letter-r-container",94 position: "-1 0.5 -3",95 posArray: [96 0,97 0.5,98 -399 ],100 marginArray: [101 -30,102 30,103 30,104 130,105 -100,106 50107 ],108 rotation: "0 0 0",109 color: "gray",110 hoverColor: "#FF0000",111 hovering: false,112 touchColor: "#FF0000",113 touching: false114 },115 "letter-t-container": {116 type: "a-entity:a-plane",117 id: "letter-t-container",118 position: "-1 0.5 -3",119 posArray: [120 0,121 0.5,122 -3123 ],124 marginArray: [125 -30,126 30,127 30,128 130,129 -100,130 50131 ],132 rotation: "0 0 0",133 color: "gray",134 hoverColor: "#FF0000",135 hovering: false,136 touchColor: "#FF0000",137 touching: false138 },139 "letter-y-container": {140 type: "a-entity:a-plane",141 id: "letter-q-container",142 position: "-1 0.5 -3",143 posArray: [144 0,145 0.5,146 -3147 ],148 marginArray: [149 -30,150 30,151 30,152 130,153 -100,154 50155 ],156 rotation: "0 0 0",157 color: "gray",158 hoverColor: "#FF0000",159 hovering: false,160 touchColor: "#FF0000",161 touching: false162 },163 "letter-u-container": {164 type: "a-entity:a-plane",165 id: "letter-q-container",166 position: "-1 0.5 -3",167 posArray: [168 0,169 0.5,170 -3171 ],172 marginArray: [173 -30,174 30,175 30,176 130,177 -100,178 50179 ],180 rotation: "0 0 0",181 color: "gray",182 hoverColor: "#FF0000",183 hovering: false,184 touchColor: "#FF0000",185 touching: false186 },187 "letter-i-container": {188 type: "a-entity:a-plane",189 id: "letter-q-container",190 position: "-1 0.5 -3",191 posArray: [192 0,193 0.5,194 -3195 ],196 marginArray: [197 -30,198 30,199 30,200 130,201 -100,202 50203 ],204 rotation: "0 0 0",205 color: "gray",206 hoverColor: "#FF0000",207 hovering: false,208 touchColor: "#FF0000",209 touching: false210 },211 "letter-o-container": {212 type: "a-entity:a-plane",213 id: "letter-q-container",214 position: "-1 0.5 -3",215 posArray: [216 0,217 0.5,218 -3219 ],220 marginArray: [221 -30,222 30,223 30,224 130,225 -100,226 50227 ],228 rotation: "0 0 0",229 color: "gray",230 hoverColor: "#FF0000",231 hovering: false,232 touchColor: "#FF0000",233 touching: false234 },235 "letter-p-container": {236 type: "a-entity:a-plane",237 id: "letter-q-container",238 position: "-1 0.5 -3",239 posArray: [240 0,241 0.5,242 -3243 ],244 marginArray: [245 -30,246 30,247 30,248 130,249 -100,250 50251 ],252 rotation: "0 0 0",253 color: "gray",254 hoverColor: "#FF0000",255 hovering: false,256 touchColor: "#FF0000",257 touching: false258 },259 "letter-a-container": {260 type: "a-entity:a-plane",261 id: "letter-q-container",262 position: "-1 0.5 -3",263 posArray: [264 0,265 0.5,266 -3267 ],268 marginArray: [269 -30,270 30,271 30,272 130,273 -100,274 50275 ],276 rotation: "0 0 0",277 color: "gray",278 hoverColor: "#FF0000",279 hovering: false,280 touchColor: "#FF0000",281 touching: false282 },283 "letter-s-container": {284 type: "a-entity:a-plane",285 id: "letter-q-container",286 position: "-1 0.5 -3",287 posArray: [288 0,289 0.5,290 -3291 ],292 marginArray: [293 -30,294 30,295 30,296 130,297 -100,298 50299 ],300 rotation: "0 0 0",301 color: "gray",302 hoverColor: "#FF0000",303 hovering: false,304 touchColor: "#FF0000",305 touching: false306 },307 "letter-d-container": {308 type: "a-entity:a-plane",309 id: "letter-q-container",310 position: "-1 0.5 -3",311 posArray: [312 0,313 0.5,314 -3315 ],316 marginArray: [317 -30,318 30,319 30,320 130,321 -100,322 50323 ],324 rotation: "0 0 0",325 color: "gray",326 hoverColor: "#FF0000",327 hovering: false,328 touchColor: "#FF0000",329 touching: false330 },331 "letter-f-container": {332 type: "a-entity:a-plane",333 id: "letter-q-container",334 position: "-1 0.5 -3",335 posArray: [336 0,337 0.5,338 -3339 ],340 marginArray: [341 -30,342 30,343 30,344 130,345 -100,346 50347 ],348 rotation: "0 0 0",349 color: "gray",350 hoverColor: "#FF0000",351 hovering: false,352 touchColor: "#FF0000",353 touching: false354 },355 "letter-g-container": {356 type: "a-entity:a-plane",357 id: "letter-q-container",358 position: "-1 0.5 -3",359 posArray: [360 0,361 0.5,362 -3363 ],364 marginArray: [365 -30,366 30,367 30,368 130,369 -100,370 50371 ],372 rotation: "0 0 0",373 color: "gray",374 hoverColor: "#FF0000",375 hovering: false,376 touchColor: "#FF0000",377 touching: false378 },379 "letter-h-container": {380 type: "a-entity:a-plane",381 id: "letter-q-container",382 position: "-1 0.5 -3",383 posArray: [384 0,385 0.5,386 -3387 ],388 marginArray: [389 -30,390 30,391 30,392 130,393 -100,394 50395 ],396 rotation: "0 0 0",397 color: "gray",398 hoverColor: "#FF0000",399 hovering: false,400 touchColor: "#FF0000",401 touching: false402 },403 "letter-j-container": {404 type: "a-entity:a-plane",405 id: "letter-q-container",406 position: "-1 0.5 -3",407 posArray: [408 0,409 0.5,410 -3411 ],412 marginArray: [413 -30,414 30,415 30,416 130,417 -100,418 50419 ],420 rotation: "0 0 0",421 color: "gray",422 hoverColor: "#FF0000",423 hovering: false,424 touchColor: "#FF0000",425 touching: false426 },427 "letter-k-container": {428 type: "a-entity:a-plane",429 id: "letter-q-container",430 position: "-1 0.5 -3",431 posArray: [432 0,433 0.5,434 -3435 ],436 marginArray: [437 -30,438 30,439 30,440 130,441 -100,442 50443 ],444 rotation: "0 0 0",445 color: "gray",446 hoverColor: "#FF0000",447 hovering: false,448 touchColor: "#FF0000",449 touching: false450 },451 "letter-l-container": {452 type: "a-entity:a-plane",453 id: "letter-q-container",454 position: "-1 0.5 -3",455 posArray: [456 0,457 0.5,458 -3459 ],460 marginArray: [461 -30,462 30,463 30,464 130,465 -100,466 50467 ],468 rotation: "0 0 0",469 color: "gray",470 hoverColor: "#FF0000",471 hovering: false,472 touchColor: "#FF0000",473 touching: false474 },475 "letter-z-container": {476 type: "a-entity:a-plane",477 id: "letter-q-container",478 position: "-1 0.5 -3",479 posArray: [480 0,481 0.5,482 -3483 ],484 marginArray: [485 -30,486 30,487 30,488 130,489 -100,490 50491 ],492 rotation: "0 0 0",493 color: "gray",494 hoverColor: "#FF0000",495 hovering: false,496 touchColor: "#FF0000",497 touching: false498 },499 "letter-x-container": {500 type: "a-entity:a-plane",501 id: "letter-q-container",502 position: "-1 0.5 -3",503 posArray: [504 0,505 0.5,506 -3507 ],508 marginArray: [509 -30,510 30,511 30,512 130,513 -100,514 50515 ],516 rotation: "0 0 0",517 color: "gray",518 hoverColor: "#FF0000",519 hovering: false,520 touchColor: "#FF0000",521 touching: false522 },523 "letter-c-container": {524 type: "a-entity:a-plane",525 id: "letter-q-container",526 position: "-1 0.5 -3",527 posArray: [528 0,529 0.5,530 -3531 ],532 marginArray: [533 -30,534 30,535 30,536 130,537 -100,538 50539 ],540 rotation: "0 0 0",541 color: "gray",542 hoverColor: "#FF0000",543 hovering: false,544 touchColor: "#FF0000",545 touching: false546 },547 "letter-v-container": {548 type: "a-entity:a-plane",549 id: "letter-q-container",550 position: "-1 0.5 -3",551 posArray: [552 0,553 0.5,554 -3555 ],556 marginArray: [557 -30,558 30,559 30,560 130,561 -100,562 50563 ],564 rotation: "0 0 0",565 color: "gray",566 hoverColor: "#FF0000",567 hovering: false,568 touchColor: "#FF0000",569 touching: false570 },571 "letter-b-container": {572 type: "a-entity:a-plane",573 id: "letter-q-container",574 position: "-1 0.5 -3",575 posArray: [576 0,577 0.5,578 -3579 ],580 marginArray: [581 -30,582 30,583 30,584 130,585 -100,586 50587 ],588 rotation: "0 0 0",589 color: "gray",590 hoverColor: "#FF0000",591 hovering: false,592 touchColor: "#FF0000",593 touching: false594 },595 "letter-n-container": {596 type: "a-entity:a-plane",597 id: "letter-q-container",598 position: "-1 0.5 -3",599 posArray: [600 0,601 0.5,602 -3603 ],604 marginArray: [605 -30,606 30,607 30,608 130,609 -100,610 50611 ],612 rotation: "0 0 0",613 color: "gray",614 hoverColor: "#FF0000",615 hovering: false,616 touchColor: "#FF0000",617 touching: false618 },619 "letter-m-container": {620 type: "a-entity:a-plane",621 id: "letter-q-container",622 position: "-1 0.5 -3",623 posArray: [624 0,625 0.5,626 -3627 ],628 marginArray: [629 -30,630 30,631 30,632 130,633 -100,634 50635 ],636 rotation: "0 0 0",637 color: "gray",638 hoverColor: "#FF0000",639 hovering: false,640 touchColor: "#FF0000",641 touching: false642 },643 "punctuation-container": {644 type: "a-entity:a-plane",645 id: "letter-q-container",646 position: "-1 0.5 -3",647 posArray: [648 0,649 0.5,650 -3651 ],652 marginArray: [653 -30,654 30,655 30,656 130,657 -100,658 50659 ],660 rotation: "0 0 0",661 color: "gray",662 hoverColor: "#FF0000",663 hovering: false,664 touchColor: "#FF0000",665 touching: false666 },667 "punctuation-container": {668 type: "a-entity:a-plane",669 id: "letter-q-container",670 position: "-1 0.5 -3",671 posArray: [672 0,673 0.5,674 -3675 ],676 marginArray: [677 -30,678 30,679 30,680 130,681 -100,682 50683 ],684 rotation: "0 0 0",685 color: "gray",686 hoverColor: "#FF0000",687 hovering: false,688 touchColor: "#FF0000",689 touching: false690 },691 "punctuation-container": {692 type: "a-entity:a-plane",693 id: "letter-q-container",694 position: "-1 0.5 -3",695 posArray: [696 0,697 0.5,698 -3699 ],700 marginArray: [701 -30,702 30,703 30,704 130,705 -100,706 50707 ],708 rotation: "0 0 0",709 color: "gray",710 hoverColor: "#FF0000",711 hovering: false,712 touchColor: "#FF0000",713 touching: false714 },715 "punctuation-container": {716 type: "a-entity:a-plane",717 id: "letter-q-container",718 position: "-1 0.5 -3",719 posArray: [720 0,721 0.5,722 -3723 ],724 marginArray: [725 -30,726 30,727 30,728 130,729 -100,730 50731 ],732 rotation: "0 0 0",733 color: "gray",734 hoverColor: "#FF0000",735 hovering: false,736 touchColor: "#FF0000",737 touching: false738 },739 "symbol-container": {740 type: "a-entity:a-plane",741 id: "letter-q-container",742 position: "-1 0.5 -3",743 posArray: [744 0,745 0.5,746 -3747 ],748 marginArray: [749 -30,750 30,751 30,752 130,753 -100,754 50755 ],756 rotation: "0 0 0",757 color: "gray",758 hoverColor: "#FF0000",759 hovering: false,760 touchColor: "#FF0000",761 touching: false762 },763 "symbol-container": {764 type: "a-entity:a-plane",765 id: "letter-q-container",766 position: "-1 0.5 -3",767 posArray: [768 0,769 0.5,770 -3771 ],772 marginArray: [773 -30,774 30,775 30,776 130,777 -100,778 50779 ],780 rotation: "0 0 0",781 color: "gray",782 hoverColor: "#FF0000",783 hovering: false,784 touchColor: "#FF0000",785 touching: false786 }787};788// all units in mm789var initScene = function () {790 window.scene = new THREE.Scene();791 window.renderer = new THREE.WebGLRenderer({792 alpha: true793 });794 window.renderer.setClearColor(0x000000, 0);795 window.renderer.setSize(window.innerWidth, window.innerHeight);796 window.renderer.domElement.style.position = 'absolute';797 window.renderer.domElement.style.zIndex = '100';798 window.renderer.domElement.style.top = 0;799 window.renderer.domElement.style.left = 0;800 window.renderer.domElement.style.width = '100%';801 window.renderer.domElement.style.height = '100%';802 document.body.appendChild(window.renderer.domElement);803 var directionalLight = new THREE.DirectionalLight( 0xffffff, 1 );804 directionalLight.position.set( 0, 0.5, 1 );805 window.scene.add(directionalLight);806 window.camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000);807 window.camera.position.fromArray([0, 100, 500]);808 window.camera.lookAt(new THREE.Vector3(0, 160, 0));809 window.addEventListener('resize', function () {810 camera.aspect = window.innerWidth / window.innerHeight;811 camera.updateProjectionMatrix();812 renderer.setSize(window.innerWidth, window.innerHeight);813 renderer.render(scene, camera);814 }, false);815 scene.add(camera);816 renderer.render(scene, camera);817 setTimeout(function(){818 var viewerTracker = [819 document.getElementById("webcam-0-container"),820 ];821 }, 150);822};823Leap.loop({background: true}, {824 hand: function (hand) {825 hand.fingers.forEach(function (finger) {826 // This is the meat of the example - Positioning `the cylinders on every frame:827 finger.data('boneMeshes').forEach(function(mesh, i){828 var bone = finger.bones[i];829 mesh.position.fromArray(bone.center());830 mesh.setRotationFromMatrix(831 (new THREE.Matrix4).fromArray( bone.matrix() )832 );833 mesh.quaternion.multiply(baseBoneRotation);834 });835 finger.data('jointMeshes').forEach(function(mesh, i){836 var bone = finger.bones[i];837 if (bone) {838 mesh.position.fromArray(bone.prevJoint);839 }840 else{841 // special case for the finger tip joint sphere:842 bone = finger.bones[i-1];843 mesh.position.fromArray(bone.nextJoint);844 }845 });846 });847 sessionManager.hand.position = hand.palmPosition;848 // range test849 if(sessionManager.hand.lastPosition==null){850 sessionManager.hand.lastPosition = [];851 sessionManager.hand.lastPosition.push(sessionManager.hand.position[0]);852 sessionManager.hand.lastPosition.push(sessionManager.hand.position[1]);853 sessionManager.hand.lastPosition.push(sessionManager.hand.position[2]);854 }855 let obj = objectManager;856 if(sessionManager.pressed==null){857 sessionManager.pressed = [];858 sessionManager.pressCount == -1;859 }860 if(hand.indexFinger.extended){861 let indexPos = hand.indexFinger.distal.center();862 if(indexPos[0]>120&&indexPos[0]<155&&indexPos[1]>195&&indexPos[1]<220){863 //console.log("delete");864 sessionManager.pressed.push("delete", sessionManager.pressCount);865 if(sessionManager.pressed.indexOf("delete")>-1){866 document.getElementById("system-delete-container").setAttribute("material", "color", "white");867 document.getElementById("system-delete-container").setAttribute("text", "color", "black");868 console.log("holding down delete");869 if(sessionManager.pressCount==null){870 sessionManager.pressCount = -1;871 }872 else if(sessionManager.pressCount >= -1){873 sessionManager.pressCount++;874 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){ /* approximately 25 cycles per 1000 ms */875 console.log("pressed delete");876 document.getElementById("system-delete-container").setAttribute("material", "color", "red");877 document.getElementById("system-delete-container").setAttribute("text", "color", "white");878 if(sessionManager.pressCount==26){879 if(sessionManager.outputTextStream.length>0){880 sessionManager.outputTextStream.pop();881 }882 let textStream = ""883 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){884 (function(){885 textStream+=sessionManager.outputTextStream[streamSize];886 })();887 }888 document.getElementById("output-display-container").setAttribute("text", "value", textStream);889 }890 }891 if(sessionManager.pressCount>75){892 console.log("long pressed P");893 document.getElementById("letter-p-container").setAttribute("material", "color", "orange");894 document.getElementById("letter-p-container").setAttribute("text", "color", "black");895 }896 }897 }898 }899 else if(indexPos[0]>95&&indexPos[0]<115&&indexPos[1]>195&&indexPos[1]<220){900 //console.log("P");901 sessionManager.pressed.push("P", sessionManager.pressCount);902 if(sessionManager.pressed.indexOf("P")>-1){903 document.getElementById("letter-p-container").setAttribute("material", "color", "white");904 document.getElementById("letter-p-container").setAttribute("text", "color", "black");905 console.log("holding down P");906 if(sessionManager.pressCount==null){907 sessionManager.pressCount = -1;908 }909 else if(sessionManager.pressCount >= -1){910 sessionManager.pressCount++;911 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){ /* approximately 25 cycles per 1000 ms */912 console.log("pressed P");913 document.getElementById("letter-p-container").setAttribute("material", "color", "red");914 document.getElementById("letter-p-container").setAttribute("text", "color", "white");915 if(sessionManager.pressCount==26){916 sessionManager.outputTextStream.push("P");917 let textStream = ""918 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){919 (function(){920 textStream+=sessionManager.outputTextStream[streamSize];921 })();922 }923 document.getElementById("output-display-container").setAttribute("text", "value", textStream);924 }925 }926 if(sessionManager.pressCount>75){927 console.log("long pressed P");928 document.getElementById("letter-p-container").setAttribute("material", "color", "orange");929 document.getElementById("letter-p-container").setAttribute("text", "color", "black");930 }931 }932 }933 }934 else if(indexPos[0]>65&&indexPos[0]<90&&indexPos[1]>190&&indexPos[1]<220){935 //console.log("O");936 sessionManager.pressed.push("O");937 if(sessionManager.pressed.indexOf("O")>-1){938 document.getElementById("letter-o-container").setAttribute("material", "color", "white");939 document.getElementById("letter-o-container").setAttribute("text", "color", "black");940 console.log("holding down O");941 if(sessionManager.pressCount==null){942 sessionManager.pressCount = -1;943 }944 else if(sessionManager.pressCount >= -1){945 sessionManager.pressCount++;946 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){947 console.log("pressed O");948 document.getElementById("letter-o-container").setAttribute("material", "color", "red");949 document.getElementById("letter-o-container").setAttribute("text", "color", "white");950 if(sessionManager.pressCount==26){951 sessionManager.outputTextStream.push("O");952 let textStream = ""953 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){954 (function(){955 textStream+=sessionManager.outputTextStream[streamSize];956 })();957 }958 document.getElementById("output-display-container").setAttribute("text", "value", textStream);959 }960 }961 if(sessionManager.pressCount>75){962 console.log("long pressed O");963 document.getElementById("letter-o-container").setAttribute("material", "color", "orange");964 document.getElementById("letter-o-container").setAttribute("text", "color", "black");965 }966 }967 }968 }969 else if(indexPos[0]>40&&indexPos[0]<60&&indexPos[1]>190&&indexPos[1]<220){970 //console.log("I");971 sessionManager.pressed.push("I");972 if(sessionManager.pressed.indexOf("I")>-1){973 document.getElementById("letter-i-container").setAttribute("material", "color", "white");974 document.getElementById("letter-i-container").setAttribute("text", "color", "black");975 console.log("holding down I");976 if(sessionManager.pressCount==null){977 sessionManager.pressCount = -1;978 }979 else if(sessionManager.pressCount >= -1){980 sessionManager.pressCount++;981 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){982 console.log("pressed I");983 document.getElementById("letter-i-container").setAttribute("material", "color", "red");984 document.getElementById("letter-i-container").setAttribute("text", "color", "white");985 if(sessionManager.pressCount==26){986 sessionManager.outputTextStream.push("I");987 let textStream = ""988 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){989 (function(){990 textStream+=sessionManager.outputTextStream[streamSize];991 })();992 }993 document.getElementById("output-display-container").setAttribute("text", "value", textStream);994 }995 }996 if(sessionManager.pressCount>75){997 console.log("long pressed I");998 document.getElementById("letter-i-container").setAttribute("material", "color", "orange");999 document.getElementById("letter-i-container").setAttribute("text", "color", "black");1000 }1001 }1002 }1003 }1004 else if(indexPos[0]>15&&indexPos[0]<35&&indexPos[1]>190&&indexPos[1]<220){1005 // console.log("U");1006 sessionManager.pressed.push("U");1007 if(sessionManager.pressed.indexOf("U")>-1){1008 document.getElementById("letter-u-container").setAttribute("material", "color", "white");1009 document.getElementById("letter-u-container").setAttribute("text", "color", "black");1010 console.log("holding down U");1011 if(sessionManager.pressCount==null){1012 sessionManager.pressCount = -1;1013 }1014 else if(sessionManager.pressCount >= -1){1015 sessionManager.pressCount++;1016 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1017 console.log("pressed U");1018 document.getElementById("letter-u-container").setAttribute("material", "color", "red");1019 document.getElementById("letter-u-container").setAttribute("text", "color", "white");1020 if(sessionManager.pressCount==26){1021 sessionManager.outputTextStream.push("U");1022 let textStream = ""1023 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1024 (function(){1025 textStream+=sessionManager.outputTextStream[streamSize];1026 })();1027 }1028 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1029 }1030 }1031 if(sessionManager.pressCount>75){1032 console.log("long pressed U");1033 document.getElementById("letter-u-container").setAttribute("material", "color", "orange");1034 document.getElementById("letter-u-container").setAttribute("text", "color", "black");1035 }1036 }1037 }1038 }1039 else if(indexPos[0]>-12&&indexPos[0]<10&&indexPos[1]>190&&indexPos[1]<220){1040 // console.log("Y");1041 sessionManager.pressed.push("Y");1042 if(sessionManager.pressed.indexOf("Y")>-1){1043 document.getElementById("letter-y-container").setAttribute("material", "color", "white");1044 document.getElementById("letter-y-container").setAttribute("text", "color", "black");1045 console.log("holding down Y");1046 if(sessionManager.pressCount==null){1047 sessionManager.pressCount = -1;1048 }1049 else if(sessionManager.pressCount >= -1){1050 sessionManager.pressCount++;1051 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1052 console.log("pressed Y");1053 document.getElementById("letter-y-container").setAttribute("material", "color", "red");1054 document.getElementById("letter-y-container").setAttribute("text", "color", "white");1055 if(sessionManager.pressCount==26){1056 sessionManager.outputTextStream.push("Y");1057 let textStream = ""1058 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1059 (function(){1060 textStream+=sessionManager.outputTextStream[streamSize];1061 })();1062 }1063 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1064 }1065 }1066 if(sessionManager.pressCount>75){1067 console.log("long pressed Y");1068 document.getElementById("letter-y-container").setAttribute("material", "color", "orange");1069 document.getElementById("letter-y-container").setAttribute("text", "color", "black");1070 }1071 }1072 }1073 }1074 else if(indexPos[0]>-43&&indexPos[0]<-17&&indexPos[1]>190&&indexPos[1]<220){1075 // console.log("T");1076 sessionManager.pressed.push("T");1077 if(sessionManager.pressed.indexOf("T")>-1){1078 document.getElementById("letter-t-container").setAttribute("material", "color", "white");1079 document.getElementById("letter-t-container").setAttribute("text", "color", "black");1080 console.log("holding down T");1081 if(sessionManager.pressCount==null){1082 sessionManager.pressCount = -1;1083 }1084 else if(sessionManager.pressCount >= -1){1085 sessionManager.pressCount++;1086 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1087 console.log("pressed T");1088 document.getElementById("letter-t-container").setAttribute("material", "color", "red");1089 document.getElementById("letter-t-container").setAttribute("text", "color", "white");1090 if(sessionManager.pressCount==26){1091 sessionManager.outputTextStream.push("T");1092 let textStream = ""1093 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1094 (function(){1095 textStream+=sessionManager.outputTextStream[streamSize];1096 })();1097 }1098 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1099 }1100 }1101 if(sessionManager.pressCount>75){1102 console.log("long pressed T");1103 document.getElementById("letter-t-container").setAttribute("material", "color", "orange");1104 document.getElementById("letter-t-container").setAttribute("text", "color", "black");1105 }1106 }1107 }1108 }1109 else if(indexPos[0]>-70&&indexPos[0]<-48&&indexPos[1]>190&&indexPos[1]<220){1110 // console.log("R");1111 sessionManager.pressed.push("R");1112 if(sessionManager.pressed.indexOf("R")>-1){1113 document.getElementById("letter-r-container").setAttribute("material", "color", "white");1114 document.getElementById("letter-r-container").setAttribute("text", "color", "black");1115 console.log("holding down R");1116 if(sessionManager.pressCount==null){1117 sessionManager.pressCount = -1;1118 }1119 else if(sessionManager.pressCount >= -1){1120 sessionManager.pressCount++;1121 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1122 console.log("pressed R");1123 document.getElementById("letter-r-container").setAttribute("material", "color", "red");1124 document.getElementById("letter-r-container").setAttribute("text", "color", "white");1125 if(sessionManager.pressCount==26){1126 sessionManager.outputTextStream.push("R");1127 let textStream = ""1128 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1129 (function(){1130 textStream+=sessionManager.outputTextStream[streamSize];1131 })();1132 }1133 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1134 }1135 }1136 if(sessionManager.pressCount>75){1137 console.log("long pressed R");1138 document.getElementById("letter-r-container").setAttribute("material", "color", "orange");1139 document.getElementById("letter-r-container").setAttribute("text", "color", "black");1140 }1141 }1142 }1143 }1144 else if(indexPos[0]>-95&&indexPos[0]<-75&&indexPos[1]>190&&indexPos[1]<220){1145 // console.log("E");1146 sessionManager.pressed.push("E");1147 if(sessionManager.pressed.indexOf("E")>-1){1148 document.getElementById("letter-e-container").setAttribute("material", "color", "white");1149 document.getElementById("letter-e-container").setAttribute("text", "color", "black");1150 console.log("holding down E");1151 if(sessionManager.pressCount==null){1152 sessionManager.pressCount = -1;1153 }1154 else if(sessionManager.pressCount >= -1){1155 sessionManager.pressCount++;1156 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1157 console.log("pressed E");1158 document.getElementById("letter-e-container").setAttribute("material", "color", "red");1159 document.getElementById("letter-e-container").setAttribute("text", "color", "white");1160 if(sessionManager.pressCount==26){1161 sessionManager.outputTextStream.push("E");1162 let textStream = ""1163 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1164 (function(){1165 textStream+=sessionManager.outputTextStream[streamSize];1166 })();1167 }1168 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1169 }1170 }1171 if(sessionManager.pressCount>75){1172 console.log("long pressed E");1173 document.getElementById("letter-e-container").setAttribute("material", "color", "orange");1174 document.getElementById("letter-e-container").setAttribute("text", "color", "black");1175 }1176 }1177 }1178 }1179 else if(indexPos[0]>-130&&indexPos[0]<-105&&indexPos[1]>190&&indexPos[1]<220){1180 // console.log("W");1181 sessionManager.pressed.push("W");1182 if(sessionManager.pressed.indexOf("W")>-1){1183 document.getElementById("letter-w-container").setAttribute("material", "color", "white");1184 document.getElementById("letter-w-container").setAttribute("text", "color", "black");1185 console.log("holding down W");1186 if(sessionManager.pressCount==null){1187 sessionManager.pressCount = -1;1188 }1189 else if(sessionManager.pressCount >= -1){1190 sessionManager.pressCount++;1191 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1192 console.log("pressed W");1193 document.getElementById("letter-w-container").setAttribute("material", "color", "red");1194 document.getElementById("letter-w-container").setAttribute("text", "color", "white");1195 if(sessionManager.pressCount==26){1196 sessionManager.outputTextStream.push("W");1197 let textStream = ""1198 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1199 (function(){1200 textStream+=sessionManager.outputTextStream[streamSize];1201 })();1202 }1203 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1204 }1205 }1206 if(sessionManager.pressCount>75){1207 console.log("long pressed W");1208 document.getElementById("letter-w-container").setAttribute("material", "color", "orange");1209 document.getElementById("letter-w-container").setAttribute("text", "color", "black");1210 }1211 }1212 }1213 }1214 else if(indexPos[0]>-155&&indexPos[0]<-135&&indexPos[1]>190&&indexPos[1]<220){1215 //console.log("Q");1216 sessionManager.pressed.push("Q");1217 if(sessionManager.pressed.indexOf("Q")>-1){1218 document.getElementById("letter-q-container").setAttribute("material", "color", "white");1219 document.getElementById("letter-q-container").setAttribute("text", "color", "black");1220 console.log("holding down Q");1221 if(sessionManager.pressCount==null){1222 sessionManager.pressCount = -1;1223 }1224 else if(sessionManager.pressCount >= -1){1225 sessionManager.pressCount++;1226 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1227 console.log("pressed Q");1228 document.getElementById("letter-q-container").setAttribute("material", "color", "red");1229 document.getElementById("letter-q-container").setAttribute("text", "color", "white");1230 if(sessionManager.pressCount==26){1231 sessionManager.outputTextStream.push("Q");1232 let textStream = ""1233 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1234 (function(){1235 textStream+=sessionManager.outputTextStream[streamSize];1236 })();1237 }1238 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1239 }1240 }1241 if(sessionManager.pressCount>75){1242 console.log("long pressed Q");1243 document.getElementById("letter-q-container").setAttribute("material", "color", "orange");1244 document.getElementById("letter-q-container").setAttribute("text", "color", "black");1245 }1246 }1247 }1248 }1249 else if(indexPos[0]>-195&&indexPos[0]<-160&&indexPos[1]>190&&indexPos[1]<220){1250 //console.log("tab");1251 sessionManager.pressed.push("tab");1252 if(sessionManager.pressed.indexOf("tab")>-1){1253 document.getElementById("system-tab-container").setAttribute("material", "color", "white");1254 document.getElementById("system-tab-container").setAttribute("text", "color", "black");1255 console.log("holding down tab");1256 if(sessionManager.pressCount==null){1257 sessionManager.pressCount = -1;1258 }1259 else if(sessionManager.pressCount >= -1){1260 sessionManager.pressCount++;1261 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1262 console.log("pressed tab");1263 document.getElementById("system-tab-container").setAttribute("material", "color", "red");1264 document.getElementById("system-tab-container").setAttribute("text", "color", "white");1265 if(sessionManager.pressCount==26){1266 sessionManager.outputTextStream.push("tab");1267 }1268 }1269 if(sessionManager.pressCount>75){1270 console.log("long pressed tab");1271 document.getElementById("system-tab-container").setAttribute("material", "color", "orange");1272 document.getElementById("system-tab-container").setAttribute("text", "color", "black");1273 }1274 }1275 }1276 }1277 else if(indexPos[0]>95&&indexPos[0]<115&&indexPos[1]>165&&indexPos[1]<180){1278 //console.log(":");1279 sessionManager.pressed.push(":");1280 if(sessionManager.pressed.indexOf(":")>-1){1281 document.getElementById("punctuation-colon-container").setAttribute("material", "color", "white");1282 document.getElementById("punctuation-colon-container").setAttribute("text", "color", "black");1283 console.log("holding down :");1284 if(sessionManager.pressCount==null){1285 sessionManager.pressCount = -1;1286 }1287 else if(sessionManager.pressCount >= -1){1288 sessionManager.pressCount++;1289 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1290 console.log("pressed :");1291 document.getElementById("punctuation-colon-container").setAttribute("material", "color", "red");1292 document.getElementById("punctuation-colon-container").setAttribute("text", "color", "white");1293 if(sessionManager.pressCount==26){1294 sessionManager.outputTextStream.push(":");1295 let textStream = ""1296 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1297 (function(){1298 textStream+=sessionManager.outputTextStream[streamSize];1299 })();1300 }1301 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1302 }1303 }1304 if(sessionManager.pressCount>75){1305 console.log("long pressed :");1306 document.getElementById("punctuation-colon-container").setAttribute("material", "color", "orange");1307 document.getElementById("punctuation-colon-container").setAttribute("text", "color", "black");1308 }1309 }1310 }1311 }1312 else if(indexPos[0]>65&&indexPos[0]<90&&indexPos[1]>165&&indexPos[1]<180){1313 //console.log("L");1314 sessionManager.pressed.push("L");1315 if(sessionManager.pressed.indexOf("L")>-1){1316 document.getElementById("letter-l-container").setAttribute("material", "color", "white");1317 document.getElementById("letter-l-container").setAttribute("text", "color", "black");1318 console.log("holding down L");1319 if(sessionManager.pressCount==null){1320 sessionManager.pressCount = -1;1321 }1322 else if(sessionManager.pressCount >= -1){1323 sessionManager.pressCount++;1324 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1325 console.log("pressed L");1326 document.getElementById("letter-l-container").setAttribute("material", "color", "red");1327 document.getElementById("letter-l-container").setAttribute("text", "color", "white");1328 if(sessionManager.pressCount==26){1329 sessionManager.outputTextStream.push("L");1330 let textStream = ""1331 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1332 (function(){1333 textStream+=sessionManager.outputTextStream[streamSize];1334 })();1335 }1336 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1337 }1338 }1339 if(sessionManager.pressCount>75){1340 console.log("long pressed L");1341 document.getElementById("letter-l-container").setAttribute("material", "color", "orange");1342 document.getElementById("letter-l-container").setAttribute("text", "color", "black");1343 }1344 }1345 }1346 }1347 else if(indexPos[0]>40&&indexPos[0]<60&&indexPos[1]>165&&indexPos[1]<180){1348 // console.log("K");1349 sessionManager.pressed.push("K");1350 if(sessionManager.pressed.indexOf("K")>-1){1351 document.getElementById("letter-k-container").setAttribute("material", "color", "white");1352 document.getElementById("letter-k-container").setAttribute("text", "color", "black");1353 console.log("holding down K");1354 if(sessionManager.pressCount==null){1355 sessionManager.pressCount = -1;1356 }1357 else if(sessionManager.pressCount >= -1){1358 sessionManager.pressCount++;1359 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1360 console.log("pressed K");1361 document.getElementById("letter-k-container").setAttribute("material", "color", "red");1362 document.getElementById("letter-k-container").setAttribute("text", "color", "white");1363 if(sessionManager.pressCount==26){1364 sessionManager.outputTextStream.push("K");1365 let textStream = ""1366 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1367 (function(){1368 textStream+=sessionManager.outputTextStream[streamSize];1369 })();1370 }1371 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1372 }1373 }1374 if(sessionManager.pressCount>75){1375 console.log("long pressed K");1376 document.getElementById("letter-k-container").setAttribute("material", "color", "orange");1377 document.getElementById("letter-k-container").setAttribute("text", "color", "black");1378 }1379 }1380 }1381 }1382 else if(indexPos[0]>15&&indexPos[0]<35&&indexPos[1]>165&&indexPos[1]<180){1383 //console.log("J");1384 sessionManager.pressed.push("J");1385 if(sessionManager.pressed.indexOf("J")>-1){1386 document.getElementById("letter-j-container").setAttribute("material", "color", "white");1387 document.getElementById("letter-j-container").setAttribute("text", "color", "black");1388 console.log("holding down J");1389 if(sessionManager.pressCount==null){1390 sessionManager.pressCount = -1;1391 }1392 else if(sessionManager.pressCount >= -1){1393 sessionManager.pressCount++;1394 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1395 console.log("pressed J");1396 document.getElementById("letter-j-container").setAttribute("material", "color", "red");1397 document.getElementById("letter-j-container").setAttribute("text", "color", "white");1398 if(sessionManager.pressCount==26){1399 sessionManager.outputTextStream.push("J");1400 let textStream = ""1401 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1402 (function(){1403 textStream+=sessionManager.outputTextStream[streamSize];1404 })();1405 }1406 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1407 }1408 }1409 if(sessionManager.pressCount>75){1410 console.log("long pressed J");1411 document.getElementById("letter-j-container").setAttribute("material", "color", "orange");1412 document.getElementById("letter-j-container").setAttribute("text", "color", "black");1413 }1414 }1415 }1416 }1417 else if(indexPos[0]>-12&&indexPos[0]<10&&indexPos[1]>165&&indexPos[1]<180){1418 //console.log("H");1419 sessionManager.pressed.push("H");1420 if(sessionManager.pressed.indexOf("H")>-1){1421 document.getElementById("letter-h-container").setAttribute("material", "color", "white");1422 document.getElementById("letter-h-container").setAttribute("text", "color", "black");1423 console.log("holding down H");1424 if(sessionManager.pressCount==null){1425 sessionManager.pressCount = -1;1426 }1427 else if(sessionManager.pressCount >= -1){1428 sessionManager.pressCount++;1429 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1430 console.log("pressed H");1431 document.getElementById("letter-h-container").setAttribute("material", "color", "red");1432 document.getElementById("letter-h-container").setAttribute("text", "color", "white");1433 if(sessionManager.pressCount==26){1434 sessionManager.outputTextStream.push("H");1435 let textStream = ""1436 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1437 (function(){1438 textStream+=sessionManager.outputTextStream[streamSize];1439 })();1440 }1441 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1442 }1443 }1444 if(sessionManager.pressCount>75){1445 console.log("long pressed H");1446 document.getElementById("letter-h-container").setAttribute("material", "color", "orange");1447 document.getElementById("letter-h-container").setAttribute("text", "color", "black");1448 }1449 }1450 }1451 }1452 else if(indexPos[0]>-43&&indexPos[0]<-17&&indexPos[1]>165&&indexPos[1]<180){1453 //console.log("G");1454 sessionManager.pressed.push("G");1455 if(sessionManager.pressed.indexOf("G")>-1){1456 document.getElementById("letter-g-container").setAttribute("material", "color", "white");1457 document.getElementById("letter-g-container").setAttribute("text", "color", "black");1458 console.log("holding down G");1459 if(sessionManager.pressCount==null){1460 sessionManager.pressCount = -1;1461 }1462 else if(sessionManager.pressCount >= -1){1463 sessionManager.pressCount++;1464 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1465 console.log("pressed G");1466 document.getElementById("letter-g-container").setAttribute("material", "color", "red");1467 document.getElementById("letter-g-container").setAttribute("text", "color", "white");1468 if(sessionManager.pressCount==26){1469 sessionManager.outputTextStream.push("G");1470 let textStream = ""1471 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1472 (function(){1473 textStream+=sessionManager.outputTextStream[streamSize];1474 })();1475 }1476 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1477 }1478 }1479 if(sessionManager.pressCount>75){1480 console.log("long pressed G");1481 document.getElementById("letter-g-container").setAttribute("material", "color", "orange");1482 document.getElementById("letter-g-container").setAttribute("text", "color", "black");1483 }1484 }1485 }1486 }1487 else if(indexPos[0]>-70&&indexPos[0]<-48&&indexPos[1]>165&&indexPos[1]<180){1488 // console.log("F");1489 sessionManager.pressed.push("F");1490 if(sessionManager.pressed.indexOf("F")>-1){1491 document.getElementById("letter-f-container").setAttribute("material", "color", "white");1492 document.getElementById("letter-f-container").setAttribute("text", "color", "black");1493 console.log("holding down F");1494 if(sessionManager.pressCount==null){1495 sessionManager.pressCount = -1;1496 }1497 else if(sessionManager.pressCount >= -1){1498 sessionManager.pressCount++;1499 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1500 console.log("pressed F");1501 document.getElementById("letter-f-container").setAttribute("material", "color", "red");1502 document.getElementById("letter-f-container").setAttribute("text", "color", "white");1503 if(sessionManager.pressCount==26){1504 sessionManager.outputTextStream.push("F");1505 let textStream = ""1506 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1507 (function(){1508 textStream+=sessionManager.outputTextStream[streamSize];1509 })();1510 }1511 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1512 }1513 }1514 if(sessionManager.pressCount>75){1515 console.log("long pressed F");1516 document.getElementById("letter-f-container").setAttribute("material", "color", "orange");1517 document.getElementById("letter-f-container").setAttribute("text", "color", "black");1518 }1519 }1520 }1521 }1522 else if(indexPos[0]>-95&&indexPos[0]<-75&&indexPos[1]>165&&indexPos[1]<180){1523 // console.log("D");1524 sessionManager.pressed.push("D");1525 if(sessionManager.pressed.indexOf("D")>-1){1526 document.getElementById("letter-d-container").setAttribute("material", "color", "white");1527 document.getElementById("letter-d-container").setAttribute("text", "color", "black");1528 console.log("holding down D");1529 if(sessionManager.pressCount==null){1530 sessionManager.pressCount = -1;1531 }1532 else if(sessionManager.pressCount >= -1){1533 sessionManager.pressCount++;1534 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1535 console.log("pressed D");1536 document.getElementById("letter-d-container").setAttribute("material", "color", "red");1537 document.getElementById("letter-d-container").setAttribute("text", "color", "white");1538 if(sessionManager.pressCount==26){1539 sessionManager.outputTextStream.push("D");1540 let textStream = ""1541 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1542 (function(){1543 textStream+=sessionManager.outputTextStream[streamSize];1544 })();1545 }1546 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1547 }1548 }1549 if(sessionManager.pressCount>75){1550 console.log("long pressed D");1551 document.getElementById("letter-d-container").setAttribute("material", "color", "orange");1552 document.getElementById("letter-d-container").setAttribute("text", "color", "black");1553 }1554 }1555 }1556 }1557 else if(indexPos[0]>-130&&indexPos[0]<-105&&indexPos[1]>165&&indexPos[1]<180){1558 // console.log("S");1559 sessionManager.pressed.push("S");1560 if(sessionManager.pressed.indexOf("S")>-1){1561 document.getElementById("letter-s-container").setAttribute("material", "color", "white");1562 document.getElementById("letter-s-container").setAttribute("text", "color", "black");1563 console.log("holding down S");1564 if(sessionManager.pressCount==null){1565 sessionManager.pressCount = -1;1566 }1567 else if(sessionManager.pressCount >= -1){1568 sessionManager.pressCount++;1569 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1570 console.log("pressed S");1571 document.getElementById("letter-s-container").setAttribute("material", "color", "red");1572 document.getElementById("letter-s-container").setAttribute("text", "color", "white");1573 if(sessionManager.pressCount==26){1574 sessionManager.outputTextStream.push("S");1575 let textStream = ""1576 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1577 (function(){1578 textStream+=sessionManager.outputTextStream[streamSize];1579 })();1580 }1581 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1582 }1583 }1584 if(sessionManager.pressCount>75){1585 console.log("long pressed S");1586 document.getElementById("letter-s-container").setAttribute("material", "color", "orange");1587 document.getElementById("letter-s-container").setAttribute("text", "color", "black");1588 }1589 }1590 }1591 }1592 else if(indexPos[0]>-155&&indexPos[0]<-135&&indexPos[1]>165&&indexPos[1]<180){1593 // console.log("A");1594 sessionManager.pressed.push("A");1595 if(sessionManager.pressed.indexOf("A")>-1){1596 document.getElementById("letter-a-container").setAttribute("material", "color", "white");1597 document.getElementById("letter-a-container").setAttribute("text", "color", "black");1598 console.log("holding down A");1599 if(sessionManager.pressCount==null){1600 sessionManager.pressCount = -1;1601 }1602 else if(sessionManager.pressCount >= -1){1603 sessionManager.pressCount++;1604 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1605 console.log("pressed A");1606 document.getElementById("letter-a-container").setAttribute("material", "color", "red");1607 document.getElementById("letter-a-container").setAttribute("text", "color", "white");1608 if(sessionManager.pressCount==26){1609 sessionManager.outputTextStream.push("A");1610 let textStream = ""1611 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1612 (function(){1613 textStream+=sessionManager.outputTextStream[streamSize];1614 })();1615 }1616 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1617 }1618 }1619 if(sessionManager.pressCount>75){1620 console.log("long pressed A");1621 document.getElementById("letter-a-container").setAttribute("material", "color", "orange");1622 document.getElementById("letter-a-container").setAttribute("text", "color", "black");1623 }1624 }1625 }1626 }1627 else if(indexPos[0]>-195&&indexPos[0]<-160&&indexPos[1]>165&&indexPos[1]<180){1628 console.log("caps lock");1629 sessionManager.pressed.push("caps-lock");1630 if(sessionManager.pressed.indexOf("caps-lock")>-1){1631 document.getElementById("system-capslock-container").setAttribute("material", "color", "white");1632 document.getElementById("system-capslock-container").setAttribute("text", "color", "black");1633 console.log("holding down caps lock");1634 if(sessionManager.pressCount==null){1635 sessionManager.pressCount = -1;1636 }1637 else if(sessionManager.pressCount >= -1){1638 sessionManager.pressCount++;1639 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1640 console.log("pressed caps lock");1641 document.getElementById("system-capslock-container").setAttribute("material", "color", "red");1642 document.getElementById("system-capslock-container").setAttribute("text", "color", "white");1643 if(sessionManager.pressCount==26){1644 console.log("caps lock effect");1645 }1646 }1647 if(sessionManager.pressCount>75){1648 console.log("long pressed caps lock");1649 document.getElementById("system-capslock-container").setAttribute("material", "color", "orange");1650 document.getElementById("system-capslock-container").setAttribute("text", "color", "black");1651 }1652 }1653 }1654 }1655 else if(indexPos[0]>95&&indexPos[0]<115&&indexPos[1]>135&&indexPos[1]<160){1656 //console.log(":");1657 sessionManager.pressed.push("?");1658 if(sessionManager.pressed.indexOf("?")>-1){1659 document.getElementById("punctuation-question-container").setAttribute("material", "color", "white");1660 document.getElementById("punctuation-question-container").setAttribute("text", "color", "black");1661 console.log("holding down ?");1662 if(sessionManager.pressCount==null){1663 sessionManager.pressCount = -1;1664 }1665 else if(sessionManager.pressCount >= -1){1666 sessionManager.pressCount++;1667 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1668 console.log("pressed ?");1669 document.getElementById("punctuation-question-container").setAttribute("material", "color", "red");1670 document.getElementById("punctuation-question-container").setAttribute("text", "color", "white");1671 if(sessionManager.pressCount==26){1672 sessionManager.outputTextStream.push("?");1673 let textStream = ""1674 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1675 (function(){1676 textStream+=sessionManager.outputTextStream[streamSize];1677 })();1678 }1679 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1680 }1681 }1682 if(sessionManager.pressCount>75){1683 console.log("long pressed ?");1684 document.getElementById("punctuation-question-container").setAttribute("material", "color", "orange");1685 document.getElementById("punctuation-question-container").setAttribute("text", "color", "black");1686 }1687 }1688 }1689 }1690 else if(indexPos[0]>65&&indexPos[0]<90&&indexPos[1]>135&&indexPos[1]<160){1691 //console.log("greater than");1692 sessionManager.pressed.push("greater-than");1693 if(sessionManager.pressed.indexOf("greater-than")>-1){1694 document.getElementById("symbol-greaterthan-container").setAttribute("material", "color", "white");1695 document.getElementById("symbol-greaterthan-container").setAttribute("text", "color", "black");1696 console.log("holding down greater than|period");1697 if(sessionManager.pressCount==null){1698 sessionManager.pressCount = -1;1699 }1700 else if(sessionManager.pressCount >= -1){1701 sessionManager.pressCount++;1702 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1703 console.log("pressed >|.");1704 document.getElementById("symbol-greaterthan-container").setAttribute("material", "color", "red");1705 document.getElementById("symbol-greaterthan-container").setAttribute("text", "color", "white");1706 if(sessionManager.pressCount==26){1707 sessionManager.outputTextStream.push(">");1708 let textStream = ""1709 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1710 (function(){1711 textStream+=sessionManager.outputTextStream[streamSize];1712 })();1713 }1714 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1715 }1716 }1717 if(sessionManager.pressCount>75){1718 console.log("long pressed >|.");1719 document.getElementById("symbol-greaterthan-container").setAttribute("material", "color", "orange");1720 document.getElementById("symbol-greaterthan-container").setAttribute("text", "color", "black");1721 }1722 }1723 }1724 }1725 else if(indexPos[0]>40&&indexPos[0]<60&&indexPos[1]>135&&indexPos[1]<160){1726 // console.log("less than");1727 sessionManager.pressed.push("less-than");1728 if(sessionManager.pressed.indexOf("less-than")>-1){1729 document.getElementById("symbol-lessthan-container").setAttribute("material", "color", "white");1730 document.getElementById("symbol-lessthan-container").setAttribute("text", "color", "black");1731 console.log("holding down less than|comma");1732 if(sessionManager.pressCount==null){1733 sessionManager.pressCount = -1;1734 }1735 else if(sessionManager.pressCount >= -1){1736 sessionManager.pressCount++;1737 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1738 console.log("pressed <|,");1739 document.getElementById("symbol-lessthan-container").setAttribute("material", "color", "red");1740 document.getElementById("symbol-lessthan-container").setAttribute("text", "color", "white");1741 if(sessionManager.pressCount==26){1742 sessionManager.outputTextStream.push("<");1743 let textStream = ""1744 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1745 (function(){1746 textStream+=sessionManager.outputTextStream[streamSize];1747 })();1748 }1749 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1750 }1751 }1752 if(sessionManager.pressCount>75){1753 console.log("long pressed <|,");1754 document.getElementById("symbol-lessthan-container").setAttribute("material", "color", "orange");1755 document.getElementById("symbol-lessthan-container").setAttribute("text", "color", "black");1756 }1757 }1758 }1759 }1760 else if(indexPos[0]>15&&indexPos[0]<35&&indexPos[1]>135&&indexPos[1]<160){1761 //console.log("M");1762 sessionManager.pressed.push("M");1763 if(sessionManager.pressed.indexOf("M")>-1){1764 document.getElementById("letter-m-container").setAttribute("material", "color", "white");1765 document.getElementById("letter-m-container").setAttribute("text", "color", "black");1766 console.log("holding down M");1767 if(sessionManager.pressCount==null){1768 sessionManager.pressCount = -1;1769 }1770 else if(sessionManager.pressCount >= -1){1771 sessionManager.pressCount++;1772 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1773 console.log("pressed M");1774 document.getElementById("letter-m-container").setAttribute("material", "color", "red");1775 document.getElementById("letter-m-container").setAttribute("text", "color", "white");1776 if(sessionManager.pressCount==26){1777 sessionManager.outputTextStream.push("M");1778 let textStream = ""1779 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1780 (function(){1781 textStream+=sessionManager.outputTextStream[streamSize];1782 })();1783 }1784 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1785 }1786 }1787 if(sessionManager.pressCount>75){1788 console.log("long pressed M");1789 document.getElementById("letter-m-container").setAttribute("material", "color", "orange");1790 document.getElementById("letter-m-container").setAttribute("text", "color", "black");1791 }1792 }1793 }1794 }1795 else if(indexPos[0]>-12&&indexPos[0]<10&&indexPos[1]>135&&indexPos[1]<160){1796 //console.log("N");1797 sessionManager.pressed.push("N");1798 if(sessionManager.pressed.indexOf("N")>-1){1799 document.getElementById("letter-n-container").setAttribute("material", "color", "white");1800 document.getElementById("letter-n-container").setAttribute("text", "color", "black");1801 console.log("holding down N");1802 if(sessionManager.pressCount==null){1803 sessionManager.pressCount = -1;1804 }1805 else if(sessionManager.pressCount >= -1){1806 sessionManager.pressCount++;1807 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1808 console.log("pressed N");1809 document.getElementById("letter-n-container").setAttribute("material", "color", "red");1810 document.getElementById("letter-n-container").setAttribute("text", "color", "white");1811 if(sessionManager.pressCount==26){1812 sessionManager.outputTextStream.push("N");1813 let textStream = ""1814 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1815 (function(){1816 textStream+=sessionManager.outputTextStream[streamSize];1817 })();1818 }1819 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1820 }1821 }1822 if(sessionManager.pressCount>75){1823 console.log("long pressed N");1824 document.getElementById("letter-n-container").setAttribute("material", "color", "orange");1825 document.getElementById("letter-n-container").setAttribute("text", "color", "black");1826 }1827 }1828 }1829 }1830 else if(indexPos[0]>-43&&indexPos[0]<-17&&indexPos[1]>135&&indexPos[1]<160){1831 //console.log("B");1832 sessionManager.pressed.push("B");1833 if(sessionManager.pressed.indexOf("B")>-1){1834 document.getElementById("letter-b-container").setAttribute("material", "color", "white");1835 document.getElementById("letter-b-container").setAttribute("text", "color", "black");1836 console.log("holding down B");1837 if(sessionManager.pressCount==null){1838 sessionManager.pressCount = -1;1839 }1840 else if(sessionManager.pressCount >= -1){1841 sessionManager.pressCount++;1842 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1843 console.log("pressed B");1844 document.getElementById("letter-b-container").setAttribute("material", "color", "red");1845 document.getElementById("letter-b-container").setAttribute("text", "color", "white");1846 if(sessionManager.pressCount==26){1847 sessionManager.outputTextStream.push("B");1848 let textStream = ""1849 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1850 (function(){1851 textStream+=sessionManager.outputTextStream[streamSize];1852 })();1853 }1854 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1855 }1856 }1857 if(sessionManager.pressCount>75){1858 console.log("long pressed B");1859 document.getElementById("letter-b-container").setAttribute("material", "color", "orange");1860 document.getElementById("letter-b-container").setAttribute("text", "color", "black");1861 }1862 }1863 }1864 }1865 else if(indexPos[0]>-70&&indexPos[0]<-48&&indexPos[1]>135&&indexPos[1]<160){1866 // console.log("V");1867 sessionManager.pressed.push("V");1868 if(sessionManager.pressed.indexOf("V")>-1){1869 document.getElementById("letter-v-container").setAttribute("material", "color", "white");1870 document.getElementById("letter-v-container").setAttribute("text", "color", "black");1871 console.log("holding down V");1872 if(sessionManager.pressCount==null){1873 sessionManager.pressCount = -1;1874 }1875 else if(sessionManager.pressCount >= -1){1876 sessionManager.pressCount++;1877 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1878 console.log("pressed V");1879 document.getElementById("letter-v-container").setAttribute("material", "color", "red");1880 document.getElementById("letter-v-container").setAttribute("text", "color", "white");1881 if(sessionManager.pressCount==26){1882 sessionManager.outputTextStream.push("V");1883 let textStream = ""1884 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1885 (function(){1886 textStream+=sessionManager.outputTextStream[streamSize];1887 })();1888 }1889 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1890 }1891 }1892 if(sessionManager.pressCount>75){1893 console.log("long pressed V");1894 document.getElementById("letter-v-container").setAttribute("material", "color", "orange");1895 document.getElementById("letter-v-container").setAttribute("text", "color", "black");1896 }1897 }1898 }1899 }1900 else if(indexPos[0]>-95&&indexPos[0]<-75&&indexPos[1]>135&&indexPos[1]<160){1901 // console.log("C");1902 sessionManager.pressed.push("C");1903 if(sessionManager.pressed.indexOf("C")>-1){1904 document.getElementById("letter-c-container").setAttribute("material", "color", "white");1905 document.getElementById("letter-c-container").setAttribute("text", "color", "black");1906 console.log("holding down C");1907 if(sessionManager.pressCount==null){1908 sessionManager.pressCount = -1;1909 }1910 else if(sessionManager.pressCount >= -1){1911 sessionManager.pressCount++;1912 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1913 console.log("pressed C");1914 document.getElementById("letter-c-container").setAttribute("material", "color", "red");1915 document.getElementById("letter-c-container").setAttribute("text", "color", "white");1916 if(sessionManager.pressCount==26){1917 sessionManager.outputTextStream.push("C");1918 let textStream = ""1919 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1920 (function(){1921 textStream+=sessionManager.outputTextStream[streamSize];1922 })();1923 }1924 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1925 }1926 }1927 if(sessionManager.pressCount>75){1928 console.log("long pressed C");1929 document.getElementById("letter-c-container").setAttribute("material", "color", "orange");1930 document.getElementById("letter-c-container").setAttribute("text", "color", "black");1931 }1932 }1933 }1934 }1935 else if(indexPos[0]>-130&&indexPos[0]<-105&&indexPos[1]>135&&indexPos[1]<160){1936 // console.log("X");1937 sessionManager.pressed.push("X");1938 if(sessionManager.pressed.indexOf("X")>-1){1939 document.getElementById("letter-x-container").setAttribute("material", "color", "white");1940 document.getElementById("letter-x-container").setAttribute("text", "color", "black");1941 console.log("holding down X");1942 if(sessionManager.pressCount==null){1943 sessionManager.pressCount = -1;1944 }1945 else if(sessionManager.pressCount >= -1){1946 sessionManager.pressCount++;1947 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1948 console.log("pressed X");1949 document.getElementById("letter-x-container").setAttribute("material", "color", "red");1950 document.getElementById("letter-x-container").setAttribute("text", "color", "white");1951 if(sessionManager.pressCount==26){1952 sessionManager.outputTextStream.push("X");1953 let textStream = ""1954 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1955 (function(){1956 textStream+=sessionManager.outputTextStream[streamSize];1957 })();1958 }1959 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1960 }1961 }1962 if(sessionManager.pressCount>75){1963 console.log("long pressed X");1964 document.getElementById("letter-x-container").setAttribute("material", "color", "orange");1965 document.getElementById("letter-x-container").setAttribute("text", "color", "black");1966 }1967 }1968 }1969 }1970 else if(indexPos[0]>-155&&indexPos[0]<-135&&indexPos[1]>135&&indexPos[1]<160){1971 // console.log("Z");1972 sessionManager.pressed.push("Z");1973 if(sessionManager.pressed.indexOf("Z")>-1){1974 document.getElementById("letter-z-container").setAttribute("material", "color", "white");1975 document.getElementById("letter-z-container").setAttribute("text", "color", "black");1976 console.log("holding down Z");1977 if(sessionManager.pressCount==null){1978 sessionManager.pressCount = -1;1979 }1980 else if(sessionManager.pressCount >= -1){1981 sessionManager.pressCount++;1982 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){1983 console.log("pressed Z");1984 document.getElementById("letter-z-container").setAttribute("material", "color", "red");1985 document.getElementById("letter-z-container").setAttribute("text", "color", "white");1986 if(sessionManager.pressCount==26){1987 sessionManager.outputTextStream.push("Z");1988 let textStream = ""1989 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){1990 (function(){1991 textStream+=sessionManager.outputTextStream[streamSize];1992 })();1993 }1994 document.getElementById("output-display-container").setAttribute("text", "value", textStream);1995 }1996 }1997 if(sessionManager.pressCount>75){1998 console.log("long pressed Z");1999 document.getElementById("letter-z-container").setAttribute("material", "color", "orange");2000 document.getElementById("letter-z-container").setAttribute("text", "color", "black");2001 }2002 }2003 }2004 }2005 else if(indexPos[0]>-195&&indexPos[0]<-160&&indexPos[1]>135&&indexPos[1]<160){2006 console.log("shift");2007 sessionManager.pressed.push("shift");2008 if(sessionManager.pressed.indexOf("shift")>-1){2009 document.getElementById("system-leftshift-container").setAttribute("material", "color", "white");2010 document.getElementById("system-leftshift-container").setAttribute("text", "color", "black");2011 console.log("holding down left shift");2012 if(sessionManager.pressCount==null){2013 sessionManager.pressCount = -1;2014 }2015 else if(sessionManager.pressCount >= -1){2016 sessionManager.pressCount++;2017 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){2018 console.log("pressed shift");2019 document.getElementById("system-leftshift-container").setAttribute("material", "color", "red");2020 document.getElementById("system-leftshift-container").setAttribute("text", "color", "white");2021 if(sessionManager.pressCount==26){2022 console.log("shift effect!")2023 }2024 }2025 if(sessionManager.pressCount>75){2026 console.log("long pressed shift");2027 document.getElementById("system-leftshift-container").setAttribute("material", "color", "orange");2028 document.getElementById("system-leftshift-container").setAttribute("text", "color", "black");2029 }2030 }2031 }2032 }2033 else if(indexPos[0]>165&&indexPos[0]<185&&indexPos[1]>105&&indexPos[1]<130){2034 // console.log("RD");2035 sessionManager.pressed.push("RD");2036 if(sessionManager.pressed.indexOf("RD")>-1){2037 document.getElementById("dpad-right-container").setAttribute("material", "color", "white");2038 document.getElementById("dpad-right-container").setAttribute("text", "color", "black");2039 //console.log("holding down RD");2040 if(sessionManager.pressCount==null){2041 sessionManager.pressCount = -1;2042 }2043 else if(sessionManager.pressCount >= -1){2044 sessionManager.pressCount++;2045 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){2046 console.log("pressed RD");2047 document.getElementById("dpad-right-container").setAttribute("material", "color", "red");2048 document.getElementById("dpad-right-container").setAttribute("text", "color", "white");2049 if(sessionManager.pressCount==26){2050 console.log("dpad right effect!")2051 }2052 }2053 if(sessionManager.pressCount>75){2054 console.log("long pressed RD");2055 document.getElementById("dpad-right-container").setAttribute("material", "color", "orange");2056 document.getElementById("dpad-right-container").setAttribute("text", "color", "black");2057 }2058 }2059 }2060 }2061 else if(indexPos[0]>143&&indexPos[0]<160&&indexPos[1]>95&&indexPos[1]<120){2062 // console.log("DD");2063 sessionManager.pressed.push("DD");2064 if(sessionManager.pressed.indexOf("DD")>-1){2065 document.getElementById("dpad-down-container").setAttribute("material", "color", "white");2066 document.getElementById("dpad-down-container").setAttribute("text", "color", "black");2067 //console.log("holding down DD");2068 if(sessionManager.pressCount==null){2069 sessionManager.pressCount = -1;2070 }2071 else if(sessionManager.pressCount >= -1){2072 sessionManager.pressCount++;2073 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){2074 console.log("pressed DD");2075 document.getElementById("dpad-down-container").setAttribute("material", "color", "red");2076 document.getElementById("dpad-down-container").setAttribute("text", "color", "white");2077 if(sessionManager.pressCount==26){2078 console.log("dpad down effect!")2079 }2080 }2081 if(sessionManager.pressCount>75){2082 console.log("long pressed DD");2083 document.getElementById("dpad-down-container").setAttribute("material", "color", "orange");2084 document.getElementById("dpad-down-container").setAttribute("text", "color", "black");2085 }2086 }2087 }2088 }2089 else if(indexPos[0]>143&&indexPos[0]<160&&indexPos[1]>125&&indexPos[1]<145){2090 // console.log("UD");2091 sessionManager.pressed.push("UD");2092 if(sessionManager.pressed.indexOf("UD")>-1){2093 document.getElementById("dpad-up-container").setAttribute("material", "color", "white");2094 document.getElementById("dpad-up-container").setAttribute("text", "color", "black");2095 console.log("holding down UD");2096 if(sessionManager.pressCount==null){2097 sessionManager.pressCount = -1;2098 }2099 else if(sessionManager.pressCount >= -1){2100 sessionManager.pressCount++;2101 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){2102 console.log("pressed UD");2103 document.getElementById("dpad-up-container").setAttribute("material", "color", "red");2104 document.getElementById("dpad-up-container").setAttribute("text", "color", "white");2105 if(sessionManager.pressCount==26){2106 console.log("dpad up effect!")2107 }2108 }2109 if(sessionManager.pressCount>75){2110 console.log("long pressed UD");2111 document.getElementById("dpad-up-container").setAttribute("material", "color", "orange");2112 document.getElementById("dpad-up-container").setAttribute("text", "color", "black");2113 }2114 }2115 }2116 }2117 else if(indexPos[0]>120&&indexPos[0]<140&&indexPos[1]>105&&indexPos[1]<130){2118 // console.log("LD");2119 sessionManager.pressed.push("LD");2120 if(sessionManager.pressed.indexOf("LD")>-1){2121 document.getElementById("dpad-left-container").setAttribute("material", "color", "white");2122 document.getElementById("dpad-left-container").setAttribute("text", "color", "black");2123 console.log("holding down LD");2124 if(sessionManager.pressCount==null){2125 sessionManager.pressCount = -1;2126 }2127 else if(sessionManager.pressCount >= -1){2128 sessionManager.pressCount++;2129 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){2130 console.log("pressed LD");2131 document.getElementById("dpad-left-container").setAttribute("material", "color", "red");2132 document.getElementById("dpad-left-container").setAttribute("text", "color", "white");2133 if(sessionManager.pressCount==26){2134 console.log("dpad left effect!")2135 }2136 }2137 if(sessionManager.pressCount>75){2138 console.log("long pressed LD");2139 document.getElementById("dpad-left-container").setAttribute("material", "color", "orange");2140 document.getElementById("dpad-left-container").setAttribute("text", "color", "black");2141 }2142 }2143 }2144 }2145 else if(indexPos[0]>95&&indexPos[0]<115&&indexPos[1]>105&&indexPos[1]<130){2146 // console.log("ROPT");2147 sessionManager.pressed.push("ROPT");2148 if(sessionManager.pressed.indexOf("ROPT")>-1){2149 document.getElementById("system-rightoption-container").setAttribute("material", "color", "white");2150 document.getElementById("system-rightoption-container").setAttribute("text", "color", "black");2151 console.log("holding down ROPT");2152 if(sessionManager.pressCount==null){2153 sessionManager.pressCount = -1;2154 }2155 else if(sessionManager.pressCount >= -1){2156 sessionManager.pressCount++;2157 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){2158 console.log("pressed ROPT");2159 document.getElementById("system-rightoption-container").setAttribute("material", "color", "red");2160 document.getElementById("system-rightoption-container").setAttribute("text", "color", "white");2161 if(sessionManager.pressCount==26){2162 console.log("right option effect!")2163 }2164 }2165 if(sessionManager.pressCount>75){2166 console.log("long pressed ROPT");2167 document.getElementById("system-rightoption-container").setAttribute("material", "color", "orange");2168 document.getElementById("system-rightoption-container").setAttribute("text", "color", "black");2169 }2170 }2171 }2172 }2173 else if(indexPos[0]>65&&indexPos[0]<90&&indexPos[1]>105&&indexPos[1]<130){2174 // console.log("RCMD");2175 sessionManager.pressed.push("RCMD");2176 if(sessionManager.pressed.indexOf("RCMD")>-1){2177 document.getElementById("system-rightcommand-container").setAttribute("material", "color", "white");2178 document.getElementById("system-rightcommand-container").setAttribute("text", "color", "black");2179 console.log("holding down RCMD");2180 if(sessionManager.pressCount==null){2181 sessionManager.pressCount = -1;2182 }2183 else if(sessionManager.pressCount >= -1){2184 sessionManager.pressCount++;2185 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){2186 console.log("pressed RCMD");2187 document.getElementById("system-rightcommand-container").setAttribute("material", "color", "red");2188 document.getElementById("system-rightcommand-container").setAttribute("text", "color", "white");2189 if(sessionManager.pressCount==26){2190 console.log("right command effect!")2191 }2192 }2193 if(sessionManager.pressCount>75){2194 console.log("long pressed RCMD");2195 document.getElementById("system-rightcommand-container").setAttribute("material", "color", "orange");2196 document.getElementById("system-rightcommand-container").setAttribute("text", "color", "black");2197 }2198 }2199 }2200 }2201 else if(indexPos[0]>-85&&indexPos[0]<60&&indexPos[1]>105&&indexPos[1]<130){2202 // console.log("SPCE");2203 sessionManager.pressed.push("SPCE");2204 if(sessionManager.pressed.indexOf("SPCE")>-1){2205 document.getElementById("space-bar-container").setAttribute("material", "color", "white");2206 document.getElementById("space-bar-container").setAttribute("text", "color", "black");2207 console.log("holding down SPCE");2208 if(sessionManager.pressCount==null){2209 sessionManager.pressCount = -1;2210 }2211 else if(sessionManager.pressCount >= -1){2212 sessionManager.pressCount++;2213 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){2214 console.log("pressed SPCE");2215 document.getElementById("space-bar-container").setAttribute("material", "color", "red");2216 document.getElementById("space-bar-container").setAttribute("text", "color", "white");2217 if(sessionManager.pressCount==26){2218 sessionManager.outputTextStream.push(" ");2219 let textStream = ""2220 for(var streamSize = 0; streamSize<sessionManager.outputTextStream.length;streamSize++){2221 (function(){2222 textStream+=sessionManager.outputTextStream[streamSize];2223 })();2224 }2225 document.getElementById("output-display-container").setAttribute("text", "value", textStream);2226 }2227 }2228 if(sessionManager.pressCount>75){2229 console.log("long pressed SPCE");2230 document.getElementById("letter-q-container").setAttribute("material", "color", "orange");2231 document.getElementById("letter-q-container").setAttribute("text", "color", "black");2232 }2233 }2234 }2235 }2236 else if(indexPos[0]>-105&&indexPos[0]<-90&&indexPos[1]>105&&indexPos[1]<130){2237 // console.log("CMD");2238 sessionManager.pressed.push("CMD");2239 if(sessionManager.pressed.indexOf("CMD")>-1){2240 document.getElementById("system-leftcommand-container").setAttribute("material", "color", "white");2241 document.getElementById("system-leftcommand-container").setAttribute("text", "color", "black");2242 console.log("holding down left CMD button");2243 if(sessionManager.pressCount==null){2244 sessionManager.pressCount = -1;2245 }2246 else if(sessionManager.pressCount >= -1){2247 sessionManager.pressCount++;2248 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){2249 console.log("pressed CMD");2250 document.getElementById("system-leftcommand-container").setAttribute("material", "color", "red");2251 document.getElementById("system-leftcommand-container").setAttribute("text", "color", "white");2252 if(sessionManager.pressCount==26){2253 console.log("left command effect!")2254 }2255 }2256 if(sessionManager.pressCount>75){2257 console.log("long pressed CMD");2258 document.getElementById("letter-q-container").setAttribute("material", "color", "orange");2259 document.getElementById("letter-q-container").setAttribute("text", "color", "black");2260 }2261 }2262 }2263 }2264 else if(indexPos[0]>-130&&indexPos[0]<-110&&indexPos[1]>105&&indexPos[1]<130){2265 // console.log("OPTION");2266 sessionManager.pressed.push("OPTION");2267 if(sessionManager.pressed.indexOf("OPTION")>-1){2268 document.getElementById("system-leftoption-container").setAttribute("material", "color", "white");2269 document.getElementById("system-leftoption-container").setAttribute("text", "color", "black");2270 console.log("holding downleft OPTION button");2271 if(sessionManager.pressCount==null){2272 sessionManager.pressCount = -1;2273 }2274 else if(sessionManager.pressCount >= -1){2275 sessionManager.pressCount++;2276 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){2277 console.log("pressed OPTION");2278 document.getElementById("system-leftoption-container").setAttribute("material", "color", "red");2279 document.getElementById("system-leftoption-container").setAttribute("text", "color", "white");2280 if(sessionManager.pressCount==26){2281 console.log("left option effect!")2282 }2283 }2284 if(sessionManager.pressCount>75){2285 console.log("long pressed OPTION");2286 document.getElementById("letter-q-container").setAttribute("material", "color", "orange");2287 document.getElementById("letter-q-container").setAttribute("text", "color", "black");2288 }2289 }2290 }2291 }2292 else if(indexPos[0]>-155&&indexPos[0]<-135&&indexPos[1]>105&&indexPos[1]<130){2293 // console.log("CTRL");2294 sessionManager.pressed.push("CTRL");2295 if(sessionManager.pressed.indexOf("CTRL")>-1){2296 document.getElementById("system-leftcontrol-container").setAttribute("material", "color", "white");2297 document.getElementById("system-leftcontrol-container").setAttribute("text", "color", "black");2298 console.log("holding down left CTRL button");2299 if(sessionManager.pressCount==null){2300 sessionManager.pressCount = -1;2301 }2302 else if(sessionManager.pressCount >= -1){2303 sessionManager.pressCount++;2304 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){2305 console.log("pressed CTRL");2306 document.getElementById("system-leftcontrol-container").setAttribute("material", "color", "red");2307 document.getElementById("system-leftcontrol-container").setAttribute("text", "color", "white");2308 if(sessionManager.pressCount==26){2309 console.log("left control effect!")2310 }2311 }2312 if(sessionManager.pressCount>75){2313 console.log("long pressed CTRL");2314 document.getElementById("letter-q-container").setAttribute("material", "color", "orange");2315 document.getElementById("letter-q-container").setAttribute("text", "color", "black");2316 }2317 }2318 }2319 }2320 else if(indexPos[0]>-195&&indexPos[0]<-160&&indexPos[1]>105&&indexPos[1]<130){2321 console.log("FN");2322 sessionManager.pressed.push("FN");2323 if(sessionManager.pressed.indexOf("FN")>-1){2324 document.getElementById("system-function-container").setAttribute("material", "color", "white");2325 document.getElementById("system-function-container").setAttribute("text", "color", "black");2326 console.log("holding down FN button");2327 if(sessionManager.pressCount==null){2328 sessionManager.pressCount = -1;2329 }2330 else if(sessionManager.pressCount >= -1){2331 sessionManager.pressCount++;2332 if(sessionManager.pressCount>25&&sessionManager.pressCount<75){2333 console.log("pressed FN");2334 document.getElementById("system-function-container").setAttribute("material", "color", "red");2335 document.getElementById("system-function-container").setAttribute("text", "color", "white");2336 if(sessionManager.pressCount==26){2337 console.log("function effect!")2338 }2339 }2340 if(sessionManager.pressCount>75){2341 console.log("long pressed FN");2342 document.getElementById("letter-q-container").setAttribute("material", "color", "orange");2343 document.getElementById("letter-q-container").setAttribute("text", "color", "black");2344 }2345 }2346 }2347 }2348 else if(indexPos[0]>150&&indexPos[0]<170&&indexPos[1]>150&&indexPos[1]<170){2349 console.log("toggle #output-display-container");2350 if(sessionManager.outputTimeOut){2351 console.log("wait to press button after timeout");2352 }2353 else{2354 if(sessionManager.outputDisplayContainerVisible){2355 document.getElementById("output-display-container").setAttribute("material", "opacity", 0);2356 sessionManager.outputDisplayContainerVisible = false;2357 }2358 else{2359 document.getElementById("output-display-container").setAttribute("material", "opacity", 1.0);2360 sessionManager.outputDisplayContainerVisible = true;2361 }2362 sessionManager.outputTimeOut = true;2363 setTimeout(function(){2364 sessionManager.outputTimeOut = false;2365 }, 2000);2366 }2367 }2368 else if(indexPos[0]>170&&indexPos[0]<190&&indexPos[1]>210&&indexPos[1]<230){2369 console.log("export as LYOKO");2370 }2371 else if(indexPos[0]>170&&indexPos[0]<190&&indexPos[1]>240&&indexPos[1]<260){2372 console.log("export as TXT");2373 }2374 else{2375 // 150 - 1702376 console.log(indexPos[0]);2377 if(sessionManager.pressed.length>0){2378 sessionManager.pressed = [];2379 sessionManager.pressCount = -1;2380 let buttons = document.getElementsByClassName("keyboard-button-container");2381 for(var q=0; q<buttons.length; q++){2382 (function(){2383 buttons.item(q).setAttribute("material", "color", "black");2384 buttons.item(q).setAttribute("text", "color", "white");2385 })();2386 }2387 }2388 }2389 /*2390 *2391 * for every item in the object objectManager2392 * check its margins2393 * if the center of the indexFinger's distal bone is within the margins of the object2394 * change the object's background color to black and text color to white2395 * other wise keep the background color gray2396 *2397 */2398 }2399 renderer.render(scene, camera);2400}})2401.use('handHold')2402.use('handEntry')2403.on('handFound', function(hand){2404 hand.fingers.forEach(function (finger) {2405 var boneMeshes = [];2406 var jointMeshes = [];2407 finger.bones.forEach(function(bone) {2408 var boneMesh = new THREE.Mesh(2409 new THREE.CylinderGeometry(5, 5, bone.length),2410 new THREE.MeshPhongMaterial()2411 );2412 boneMesh.material.color.setHex(0xffffff);2413 scene.add(boneMesh);2414 boneMeshes.push(boneMesh);2415 });2416 for (var i = 0; i < finger.bones.length + 1; i++) {2417 var jointMesh = new THREE.Mesh(2418 new THREE.SphereGeometry(8),2419 new THREE.MeshPhongMaterial()2420 );2421 jointMesh.material.color.setHex(0x00ff00);2422 scene.add(jointMesh);2423 jointMeshes.push(jointMesh);2424 }2425 finger.data('boneMeshes', boneMeshes);2426 finger.data('jointMeshes', jointMeshes);2427 });2428})2429.on('handLost', function(hand){2430 hand.fingers.forEach(function (finger) {2431 var boneMeshes = finger.data('boneMeshes');2432 var jointMeshes = finger.data('jointMeshes');2433 boneMeshes.forEach(function(mesh){2434 scene.remove(mesh);2435 });2436 jointMeshes.forEach(function(mesh){2437 scene.remove(mesh);2438 });2439 finger.data({2440 boneMeshes: null,2441 boneMeshes: null2442 });2443 });2444 sessionManager.pressCount == -1;2445 sessionManager.pressed = [];2446 console.log(JSON.stringify(sessionManager.outputTextStream));2447 renderer.render(scene, camera);2448})...

Full Screen

Full Screen

dateRange.js

Source:dateRange.js Github

copy

Full Screen

1function binarySearchGreaterThanDate(key, a) {2 //console.log("Calling..."+a.length);3 //console.log(a);4 var low = 0;5 var high = a.length - 1;6 var indexPos = -1;7 key = key.valueOf();8 if(a.length > 0 && (new Date(a[0])).valueOf() > key) {9 console.log("D : " + a[0] + " key : " + key)10 return 0;11 }12 while (high >= low) {13 //console.log("low : " + low+" high : " + high);14 var middle = parseInt((low + high) / 2);15 var date1 = (new Date(a[middle])).valueOf();16 //console.log("Middle : "+middle+" date : " + date1);17 if (date1 == key) {18 indexPos = middle;19 break;20 }21 if(high == low) {22 while(high < a.length) {23 var date2 = (new Date(a[high])).valueOf();24 if(date2 > key) {25 indexPos = high;26 break;27 }28 high++;29 }30 break;31 }32 if (date1 < key) {33 low = middle + 1;34 }35 if (date1 > key) {36 high = middle - 1;37 }38 }39 //console.log("Index : " + indexPos);40 //console.log("valuevvvvv : " + a[indexPos]);41 return indexPos;42}43function binarySearchLessThanDate(key, a) {44 //console.log("Calling..."+a.length);45 //console.log(a);46 var low = 0;47 var high = a.length - 1;48 var indexPos = -1;49 key = key.valueOf();50 while (high >= low) {51 var middle = parseInt((low + high) / 2);52 var date1 = (new Date(a[middle])).valueOf();53 if (date1 == key) {54 indexPos = middle;55 break;56 }57 if(high == low) {58 while(high >= 0) {59 var date2 = (new Date(a[high])).valueOf();60 if(date2 < key) {61 indexPos = high;62 break;63 }64 high--;65 }66 break;67 }68 if (date1 < key) {69 low = middle + 1;70 }71 if (date1 > key) {72 high = middle - 1;73 }74 }75 //console.log("Index : " + indexPos);76 //console.log("valuevvvvv : " + a[indexPos]);77 return indexPos; ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { indexPos } = require('fast-check-monorepo');2const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];3const b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];4const index = indexPos(a, b, 5);5const index2 = indexPos(a, b, 8);6const index3 = indexPos(a, b, 1);7const index4 = indexPos(a, b, 10);8const index5 = indexPos(a, b, 0);9const index6 = indexPos(a, b, 11);10const index7 = indexPos(a, b, -1);11const index8 = indexPos(a, b, -5);12const index9 = indexPos(a, b, -10);13const index10 = indexPos(a, b, -11);14const index11 = indexPos(a, b, 0.5);15const index12 = indexPos(a, b, 5.5);16const index13 = indexPos(a, b, 10.5);17const index14 = indexPos(a, b, 11.5);18const index15 = indexPos(a, b, -0.5);19const index16 = indexPos(a, b, -5.5);20const index17 = indexPos(a, b, -10.5);21const index18 = indexPos(a, b, -11.5);22const index19 = indexPos(a,

Full Screen

Using AI Code Generation

copy

Full Screen

1const { indexPos } = require('fast-check-monorepo');2const { indexPos } = require('fast-check-monorepo');3const { indexPos } = require('fast-check-monorepo');4const { indexPos } = require('fast-check-monorepo');5const { indexPos } = require('fast-check-monorepo');6const { indexPos } = require('fast-check-monorepo');7const { indexPos } = require('fast-check-monorepo');8const { indexPos } = require('fast-check-monorepo');9const { indexPos } = require('fast-check-monorepo');10const { indexPos } = require('fast-check-monorepo');11const { indexPos } = require('fast-check-monorepo');12const { indexPos } = require('fast-check-monorepo');13const { indexPos } = require('fast-check-monorepo');14const { indexPos } = require('fast-check-monorepo');15const { indexPos } = require('fast-check-monorepo');16const { indexPos } = require('fast-check-monorepo');17const {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { indexPos } from 'fast-check-monorepo';2console.log(indexPos('hello', 'l'));3import { indexPos } from 'fast-check';4console.log(indexPos('hello', 'l'));5import { indexPos } from 'fast-check';6console.log(indexPos('hello', 'l'));7import { indexPos } from 'fast-check-monorepo';8console.log(indexPos('hello', 'l'));9import { indexPos } from 'fast-check';10console.log(indexPos('hello', 'l'));11import { indexPos } from 'fast-check-monorepo';12console.log(indexPos('hello', 'l'));13import { indexPos } from 'fast-check';14console.log(indexPos('hello', 'l'));15import { indexPos } from 'fast-check-monorepo';16console.log(indexPos('hello', 'l'));17import { indexPos } from 'fast-check';18console.log(indexPos('hello', 'l'));19import { indexPos } from 'fast-check-monorepo';20console.log(indexPos('hello', 'l'));21import { indexPos } from 'fast-check';22console.log(indexPos('hello', 'l'));23import { indexPos } from 'fast-check-monorepo';24console.log(indexPos('hello', 'l'));25import { indexPos } from 'fast-check';26console.log(indexPos('hello', 'l'));27import { indexPos } from 'fast-check-monorepo';28console.log(indexPos('hello', 'l'));29import { indexPos } from 'fast-check';30console.log(indexPos('hello', 'l'));

Full Screen

Using AI Code Generation

copy

Full Screen

1const indexPos = require('fast-check-monorepo/packages/fast-check/src/check/model/RunDetails.ts').indexPos;2const input = [1, 2, 3, 4, 5];3const index = 2;4const result = indexPos(input, index);5console.log(input);6console.log(index);7console.log(result);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { indexPos } = require('fast-check-monorepo');2const arr = [1, 2, 3, 4, 5, 6];3const arr2 = [1, 2, 3, 4, 5, 6, 7];4const arr3 = [1, 2, 3, 4, 5, 6, 7, 8];5const arr4 = [1, 2, 3, 4, 5, 6, 7, 8, 9];6const arr5 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];7const arr6 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];8const arr7 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];9const arr8 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];10const arr9 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];

Full Screen

Using AI Code Generation

copy

Full Screen

1import { indexPos } from 'fast-check-monorepo';2import { indexPos } from 'fast-check-monorepo';3import { indexPos } from 'fast-check-monorepo';4import { indexPos } from 'fast-check-monorepo';5import { indexPos } from 'fast-check-monorepo';6import { indexPos } from 'fast-check-monorepo';7import { indexPos } from 'fast-check-monorepo';8import { indexPos } from 'fast-check-monorepo';9import { indexPos } from 'fast-check-monorepo';10import { indexPos } from 'fast-check-monorepo';11import { indexPos } from 'fast-check-monorepo';12import { indexPos } from 'fast-check-monorepo';13import { indexPos } from 'fast-check-monorepo';14import { indexPos } from 'fast-check-monorepo';

Full Screen

Using AI Code Generation

copy

Full Screen

1const { indexPos } = require('fast-check-monorepo');2const { check, property } = require('fast-check');3check(4 property([indexPos()], (pos) => {5 return true;6 })7);8"dependencies": {9 }

Full Screen

Using AI Code Generation

copy

Full Screen

1const { indexPos } = require('fast-check-monorepo');2const { check } = require('fast-check');3const { indexPos } = require('fast-check-monorepo');4check(5 indexPos(),6 (p) => {7 return true;8 }9);10const { indexPos } = require('fast-check-monorepo');11const { check } = require('fast-check');12const { indexPos } = require('fast-check-monorepo');13check(14 indexPos(),15 (p) => {16 return true;17 }18);19const { indexPos } = require('fast-check-monorepo');20const { check } = require('fast-check');21const { indexPos } = require('fast-check-monorepo');22check(23 indexPos(),24 (p) => {25 return true;26 }27);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { indexPos } = require('fast-check-monorepo');2const index = indexPos(5, 10);3console.log(index);4import { indexPos } from 'fast-check-monorepo';5const index = indexPos(5, 10);6console.log(index);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fast-check-monorepo automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful