Skip to content

Commit

Permalink
kirillllive
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirilllive committed May 29, 2022
1 parent 3f3400a commit e8d4728
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ASCII Graphics 文字や記号を組み合わせて絵のようにしたテキ
> [Japanes translation and adaptation by Onigi ](https://twitter.com/onigi123)

[![Patreon](http://odin-interactive.com/img/patron.svg)](https://www.patreon.com/tuesday_js)
[![Patreon](http://odin-interactive.com/img/patron.svg)](https://www.patreon.com/tuesday_street)


# Simple interface / 簡潔で覚えやすいインターフェイス
Expand Down Expand Up @@ -85,4 +85,4 @@ In addition this feature will allow you to quickly add data to the editor and co



[![Patreon](http://odin-interactive.com/img/patron.svg)](https://www.patreon.com/tuesday_js)
[![Patreon](http://odin-interactive.com/img/patron.svg)](https://www.patreon.com/tuesday_street)
21 changes: 11 additions & 10 deletions ascii_paint.html
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@
</tr>
</tbody>
</table>

<div class="button" style="margin:14px;width:calc(100% - 28px);" onclick="save_png()">Save image/png</div>
</div>
</div>
Expand Down Expand Up @@ -444,7 +443,7 @@
<div id="toast"></div>
<div id='about' style="display:none"><div class='window' style='padding:24px 16px;width:412px;'>
<div><div class='window_close icon icon_close' onclick='modal_window(false)'></div></div>
<div align='center'><p style='font-size:22px;'>ASCII Art Paint</p><hr><p style=''>Release: 5</p><br><br>
<div align='center'><p style='font-size:22px;'>ASCII Art Paint</p><hr><p style=''>Release: 6</p><br><br>
<table style='border-spacing:10px;border-collapse:separate; width: 100%;'>
<tr><td align='right' colspan='1'>E-Mail:</td><td align='left' colspan='3'><a href='mailto:[email protected]' target='_blank'>[email protected]</a></td></tr>
<tr><td align='right' colspan='1'>WebSite:</td><td align='left' colspan='3'><a href='https://github.com/Kirilllive/ASCII_Art_Paint' target='_blank'>https://github.com/Kirilllive/ASCII_Art_Paint</a></td></tr>
Expand Down Expand Up @@ -489,6 +488,7 @@
<div id="palette_apply" class="button" style="margin-top:16px;" onclick="applyChar();modal_window(false);">Apply</div>
</div>
</div>
<div id="cursor_text" style="position:fixed;background-color:var(--ac);padding:4px;">ppp</div>
<div id="replaces" style="display:none"><div class='window' style='padding:24px 16px;width:128px;'></div></div>
<script>
var range_font=[0,13313],edit_p=false,palette="██▓▒░☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼`⌂ÇæÆ¢£¥₧ƒªº¿⌐¬½¼¡«»│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙⋅√ⁿ²■";
Expand All @@ -504,8 +504,9 @@
context_menu.style.left=(e.clientX+asciiscreen.scrollLeft-doc.left)/scale+"px";
context_menu.style.top=(e.clientY+asciiscreen.scrollTop-doc.top)/scale+"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('mouseup',function(){mouseclick=false;})
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('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;})//if(tool==0){canvas.getElementsByTagName('tr')[targetcell[1]].getElementsByTagName('td')[targetcell[0]].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;
Expand All @@ -515,7 +516,7 @@
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;};
viewport.onmouseleave=function(){viewport.onmousemove=null;viewport.onmouseup=null;document.onmousemove=null;document.onmouseup=null;};
}
}else if(tool==5){cursor_text.style.display="block";}
})
let color_ui=[
['#cec8e3','#efefff','rgba(110,95,165,0.25)','rgba(110,95,165,0.5)','#fff','none','#000','rgba(255,255,255,0.8)','rgba(240,240,240,0.8)','#efefff'],
Expand Down Expand Up @@ -549,7 +550,7 @@
function toast(message){var toast=document.getElementById("toast");toast.classList.remove("toast_anim");toast.innerHTML=message;void toast.offsetParent;toast.classList.add("toast_anim");}
function select_tool(n){
var e,tools_ele=document.getElementsByClassName('tools')
if(n==0){tool=2}else if(n==1){tool=0}else if(n==2){tool=3}else if(n==3){tool=1}else {tool=n}
if(n==0){tool=2}else if(n==1){tool=0}else if(n==2){tool=3}else if(n==3){tool=1}else{tool=n}
for (e=0;e<tools_ele.length;e++){if(e!=n){tools_ele[e].style.backgroundColor="";}else{tools_ele[e].style.backgroundColor="var(--cb)";}}
modal_tool(false)
}
Expand Down Expand Up @@ -597,7 +598,7 @@
tr=document.createElement("tr");
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+";cur_y.innerHTML="+y+";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("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("oncontextmenu","targetcell=["+x+","+y+"]")
if(se&&(x1<=x&&x<=x2)&&(y1<=y&&y<=y2)){td.style.backgroundColor="var(--cw)"}
Expand All @@ -610,7 +611,7 @@
asciiview.style.width=rect.width+512+"px"
}
function select_arr(){
if(selected[1]!=selected[3]||selected[0]!=selected[2]){arr_size.innerHTML=Math.abs(selected[2]-selected[0])+" X "+Math.abs(selected[3]-selected[1])}
if(selected[1]!=selected[3]||selected[0]!=selected[2]){arr_size.innerHTML=(Math.abs(selected[2]-selected[0])+1)+" X "+(Math.abs(selected[3]-selected[1])+1)}
tr=canvas.getElementsByTagName('tr');
for(var y=0;y<tr.length;y++){
td=tr[y].getElementsByTagName('td');
Expand All @@ -620,7 +621,7 @@
else{td[x].style.backgroundColor=""}
}else{td[x].style.backgroundColor=""}
};
};
};cursor_text.innerHTML=(Math.abs(selected[2]-selected[0])+1)+" X "+(Math.abs(selected[3]-selected[1])+1);
}
window.addEventListener("DOMContentLoaded", function(){
if (window.File&&window.FileReader&&window.FileList&&window.Blob){
Expand Down Expand Up @@ -737,7 +738,7 @@
for (var e=0;e<symbol_ele.length;e++){if(e!=n){symbol_ele[e].style.backgroundColor="";}else{symbol_ele[e].style.backgroundColor="var(--cb)";}}
}
function get_selected(){
se=(selected[1]!=selected[3]&&selected[0]!=selected[2])?true:false;
se=(selected[1]!=selected[3]||selected[0]!=selected[2])?true:false;
if(se){
if(selected[0]>selected[2]){x1=selected[2];x2=selected[0]}else{x1=selected[0];x2=selected[2];}
if(selected[1]>selected[3]){y1=selected[3];y2=selected[1]}else{y1=selected[1];y2=selected[3];}
Expand Down

0 comments on commit e8d4728

Please sign in to comment.