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

View file

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