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';
|
|
|
|
}
|
|
|
|
|
2021-07-10 00:44:04 +03:00
|
|
|
var width = Util.getValue('size-width' + splashPostfix);
|
|
|
|
var height = Util.getValue('size-height' + splashPostfix);
|
2021-02-17 20:59:49 +03:00
|
|
|
|
2021-07-15 17:33:26 +03:00
|
|
|
newPixel(width, height);
|
2021-02-17 20:59:49 +03:00
|
|
|
|
|
|
|
// 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
|
2021-07-10 00:44:04 +03:00
|
|
|
var selectedPalette = Util.getText('palette-button' + splashPostfix);
|
2021-02-17 20:59:49 +03:00
|
|
|
if (selectedPalette == 'Choose a palette...')
|
|
|
|
selectedPalette = 'none';
|
|
|
|
|
|
|
|
//track google event
|
2021-07-15 17:33:26 +03:00
|
|
|
if (typeof ga !== 'undefined')
|
|
|
|
ga('send', 'event', 'Pixel Editor New', selectedPalette, width+'/'+height); /*global ga*/
|
2021-02-17 20:59:49 +03:00
|
|
|
|
|
|
|
//reset new form
|
2021-07-10 00:44:04 +03:00
|
|
|
Util.setValue('size-width', 64);
|
|
|
|
Util.setValue('size-height', 64);
|
2021-02-17 20:59:49 +03:00
|
|
|
|
2021-07-10 00:44:04 +03:00
|
|
|
Util.setText('palette-button', 'Choose a palette...');
|
|
|
|
Util.setText('preset-button', 'Choose a preset...');
|
2021-02-17 20:59:49 +03:00
|
|
|
}
|
|
|
|
|
2020-12-31 15:05:51 +03:00
|
|
|
/** Triggered when the "Create" button in the new pixel dialogue is pressed
|
|
|
|
*
|
|
|
|
*/
|
2021-07-15 17:33:26 +03:00
|
|
|
Input.on('click', 'create-button', create, false);
|
2021-02-17 20:59:49 +03:00
|
|
|
|
2021-07-14 00:40:23 +03:00
|
|
|
/** Triggered when the "Create" button in the splash page is pressed
|
2021-02-17 20:59:49 +03:00
|
|
|
*
|
|
|
|
*/
|
2021-07-15 17:33:26 +03:00
|
|
|
Input.on('click', 'create-button-splash', create, true);
|