Final refinements

This commit is contained in:
Nicola 2022-10-24 13:06:41 +02:00
parent e51f510392
commit f9a87cc46e
2 changed files with 7 additions and 17 deletions

View File

@ -212,10 +212,11 @@
} }
#colors-menu-settings { #colors-menu-settings {
width: 100%; width: 98%;
padding: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;
position:relative; position:relative;
top:0px; top:0px;
background: $basecolor;
button { button {
position:relative; position:relative;
@ -224,7 +225,7 @@
margin-left:0px; margin-left:0px;
padding: 2px; padding: 2px;
height:30px; height:30px;
width:45.7%; width:49%;
color: $basetext; color: $basetext;
background: $basecolor; background: $basecolor;
border:none; border:none;

View File

@ -15,7 +15,7 @@ const ColorModule = (() => {
// Binding events to callbacks // Binding events to callbacks
document.getElementById('jscolor-hex-input').addEventListener('change',colorChanged, false); document.getElementById('jscolor-hex-input').addEventListener('change',colorChanged, false);
document.getElementById('jscolor-hex-input').addEventListener('input', colorChanged, false); document.getElementById('jscolor-hex-input').addEventListener('input', colorChanged, false);
document.getElementById('add-color-button').addEventListener('click', addColorButtonEvent, false); document.getElementById('add-color-button').addEventListener('click', addColorButtonEvent);
Events.on("wheel", "colors-menu", resizeSquares); Events.on("wheel", "colors-menu", resizeSquares);
Events.on("click", document.getElementById("cm-add"), addColorButtonEvent); Events.on("click", document.getElementById("cm-add"), addColorButtonEvent);
@ -152,11 +152,6 @@ const ColorModule = (() => {
* *
*/ */
function addColorButtonEvent() { function addColorButtonEvent() {
if (EditorState.getCurrentMode() == "Advanced") {
Dialogue.showDialogue("palette-block");
return;
}
//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;
@ -172,11 +167,6 @@ const ColorModule = (() => {
//add history state //add history state
new HistoryState().AddColor(addedColor.firstElementChild.jscolor.toString()); new HistoryState().AddColor(addedColor.firstElementChild.jscolor.toString());
//show color picker
addedColor.firstElementChild.jscolor.show();
//hide edit button
addedColor.lastChild.classList.add('hidden');
} }
/** Adds the colors that have been added through the advanced-mode color picker to the /** Adds the colors that have been added through the advanced-mode color picker to the
@ -271,7 +261,8 @@ const ColorModule = (() => {
Dialogue.showDialogue("palette-block", false); Dialogue.showDialogue("palette-block", false);
}); });
colorsMenu.children[0].classList.add('selected'); if (!document.querySelector('#colors-menu li.selected'))
colorsMenu.children[0].classList.add('selected');
return listItem; return listItem;
} }
@ -492,9 +483,7 @@ const ColorModule = (() => {
} }
} }
//create palette from colors array return colorPaletteArray;
createColorPalette(colorPaletteArray);
} }
function updateCurrentColor(color, refLayer) { function updateCurrentColor(color, refLayer) {