Almost finished deleting layers

There's a bug that happens when the user tries to delete the Layer 0. All the other ones work correctly.
This commit is contained in:
unsettledgames
2020-06-22 23:07:40 +02:00
parent 349a4417d8
commit 50b962a7f5
5 changed files with 147 additions and 27 deletions

View File

@ -10,6 +10,18 @@ function isPixelEmpty(pixel) {
return false;
}
function isChildOfByClass(element, className) {
while (element != null && element.classList != null && !element.classList.contains(className)) {
element = element.parentElement;
}
if (element != null && element.classList != null && element.classList.contains(className)) {
return true;
}
return false;
}
function getEyedropperColor(cursorLocation) {
let max = -1;
let tmpColour;
@ -32,4 +44,17 @@ function getEyedropperColor(cursorLocation) {
}
return selectedColor;
}
function getElementAbsolutePosition(element) {
let curleft = curtop = 0;
if (element.offsetParent) {
do {
curleft += element.offsetLeft;
curtop += element.offsetTop;
} while (element = element.offsetParent);
}
return [curleft,curtop];
}