mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Resolved previous color selection i,e issue #111
This commit is contained in:
parent
cfaa22c48a
commit
08eb130301
@ -158,14 +158,15 @@ const ColorModule = (() => {
|
|||||||
*/
|
*/
|
||||||
function addColorButtonEvent() {
|
function addColorButtonEvent() {
|
||||||
//generate random color
|
//generate random color
|
||||||
const newColor = new Color("hsv", Math.floor(Math.random()*360), Math.floor(Math.random()*100), Math.floor(Math.random()*100)).hex;
|
const newColor = new Color("hsv", Math.floor(Math.random()*360), Math.floor(Math.random()*100), Math.floor(Math.random()*100)).hex;
|
||||||
|
|
||||||
//remove current color selection
|
|
||||||
document.querySelector('#colors-menu li.selected')?.classList.remove('selected');
|
|
||||||
|
|
||||||
//add new color and make it selected
|
//add new color and make it selected
|
||||||
let addedColor = addColor(newColor);
|
let addedColor = addColor(newColor);
|
||||||
addedColor.classList.add('selected');
|
addedColor.classList.add('selected');
|
||||||
|
|
||||||
|
//remove previous color selection
|
||||||
|
document.querySelector('#colors-menu li.selected')?.classList.remove('selected');
|
||||||
|
|
||||||
addedColor.style.width = squareSize + "px";
|
addedColor.style.width = squareSize + "px";
|
||||||
addedColor.style.height = squareSize + "px";
|
addedColor.style.height = squareSize + "px";
|
||||||
updateCurrentColor(newColor);
|
updateCurrentColor(newColor);
|
||||||
|
Loading…
Reference in New Issue
Block a user