mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
addColor Refactor
This commit is contained in:
parent
0d545fba25
commit
ba50aa3369
@ -162,10 +162,10 @@ const ColorModule = (() => {
|
|||||||
newColor = '#' + newColor;
|
newColor = '#' + newColor;
|
||||||
currentPalette.push(newColor);
|
currentPalette.push(newColor);
|
||||||
//create list item
|
//create list item
|
||||||
var listItem = document.createElement('li');
|
const listItem = document.createElement('li');
|
||||||
|
|
||||||
//create button
|
//create button
|
||||||
var button = document.createElement('button');
|
const button = document.createElement('button');
|
||||||
button.classList.add('color-button');
|
button.classList.add('color-button');
|
||||||
button.style.backgroundColor = newColor;
|
button.style.backgroundColor = newColor;
|
||||||
button.addEventListener('mouseup', clickedColor);
|
button.addEventListener('mouseup', clickedColor);
|
||||||
@ -179,13 +179,11 @@ const ColorModule = (() => {
|
|||||||
initColor(button);
|
initColor(button);
|
||||||
|
|
||||||
//add edit button
|
//add edit button
|
||||||
var editButtonTemplate = document.getElementsByClassName('color-edit-button')[0];
|
const editButtonTemplate = document.getElementsByClassName('color-edit-button')[0];
|
||||||
newEditButton = editButtonTemplate.cloneNode(true);
|
newEditButton = editButtonTemplate.cloneNode(true);
|
||||||
listItem.appendChild(newEditButton);
|
listItem.appendChild(newEditButton);
|
||||||
|
|
||||||
//when you click the edit button
|
newEditButton.addEventListener('click', (e,button) => {
|
||||||
on('click', newEditButton, function (event, button) {
|
|
||||||
|
|
||||||
//hide edit button
|
//hide edit button
|
||||||
button.parentElement.lastChild.classList.add('hidden');
|
button.parentElement.lastChild.classList.add('hidden');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user