|
277 | 277 | #boosty{fill:var(--tx);}
|
278 | 278 | </style>
|
279 | 279 | </head>
|
280 |
| -<body onload="new_canvas(60,30);"> |
| 280 | +<body onload="new_canvas(60,30);" style="overflow:hidden;"> |
281 | 281 | <canvas id="preview" style="display:none;"></canvas>
|
282 | 282 | <a id="get_file" style="display:none;position:fixed;"></a>
|
283 | 283 | <input id="file" type="file" style="display:none;position:fixed;"/>
|
|
536 | 536 | context_menu.style.top=(e.clientY+asciiscreen.scrollTop-doc.top)/scale+"px";
|
537 | 537 | }
|
538 | 538 | window.addEventListener('mousemove',function(e){if(tool==5){cursor_text.style.left=(e.clientX+16)+"px";cursor_text.style.top=(e.clientY+16)+"px";}})
|
539 |
| -window.addEventListener('mousedown',function(){if(tool==0||tool==3||tool==5){mouseclick=true;};if(contextmenushow){contextmenushow=false;context_menu.style.visibility='hidden';mouseclick=false;}}) |
| 539 | +window.addEventListener('mousedown',function(e){if(e.button==0){if(tool==0||tool==3||tool==5){mouseclick=true;};if(contextmenushow){contextmenushow=false;context_menu.style.visibility='hidden';mouseclick=false;}} }) |
540 | 540 | window.addEventListener('mouseup',function(){mouseclick=false;cursor_text.style.display="none"})
|
541 | 541 | window.addEventListener('keypress',function(e){var n=String.fromCharCode(e.charCode);brush=n;active_brush.innerHTML=brush;})
|
542 | 542 | asciicanvas.addEventListener('mouseup',function(){if(tool!=2&&tool!=5){state_save()};})
|
543 | 543 | var startmove_x=null,startmove_y=null,scroll_x=null,scroll_y=null;
|
544 | 544 | viewport.addEventListener('mousedown',function(e){
|
545 |
| - if(tool==2){ |
| 545 | + if(tool==2||e.button==1){ |
| 546 | + if(e.button==1){e.preventDefault();} |
546 | 547 | startmove_x=e.clientX;startmove_y=e.clientY;scroll_x=viewport.scrollTop;scroll_y=viewport.scrollLeft;
|
547 | 548 | viewport.onmousemove=function(e){viewport.scrollTop=scroll_x-(e.clientY-startmove_y);viewport.scrollLeft=scroll_y-(e.clientX-startmove_x);};
|
548 | 549 | viewport.onmouseup=function (e){startmove_x=null;startmove_y=null;viewport.onmousemove=null;viewport.onmouseup=null;};
|
|
675 | 676 | for(x=0;x<w;x++){
|
676 | 677 | td=document.createElement("td");
|
677 | 678 | td.setAttribute("onmouseenter","if(event.which!=3&&!contextmenushow){targetcell=["+x+","+y+"];cur_x.innerHTML="+(x+1)+";cur_y.innerHTML="+(y+1)+";if(mouseclick){if(tool==5){selected[2]="+x+";selected[3]="+y+";select_arr();}else if(tool==0){this.innerHTML=brush;}else if(tool==3){this.innerHTML=' ';}}}")
|
678 |
| - td.setAttribute("onmousedown","if(event.which!=3&&!contextmenushow){if(tool==5){selected=["+x+","+y+","+x+","+y+"];select_arr();}else if(tool==0){this.innerHTML=brush;}else if(tool==3){this.innerHTML=' ';}else if(tool==1){start_fill("+x+","+y+",this.textContent);}else if(tool==4){brush=this.textContent;active_brush.innerHTML=brush;}}") |
| 679 | + td.setAttribute("onmousedown","if(event.button==0&&event.which!=3&&!contextmenushow){if(tool==5){selected=["+x+","+y+","+x+","+y+"];select_arr();}else if(tool==0){this.innerHTML=brush;}else if(tool==3){this.innerHTML=' ';}else if(tool==1){start_fill("+x+","+y+",this.textContent);}else if(tool==4){brush=this.textContent;active_brush.innerHTML=brush;}}") |
679 | 680 | td.setAttribute("oncontextmenu","targetcell=["+x+","+y+"]")
|
680 | 681 | if(se&&(x1<=x&&x<=x2)&&(y1<=y&&y<=y2)){td.style.backgroundColor="var(--cw)"}
|
681 | 682 | if(db[y][x]&&db[y][x]!=" "){td.innerHTML=db[y][x]}else{td.innerHTML=" "}
|
|
0 commit comments