From c61f19adeb39b4bedab47338df5313dec3b8d65d Mon Sep 17 00:00:00 2001 From: Dennis Kehrig Date: Fri, 30 Aug 2013 16:06:56 -0700 Subject: [PATCH] First check if we know the file at all before figuring out whether the changes are complex --- main.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/main.js b/main.js index 50eb2afb..23f0a41e 100644 --- a/main.js +++ b/main.js @@ -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) { @@ -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);