2019-03-27 02:20:54 +03:00
|
|
|
//color in palette has been clicked
|
|
|
|
function clickedColor (e){
|
|
|
|
|
|
|
|
//left clicked color
|
|
|
|
if (e.which == 1) {
|
|
|
|
|
|
|
|
//remove current color selection
|
|
|
|
var selectedColor = document.querySelector("#colors-menu li.selected")
|
|
|
|
if (selectedColor) selectedColor.classList.remove("selected");
|
|
|
|
|
|
|
|
//set current color
|
2019-03-31 17:32:49 +03:00
|
|
|
currentLayer.context.fillStyle = this.style.backgroundColor;
|
2020-03-07 01:21:42 +03:00
|
|
|
currentGlobalColor = this.style.backgroundColor;
|
2019-03-27 02:20:54 +03:00
|
|
|
|
|
|
|
//make color selected
|
|
|
|
e.target.parentElement.classList.add('selected');
|
|
|
|
|
|
|
|
//right clicked color
|
|
|
|
} else if (e.which == 3) {
|
|
|
|
console.log('right clicked color button')
|
|
|
|
|
|
|
|
//hide edit color button (to prevent it from showing)
|
|
|
|
e.target.parentElement.lastChild.classList.add('hidden');
|
|
|
|
|
|
|
|
//show color picker
|
|
|
|
e.target.jscolor.show();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|