Clean up code
This commit is contained in:
parent
69bbf7b64f
commit
ab7b2c83de
1 changed files with 5 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ let colorValue;
|
||||||
let numGrid; //= gridSlider.value;
|
let numGrid; //= gridSlider.value;
|
||||||
let sliderLabel = document.querySelector("#sliderLabel");
|
let sliderLabel = document.querySelector("#sliderLabel");
|
||||||
|
|
||||||
|
|
||||||
//the next few variables are set to be used to test if
|
//the next few variables are set to be used to test if
|
||||||
//a given button has been clicked
|
//a given button has been clicked
|
||||||
let isRgb;
|
let isRgb;
|
||||||
|
|
@ -39,11 +40,11 @@ function pickBackground() {
|
||||||
|
|
||||||
|
|
||||||
function createGrid() {
|
function createGrid() {
|
||||||
numGrid = gridSlider.value
|
numGrid = gridSlider.value;
|
||||||
const gridArea = numGrid ** 2;
|
const gridArea = numGrid ** 2;
|
||||||
const gridWidth = 100 / numGrid;
|
const gridWidth = 100 / numGrid;
|
||||||
|
|
||||||
sliderLabel.textContent = numGrid
|
sliderLabel.textContent = numGrid;
|
||||||
|
|
||||||
grid.classList.add("grid");
|
grid.classList.add("grid");
|
||||||
grid.style.width = gridWidth + '%';
|
grid.style.width = gridWidth + '%';
|
||||||
|
|
@ -65,11 +66,12 @@ function createGrid() {
|
||||||
|
|
||||||
|
|
||||||
function getGridDimensions() {
|
function getGridDimensions() {
|
||||||
gridSlider.defaultValue = 16;
|
|
||||||
container.style.backgroundColor = "#ffffff";
|
container.style.backgroundColor = "#ffffff";
|
||||||
backColorPicker.value = "#ffffff";
|
backColorPicker.value = "#ffffff";
|
||||||
colorPicker.value = "#000000";
|
colorPicker.value = "#000000";
|
||||||
colorValue = "black";
|
colorValue = "black";
|
||||||
|
gridSlider.defaultValue = 16;
|
||||||
|
numGrid = gridSlider.defaultValue;
|
||||||
|
|
||||||
while (container.firstChild) {
|
while (container.firstChild) {
|
||||||
container.removeChild(container.lastChild);
|
container.removeChild(container.lastChild);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue