Fix bug where coloring in same pixel and dragging over it with color prevents undo from working properly

This commit is contained in:
Joshua Sigona 2020-06-14 20:57:04 +09:00
parent cc8e2bbffb
commit c2dd7a2b12

View File

@ -130,6 +130,7 @@ document.addEventListener("DOMContentLoaded",()=>{
if (e.target.tagName==="TH") { if (e.target.tagName==="TH") {
if (mouseState>=0) { if (mouseState>=0) {
var mycoords = getCoordinates(e.target) var mycoords = getCoordinates(e.target)
if (!(e.target.id in changedPixels)) {
if ("PIXELS" in changedPixels) { if ("PIXELS" in changedPixels) {
changedPixels["PIXELS"]+=","+mycoords.x+","+mycoords.y changedPixels["PIXELS"]+=","+mycoords.x+","+mycoords.y
} else { } else {
@ -148,6 +149,7 @@ document.addEventListener("DOMContentLoaded",()=>{
} }
} }
} }
}
var MouseClickListener = (e)=>{ var MouseClickListener = (e)=>{
e.preventDefault(); e.preventDefault();
} }
@ -198,6 +200,7 @@ document.addEventListener("DOMContentLoaded",()=>{
if (!fillTool) { if (!fillTool) {
if (e.target.tagName==="TH") { if (e.target.tagName==="TH") {
var mycoords = getCoordinates(e.target) var mycoords = getCoordinates(e.target)
if (!(e.target.id in changedPixels)) {
if ("PIXELS" in changedPixels) { if ("PIXELS" in changedPixels) {
changedPixels["PIXELS"]+=","+mycoords.x+","+mycoords.y changedPixels["PIXELS"]+=","+mycoords.x+","+mycoords.y
} else { } else {
@ -214,6 +217,7 @@ document.addEventListener("DOMContentLoaded",()=>{
changedPixels["STEPTYPE"]="ADD" changedPixels["STEPTYPE"]="ADD"
} }
} }
}
toolbar.style.visibility = "hidden"; toolbar.style.visibility = "hidden";
} }