diff --git a/js/_colorPicker.js b/js/_colorPicker.js index 6554269..007f204 100644 --- a/js/_colorPicker.js +++ b/js/_colorPicker.js @@ -462,6 +462,8 @@ function updatePickerByHex(hex) { activePickerIcon.style.left = '' + xPos + 'px'; activePickerIcon.style.top = '' + (miniPickerCanvas.height - yPos) + 'px'; activePickerIcon.style.backgroundColor = '#' + getMiniPickerColour(); + + colourPreview.style.backgroundColor = hex; updateOtherIcons(); updateMiniSlider(hex); @@ -521,6 +523,7 @@ function updateMiniSlider(hex) { styles[1] += "background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(0,0,0,1) 0%, " + "rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ",1) 100%);}"; + updateMiniPickerSpectrum(); updateStyles(); } @@ -785,7 +788,6 @@ function getSelectedColours() { } function getHexPreviewColour(hex) { - //if brightness is over threshold, make the text dark if (colorBrightness(hex) > 110) { return '#332f35' diff --git a/js/_dialogue.js b/js/_dialogue.js index f336a5e..6159881 100644 --- a/js/_dialogue.js +++ b/js/_dialogue.js @@ -1,3 +1,5 @@ +let currentOpenDialogue = ""; + /** Shows the dialogue window called dialogueName, which is a child of pop-up-container in pixel-editor.hbs * * @param {*} dialogueName The name of the window to show @@ -6,6 +8,8 @@ function showDialogue (dialogueName, trackEvent) { if (typeof trackEvent === 'undefined') trackEvent = true; + // Updating currently open dialogue + currentOpenDialogue = dialogueName; // The pop up window is open dialogueOpen = true; // Showing the pop up container @@ -30,14 +34,14 @@ function showDialogue (dialogueName, trackEvent) { */ function closeDialogue () { popUpContainer.style.display = 'none'; - var popups = popUpContainer.children; + for (var i = 0; i < popups.length; i++) { popups[i].style.display = 'none'; + } - if (popups[i].id == "palette-block") { - pbAddToSimplePalette(); - } + if (currentOpenDialogue == "palette-block") { + pbAddToSimplePalette(); } dialogueOpen = false; diff --git a/js/_paletteBlock.js b/js/_paletteBlock.js index f6341f5..adaf06d 100644 --- a/js/_paletteBlock.js +++ b/js/_paletteBlock.js @@ -1,3 +1,5 @@ +/** INIT is called when it shouldn't **/ + let coloursList = document.getElementById("palette-list"); let rampMenu = document.getElementById("pb-ramp-options"); @@ -21,17 +23,18 @@ new ResizeObserver(updateSizeData).observe(coloursList.parentElement); // Initializes the palette block function pbInit() { let simplePalette = document.getElementById("colors-menu"); + let childCount = coloursList.childElementCount; currentSquareSize = coloursList.children[0].clientWidth; coloursList = document.getElementById("palette-list"); // Remove all the colours - for (let i=0; i
-

Edit palette

+ + +

Edit palette