Skip to content

Commit f9a87cc

Browse files
Final refinements
1 parent e51f510 commit f9a87cc

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

css/_colors-menu.scss

+3-2
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,11 @@
212212
}
213213

214214
#colors-menu-settings {
215-
width: 100%;
215+
width: 98%;
216216
padding: 0px 0px 0px 0px;
217217
position:relative;
218218
top:0px;
219+
background: $basecolor;
219220

220221
button {
221222
position:relative;
@@ -224,7 +225,7 @@
224225
margin-left:0px;
225226
padding: 2px;
226227
height:30px;
227-
width:45.7%;
228+
width:49%;
228229
color: $basetext;
229230
background: $basecolor;
230231
border:none;

js/ColorModule.js

+4-15
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const ColorModule = (() => {
1515
// Binding events to callbacks
1616
document.getElementById('jscolor-hex-input').addEventListener('change',colorChanged, false);
1717
document.getElementById('jscolor-hex-input').addEventListener('input', colorChanged, false);
18-
document.getElementById('add-color-button').addEventListener('click', addColorButtonEvent, false);
18+
document.getElementById('add-color-button').addEventListener('click', addColorButtonEvent);
1919

2020
Events.on("wheel", "colors-menu", resizeSquares);
2121
Events.on("click", document.getElementById("cm-add"), addColorButtonEvent);
@@ -152,11 +152,6 @@ const ColorModule = (() => {
152152
*
153153
*/
154154
function addColorButtonEvent() {
155-
if (EditorState.getCurrentMode() == "Advanced") {
156-
Dialogue.showDialogue("palette-block");
157-
return;
158-
}
159-
160155
//generate random color
161156
const newColor = new Color("hsv", Math.floor(Math.random()*360), Math.floor(Math.random()*100), Math.floor(Math.random()*100)).hex;
162157

@@ -172,11 +167,6 @@ const ColorModule = (() => {
172167

173168
//add history state
174169
new HistoryState().AddColor(addedColor.firstElementChild.jscolor.toString());
175-
176-
//show color picker
177-
addedColor.firstElementChild.jscolor.show();
178-
//hide edit button
179-
addedColor.lastChild.classList.add('hidden');
180170
}
181171

182172
/** Adds the colors that have been added through the advanced-mode color picker to the
@@ -271,7 +261,8 @@ const ColorModule = (() => {
271261
Dialogue.showDialogue("palette-block", false);
272262
});
273263

274-
colorsMenu.children[0].classList.add('selected');
264+
if (!document.querySelector('#colors-menu li.selected'))
265+
colorsMenu.children[0].classList.add('selected');
275266
return listItem;
276267
}
277268

@@ -492,9 +483,7 @@ const ColorModule = (() => {
492483
}
493484
}
494485

495-
//create palette from colors array
496-
createColorPalette(colorPaletteArray);
497-
486+
return colorPaletteArray;
498487
}
499488

500489
function updateCurrentColor(color, refLayer) {

0 commit comments

Comments
 (0)