Merge pull request #55 from LLK/bugfix/autosave-disable

Disable autosave when onHold, Project.saving, or info box open
This commit is contained in:
Tim Mickel 2016-04-11 14:31:28 -04:00
commit d928f81821
2 changed files with 9 additions and 2 deletions

View file

@ -206,7 +206,7 @@ export default class ScratchJr {
Events.init(); Events.init();
if (window.Settings.autoSaveInterval > 0) { if (window.Settings.autoSaveInterval > 0) {
autoSaveSetInterval = window.setInterval(function () { autoSaveSetInterval = window.setInterval(function () {
if (autoSaveEnabled) { if (autoSaveEnabled && !onHold && !Project.saving && !UI.infoBoxOpen) {
ScratchJr.saveProject(null, function () { ScratchJr.saveProject(null, function () {
Alert.close(); Alert.close();
}); });
@ -346,7 +346,7 @@ export default class ScratchJr {
// Re-enable autosaves // Re-enable autosaves
autoSaveEnabled = true; autoSaveEnabled = true;
autoSaveSetInterval = window.setInterval(function () { autoSaveSetInterval = window.setInterval(function () {
if (autoSaveEnabled) { if (autoSaveEnabled && !onHold && !Project.saving && !UI.infoBoxOpen) {
ScratchJr.saveProject(null, function () { ScratchJr.saveProject(null, function () {
Alert.close(); Alert.close();
}); });

View file

@ -26,8 +26,13 @@ import {frame, gn, CSSTransition, localx, newHTML, scaleMultiplier, getIdFor, is
let projectNameTextInput = null; let projectNameTextInput = null;
let info = null; let info = null;
let okclicky = null; let okclicky = null;
let infoBoxOpen = false;
export default class UI { export default class UI {
static get infoBoxOpen () {
return infoBoxOpen;
}
static layout () { static layout () {
UI.topSection(); UI.topSection();
UI.middleSection(); UI.middleSection();
@ -350,6 +355,7 @@ export default class UI {
} }
static showInfoBox (e) { static showInfoBox (e) {
infoBoxOpen = true;
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
if (Paint.saving) { if (Paint.saving) {
@ -432,6 +438,7 @@ export default class UI {
ScratchAudio.sndFX('exittap.wav'); ScratchAudio.sndFX('exittap.wav');
gn('infobox').className = 'infobox fade'; gn('infobox').className = 'infobox fade';
} }
infoBoxOpen = false;
} }
////////////////////////////////////// //////////////////////////////////////