123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- var color=["#FF82AB","#CD6889","#FF1493","#CD1076","#C0FF3E"];
- var flag=[0,0,0,0,0,0,0,0,0];
- var num=0;
- var timestampOri = Date.now();
- function ShowCalibrationPoint(){
- document.getElementById("btn1").style.backgroundColor="#FFB6C1";
- document.getElementById("btn2").style.backgroundColor="#FFB6C1";
- document.getElementById("btn3").style.backgroundColor="#FFB6C1";
- document.getElementById("btn4").style.backgroundColor="#FFB6C1";
- document.getElementById("btn5").style.backgroundColor="#FFB6C1";
- document.getElementById("btn6").style.backgroundColor="#FFB6C1";
- document.getElementById("btn7").style.backgroundColor="#FFB6C1";
- document.getElementById("btn8").style.backgroundColor="#FFB6C1";
- document.getElementById("btn9").style.backgroundColor="#FFB6C1";
-
- document.getElementById("btn1").style.visibility='visible';
- document.getElementById("btn2").style.visibility='visible';
- document.getElementById("btn3").style.visibility='visible';
- document.getElementById("btn4").style.visibility='visible';
- document.getElementById("btn5").style.visibility='visible';
- document.getElementById("btn6").style.visibility='visible';
- document.getElementById("btn7").style.visibility='visible';
- document.getElementById("btn8").style.visibility='visible';
- document.getElementById("btn9").style.visibility='hidden';
- document.getElementById("btn9").disabled = false;
- }
- ShowCalibrationPoint();
- window.addEventListener("click", onmouseclick);
- function onmouseclick(event) {
- console.log(1111111111111)
- gazefilter.tracker.calibrate( //九点校正,发送当前点击位置进行校正
- event.timeStamp, // relative to performance.timeOrigin
- event.screenX, // in pixels
- event.screenY, // in pixels
- 1.0 // see note below
- );
- }
- function change1(){
- for(let i=0;i<8;i++){
- if(flag[i]==4)
- num++;
- }
- if(num==8){
- document.getElementById("btn9").style.visibility='visible';
- }else{
- num=0;
- }
- if(flag[0]>=4){
- document.getElementById("btn1").style.backgroundColor=color[flag[0]];
- }
- else{
- document.getElementById("btn1").style.backgroundColor=color[flag[0]];
- flag[0]++;
- }
-
- }
- function change2(){
- for(let i=0;i<8;i++){
- if(flag[i]==4)
- num++;
- }
- if(num==8){
- document.getElementById("btn9").style.visibility='visible';
- }else{
- num=0;
- }
- if(flag[1]>=4){
- document.getElementById("btn2").style.backgroundColor=color[flag[1]];
- }
- else{
- document.getElementById("btn2").style.backgroundColor=color[flag[1]];
- flag[1]++;
- }
-
- }
- function change3(){
- for(let i=0;i<8;i++){
- if(flag[i]==4)
- num++;
- }
- if(num==8){
- document.getElementById("btn9").style.visibility='visible';
- }else{
- num=0;
- }
- if(flag[2]>=4){
- document.getElementById("btn3").style.backgroundColor=color[flag[2]];
- }
- else{
- document.getElementById("btn3").style.backgroundColor=color[flag[2]];
- flag[2]++;
- }
-
- }
- function change4(){
- for(let i=0;i<8;i++){
- if(flag[i]==4)
- num++;
- }
- if(num==8){
- document.getElementById("btn9").style.visibility='visible';
- }else{
- num=0;
- }
- if(flag[3]>=4){
- document.getElementById("btn4").style.backgroundColor=color[flag[3]];
- }
- else{
- document.getElementById("btn4").style.backgroundColor=color[flag[3]];
- flag[3]++;
- }
-
- }
- function change5(){
- for(let i=0;i<8;i++){
- if(flag[i]==4)
- num++;
- }
- if(num==8){
- document.getElementById("btn9").style.visibility='visible';
- }else{
- num=0;
- }
- if(flag[4]>=4){
- document.getElementById("btn5").style.backgroundColor=color[flag[4]];
- }
- else{
- document.getElementById("btn5").style.backgroundColor=color[flag[4]];
- flag[4]++;
- }
-
- }
- function change6(){
- for(let i=0;i<8;i++){
- if(flag[i]==4)
- num++;
- }
- if(num==8){
- document.getElementById("btn9").style.visibility='visible';
- }else{
- num=0;
- }
- if(flag[5]>=4){
- document.getElementById("btn6").style.backgroundColor=color[flag[5]];
- }
- else{
- document.getElementById("btn6").style.backgroundColor=color[flag[5]];
- flag[5]++;
- }
-
- }
- function change7(){
- for(let i=0;i<8;i++){
- if(flag[i]==4)
- num++;
- }
- if(num==8){
- document.getElementById("btn9").style.visibility='visible';
- }else{
- num=0;
- }
- if(flag[6]>=4){
- document.getElementById("btn7").style.backgroundColor=color[flag[6]];
- }
- else{
- document.getElementById("btn7").style.backgroundColor=color[flag[6]];
- flag[6]++;
- }
-
- }
- function change8(){
- for(let i=0;i<8;i++){
- if(flag[i]==4)
- num++;
- }
- if(num==8){
- document.getElementById("btn9").style.visibility='visible';
- }else{
- num=0;
- }
- if(flag[7]>=4){
- document.getElementById("btn8").style.backgroundColor=color[flag[7]];
- }
- else{
- document.getElementById("btn8").style.backgroundColor=color[flag[7]];
- flag[7]++;
- }
-
- }
- function change9(){
- if(flag[8]>=4){
- document.getElementById("btn9").style.backgroundColor=color[flag[8]];
- document.getElementById("btn1").style.visibility='hidden';
- document.getElementById("btn2").style.visibility='hidden';
- document.getElementById("btn3").style.visibility='hidden';
- document.getElementById("btn4").style.visibility='hidden';
- document.getElementById("btn5").style.visibility='hidden';
- document.getElementById("btn6").style.visibility='hidden';
- document.getElementById("btn7").style.visibility='hidden';
- document.getElementById("btn8").style.visibility='hidden';
- document.getElementById("btn9").style.visibility='hidden';
- window.removeEventListener("click", onmouseclick); //九点校正完成,取消鼠标事件,并开始绘制轨迹点
- startTrace()
- }
- else{
- document.getElementById("btn9").style.backgroundColor=color[flag[8]];
- flag[8]++;
- }
- }
|