Skip to content
Snippets Groups Projects
Unverified Commit f9ca3a67 authored by Giovanni Caruso's avatar Giovanni Caruso Committed by Alexander Harkness
Browse files

Fixed palette not updating label

parent 0aba3122
No related branches found
No related tags found
1 merge request!45Brush size
......@@ -107,7 +107,7 @@ for (let i = 1; i < svg.length; i++) {
const paletteColour = event.target.getAttribute("fill")
HTML.rectangle.style.backgroundColor = paletteColour
HTML.picker.value = paletteColour
HTML.labelColour.style.backgroundColor = paletteColour
HTML.labelColours.style.backgroundColor = paletteColour
canvas.setStrokeColour(paletteColour)
hideElement(HTML.palette)
})
......@@ -147,6 +147,21 @@ x.addListener(() => {
}
})
function showElement(element) {
element.style.display = "block"
}
function hideElement(element) {
element.style.display = "none"
}
HTML.picker.addEventListener("change", () => {
var paletteColour = event.target.value
HTML.rectangle.style.backgroundColor = paletteColour
HTML.labelColours.style.backgroundColor = paletteColour
canvas.setStrokeColour(paletteColour)
})
HTML.eraserButton.addEventListener("click", () => {
currentTool = tools.ERASER
HTML.penButton.classList.remove("selected")
......
......@@ -29,3 +29,5 @@ export const picker = document.getElementById("other-colours")
export const labelColour = document.getElementById("colours")
export const slider = document.getElementById("range")
export const output = document.getElementById("value")
export const picker = document.getElementById("other-colours")
export const labelColours = document.getElementById("colours")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment