From e0e634d7f7a9e7038b38c20acbdf06bdd0a07dfa Mon Sep 17 00:00:00 2001 From: skeddles Date: Tue, 6 Jul 2021 21:05:41 -0400 Subject: [PATCH] remove mode picker from new pixel dialog --- js/_createButton.js | 11 ++------- js/_editorMode.js | 49 ------------------------------------- js/_onLoad.js | 2 +- js/_palettes.js | 1 - views/start-pixel-popup.hbs | 7 ------ 5 files changed, 3 insertions(+), 67 deletions(-) diff --git a/js/_createButton.js b/js/_createButton.js index 23b807f..bda39d5 100644 --- a/js/_createButton.js +++ b/js/_createButton.js @@ -9,7 +9,7 @@ function create(isSplash) { var height = getValue('size-height' + splashPostfix); // If I'm creating from the splash screen, I use the splashMode variable - var mode = isSplash ? splashMode : getValue('editor-mode'); + var mode = isSplash ? splashMode : pixelEditorMode; newPixel(width, height, mode); @@ -29,9 +29,7 @@ function create(isSplash) { //reset new form setValue('size-width', 64); setValue('size-height', 64); - setValue("editor-mode", 'Advanced') - setText('editor-mode-button', 'Choose a mode...'); setText('palette-button', 'Choose a palette...'); setText('preset-button', 'Choose a preset...'); } @@ -43,10 +41,9 @@ on('click', 'create-button', function (){ // Getting the values of the form var width = getValue('size-width'); var height = getValue('size-height'); - var mode = getValue("editor-mode"); // Creating a new pixel with those properties - newPixel(width, height, mode); + newPixel(width, height); document.getElementById('new-pixel-warning').style.display = 'block'; //get selected palette name @@ -61,9 +58,7 @@ on('click', 'create-button', function (){ //reset new form setValue('size-width', 64); setValue('size-height', 64); - setValue("editor-mode", 'Advanced') - setText('editor-mode-button', 'Choose a mode...'); setText('palette-button', 'Choose a palette...'); setText('preset-button', 'Choose a preset...'); }); @@ -95,9 +90,7 @@ on('click', 'create-button-splash', function (){ //reset new pixel form setValue('size-width-splash', 64); setValue('size-height-splash', 64); - setValue("editor-mode", 'Advanced') - setText('editor-mode-button', 'Choose a mode...'); setText('palette-button', 'Choose a palette...'); setText('preset-button', 'Choose a preset...'); }); diff --git a/js/_editorMode.js b/js/_editorMode.js index 0181f0c..9d98cf2 100644 --- a/js/_editorMode.js +++ b/js/_editorMode.js @@ -7,8 +7,6 @@ let modes = { } } -let infoBox = document.getElementById('editor-mode-info'); - on('click', 'switch-editor-mode-splash', function (e) { console.log('switching mode') switchMode(); @@ -74,50 +72,3 @@ function switchMode(mustConfirm = true) { on('click', 'switch-mode-button', function (e) { switchMode(); }); - -// Makes the menu open -on('click', 'editor-mode-button', function (e){ - //open or close the preset menu - toggle('editor-mode-button'); - toggle('editor-mode-menu'); - - //close the palette menu - deselect('palette-button'); - deselect('palette-menu'); - - //close the preset menu - deselect('preset-button'); - deselect('preset-menu'); - - //stop the click from propogating to the parent element - e.stopPropagation(); -}); - -//populate preset list in new pixel menu -Object.keys(modes).forEach(function(modeName,index) { - var editorModeMenu = document.getElementById('editor-mode-menu'); - - //create button - var button = document.createElement('button'); - button.appendChild(document.createTextNode(modeName)); - - //insert new element - editorModeMenu.appendChild(button); - - //add click event listener - on('click', button, function() { - - //change mode on new pixel - setValue('editor-mode', modeName); - // Change description - infoBox.innerHTML = modes[modeName].description; - - //hide the dropdown menu - deselect('editor-mode-menu'); - deselect('editor-mode-button'); - - //set the text of the dropdown to the newly selected mode - setText('editor-mode-button', modeName); - }); - -}); \ No newline at end of file diff --git a/js/_onLoad.js b/js/_onLoad.js index 008d59b..90d8367 100644 --- a/js/_onLoad.js +++ b/js/_onLoad.js @@ -47,7 +47,7 @@ window.onload = function () { //firstPixel = false; //create new document - newPixel(width, height, getValue('editor-mode')); + newPixel(width, height); } //dimentions were not specified -- show splash screen with palette preselected diff --git a/js/_palettes.js b/js/_palettes.js index e16b728..4f789f2 100644 --- a/js/_palettes.js +++ b/js/_palettes.js @@ -141,7 +141,6 @@ palettes["Gameboy Color"] = {"name":"Nintendo Gameboy (Black Zero)","author":"", }) newPixelElement.addEventListener('click', () => { - Util.deselect('editor-mode-menu'); Util.deselect('preset-button'); Util.deselect('preset-menu'); Util.deselect('palette-button'); diff --git a/views/start-pixel-popup.hbs b/views/start-pixel-popup.hbs index 896325b..a35cad0 100644 --- a/views/start-pixel-popup.hbs +++ b/views/start-pixel-popup.hbs @@ -3,13 +3,6 @@

New Pixel

- -

Editor mode

- - - -

-

Preset