Skip to content

Commit

Permalink
kirilllive
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirilllive committed Jul 14, 2024
1 parent 2f04cfb commit 0d1ae55
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
Binary file modified .DS_Store
Binary file not shown.
9 changes: 5 additions & 4 deletions ascii_paint.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
#boosty{fill:var(--tx);}
</style>
</head>
<body onload="new_canvas(60,30);">
<body onload="new_canvas(60,30);" style="overflow:hidden;">
<canvas id="preview" style="display:none;"></canvas>
<a id="get_file" style="display:none;position:fixed;"></a>
<input id="file" type="file" style="display:none;position:fixed;"/>
Expand Down Expand Up @@ -536,13 +536,14 @@
context_menu.style.top=(e.clientY+asciiscreen.scrollTop-doc.top)/scale+"px";
}
window.addEventListener('mousemove',function(e){if(tool==5){cursor_text.style.left=(e.clientX+16)+"px";cursor_text.style.top=(e.clientY+16)+"px";}})
window.addEventListener('mousedown',function(){if(tool==0||tool==3||tool==5){mouseclick=true;};if(contextmenushow){contextmenushow=false;context_menu.style.visibility='hidden';mouseclick=false;}})
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;}} })
window.addEventListener('mouseup',function(){mouseclick=false;cursor_text.style.display="none"})
window.addEventListener('keypress',function(e){var n=String.fromCharCode(e.charCode);brush=n;active_brush.innerHTML=brush;})
asciicanvas.addEventListener('mouseup',function(){if(tool!=2&&tool!=5){state_save()};})
var startmove_x=null,startmove_y=null,scroll_x=null,scroll_y=null;
viewport.addEventListener('mousedown',function(e){
if(tool==2){
if(tool==2||e.button==1){
if(e.button==1){e.preventDefault();}
startmove_x=e.clientX;startmove_y=e.clientY;scroll_x=viewport.scrollTop;scroll_y=viewport.scrollLeft;
viewport.onmousemove=function(e){viewport.scrollTop=scroll_x-(e.clientY-startmove_y);viewport.scrollLeft=scroll_y-(e.clientX-startmove_x);};
viewport.onmouseup=function (e){startmove_x=null;startmove_y=null;viewport.onmousemove=null;viewport.onmouseup=null;};
Expand Down Expand Up @@ -675,7 +676,7 @@
for(x=0;x<w;x++){
td=document.createElement("td");
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=' ';}}}")
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;}}")
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;}}")
td.setAttribute("oncontextmenu","targetcell=["+x+","+y+"]")
if(se&&(x1<=x&&x<=x2)&&(y1<=y&&y<=y2)){td.style.backgroundColor="var(--cw)"}
if(db[y][x]&&db[y][x]!=" "){td.innerHTML=db[y][x]}else{td.innerHTML=" "}
Expand Down
22 changes: 22 additions & 0 deletions examples/logo_a.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
_ ___ ___ ___ ___
/_\ / __|/ __|_ _|_ _|
/ _ \\__ \ (__ | | | |
/_/ \_\___/\___|___|___| ,d$b
__ ___ ,d$$P'
/\ |__) | ,d$$$'
/~~\ | \ | ,d,//\)
__ ___ _d P),\\(\
|__) /\ | |\ | | ,.)\)\\_(((\)
| /~~\ | | \| | d$$`\`._,)))))
d$$$P' `.__/(((:
___,,---''\ d$$P' \ (`:
___,,---'' \_/'\P' ) ..
\ __ ,---,_ | _/' / ))
\ ,-" `\\ \ `)/`\ | //
\ | \ )`-`\_-'"'\ \ | //
\ `--'`\/ `\ ) \ \ \\
\ `\ `,_\-' \ `.\\
\ \_,' \ /_}}
\ ___,,---''
\___,,---''

2 changes: 1 addition & 1 deletion examples/lum.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


█████ ████
██████░░██████████
Expand Down

0 comments on commit 0d1ae55

Please sign in to comment.