Fixed tool color

Fixed ellipse filling the whole canvas when changing tool
This commit is contained in:
Nicola
2022-10-24 15:04:09 +02:00
parent f9a87cc46e
commit 74665db3de
15 changed files with 99 additions and 69 deletions

View File

@@ -121,11 +121,11 @@ const ColorModule = (() => {
const currentSelectedColorButton = document.querySelector('#colors-menu li.selected .color-button');
const selectedColor = currentSelectedColorButton.style.backgroundColor;
const clickedColor = e.target.style.backgroundColor;
document.querySelector('#colors-menu li.selected')?.classList.remove('selected');
//set current color
updateCurrentColor(Color.cssToHex(clickedColor));
//make color selected
e.target.parentElement.classList.add('selected');
@@ -141,10 +141,15 @@ const ColorModule = (() => {
}
//right clicked color
else if (e.which == 3) {
//hide edit color button (to prevent it from showing)
e.target.parentElement.lastChild.classList.add('hidden');
//show color picker
e.target.jscolor.show();
if (EditorState.getCurrentMode() == "Basic") {
//hide edit color button (to prevent it from showing)
e.target.parentElement.lastChild.classList.add('hidden');
//show color picker
e.target.jscolor.show();
}
else {
Dialogue.showDialogue("palette-block");
}
}
}
@@ -497,6 +502,11 @@ const ColorModule = (() => {
currFile.layers[i].context.fillStyle = color;
currFile.layers[i].context.strokeStyle = color;
}
for (let i=0; i<currFile.sublayers.length; i++) {
currFile.sublayers[i].context.fillStyle = color;
currFile.sublayers[i].context.strokeStyle = color;
}
}
function getSelectedColor() {