Skip to content

Commit

Permalink
First check if we know the file at all before figuring out whether th…
Browse files Browse the repository at this point in the history
…e changes are complex
  • Loading branch information
Dennis Kehrig authored and joelrbrandt committed Aug 31, 2013
1 parent 32bc0a3 commit c61f19a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,20 @@
}
}

var documentContext = _contextPerDocument[document.id],
unknownChange = false,
var documentContext = _contextPerDocument[document.id];

// Possible reasons for an undefined context:
// - User created a new image
// - User opened an image
// - User switched to an image that was created/opened before Generator started
if (!documentContext) {
console.log("Unknown document, so getting all information");
requestEntireDocument(document.id);
return;
}

// We have seen this document before: information about the changes are enough
var unknownChange = false,
layersMoved = false;

traverseLayers(document, function (obj, isLayer) {
Expand Down Expand Up @@ -473,18 +485,6 @@
return;
}

// Possible reasons for an undefined context:
// - User created a new image
// - User opened an image
// - User switched to an image that was created/opened before Generator started
if (!documentContext) {
console.log("Unknown document, so getting all information");
requestEntireDocument(document.id);
return;
}

// We have seen this document before: information about the changes are enough

// Resize event: regenerate everything
if (!document.layers && document.bounds) {
requestEntireDocument(document.id);
Expand Down

0 comments on commit c61f19a

Please sign in to comment.