2021-02-17 20:59:49 +03:00
|
|
|
function create(isSplash) {
|
|
|
|
var splashPostfix = '';
|
|
|
|
// If I'm creating from the splash menu, I append '-splash' so I get the corresponding values
|
|
|
|
if (isSplash) {
|
|
|
|
splashPostfix = '-splash';
|
|
|
|
}
|
|
|
|
|
|
|
|
var width = getValue('size-width' + splashPostfix);
|
|
|
|
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');
|
|
|
|
|
|
|
|
newPixel(width, height, mode);
|
|
|
|
|
|
|
|
// If I'm not creating from the splash page, then this is not the first project I've created
|
|
|
|
if (!isSplash)
|
|
|
|
document.getElementById('new-pixel-warning').style.display = 'block';
|
|
|
|
|
|
|
|
//get selected palette name
|
|
|
|
var selectedPalette = getText('palette-button' + splashPostfix);
|
|
|
|
if (selectedPalette == 'Choose a palette...')
|
|
|
|
selectedPalette = 'none';
|
|
|
|
|
|
|
|
//track google event
|
|
|
|
ga('send', 'event', 'Pixel Editor New', selectedPalette, width+'/'+height); /*global ga*/
|
|
|
|
|
|
|
|
|
|
|
|
//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...');
|
|
|
|
}
|
|
|
|
|
2020-12-31 15:05:51 +03:00
|
|
|
/** Triggered when the "Create" button in the new pixel dialogue is pressed
|
|
|
|
*
|
|
|
|
*/
|
2019-03-27 02:20:54 +03:00
|
|
|
on('click', 'create-button', function (){
|
2020-12-31 15:05:51 +03:00
|
|
|
// Getting the values of the form
|
2020-04-04 10:41:56 +03:00
|
|
|
var width = getValue('size-width');
|
|
|
|
var height = getValue('size-height');
|
2020-07-20 13:59:04 +03:00
|
|
|
var mode = getValue("editor-mode");
|
2020-12-31 15:05:51 +03:00
|
|
|
|
|
|
|
// Creating a new pixel with those properties
|
2020-07-21 00:33:17 +03:00
|
|
|
newPixel(width, height, mode);
|
2020-04-04 10:41:56 +03:00
|
|
|
document.getElementById('new-pixel-warning').style.display = 'block';
|
|
|
|
|
|
|
|
//get selected palette name
|
|
|
|
var selectedPalette = getText('palette-button');
|
|
|
|
if (selectedPalette == 'Choose a palette...')
|
|
|
|
selectedPalette = 'none';
|
|
|
|
|
|
|
|
//track google event
|
2019-03-27 02:20:54 +03:00
|
|
|
ga('send', 'event', 'Pixel Editor New', selectedPalette, width+'/'+height); /*global ga*/
|
2020-04-04 10:41:56 +03:00
|
|
|
|
|
|
|
|
|
|
|
//reset new form
|
|
|
|
setValue('size-width', 64);
|
|
|
|
setValue('size-height', 64);
|
2020-07-20 13:59:04 +03:00
|
|
|
setValue("editor-mode", 'Advanced')
|
|
|
|
|
|
|
|
setText('editor-mode-button', 'Choose a mode...');
|
2020-04-04 10:41:56 +03:00
|
|
|
setText('palette-button', 'Choose a palette...');
|
|
|
|
setText('preset-button', 'Choose a preset...');
|
|
|
|
});
|
2021-02-17 20:59:49 +03:00
|
|
|
|
|
|
|
/** Triggered when the "Create" button in the new pixel dialogue is pressed
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
on('click', 'create-button-splash', function (){
|
|
|
|
// Getting the values of the form
|
|
|
|
var width = getValue('size-width-splash');
|
|
|
|
var height = getValue('size-height-splash');
|
2021-04-25 13:41:36 +03:00
|
|
|
var mode = pixelEditorMode;
|
|
|
|
|
|
|
|
if (mode == 'Advanced')
|
|
|
|
mode = "Basic";
|
|
|
|
else
|
|
|
|
mode = "Advanced";
|
2021-02-17 20:59:49 +03:00
|
|
|
|
|
|
|
// Creating a new pixel with those properties
|
|
|
|
newPixel(width, height, mode);
|
|
|
|
|
|
|
|
//track google event
|
|
|
|
ga('send', 'event', 'Pixel Editor New', selectedPalette, width+'/'+height); /*global ga*/
|
2021-04-25 13:41:36 +03:00
|
|
|
document.getElementById('new-pixel-warning').style.display = 'block';
|
2021-02-17 20:59:49 +03:00
|
|
|
|
2021-04-25 13:41:36 +03:00
|
|
|
// Resetting the new pixel values
|
|
|
|
selectedPalette = 'none';
|
2021-02-17 20:59:49 +03:00
|
|
|
|
2021-04-25 13:41:36 +03:00
|
|
|
//reset new pixel form
|
2021-02-17 20:59:49 +03:00
|
|
|
setValue('size-width-splash', 64);
|
|
|
|
setValue('size-height-splash', 64);
|
2021-04-25 13:41:36 +03:00
|
|
|
setValue("editor-mode", 'Advanced')
|
2021-02-17 20:59:49 +03:00
|
|
|
|
|
|
|
setText('editor-mode-button', 'Choose a mode...');
|
|
|
|
setText('palette-button', 'Choose a palette...');
|
2021-04-25 13:41:36 +03:00
|
|
|
setText('preset-button', 'Choose a preset...');
|
2021-02-17 20:59:49 +03:00
|
|
|
});
|