From 0f404d2b256dbaeb2e4ffac218836c34514e830f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Szab=C3=B3?= Date: Fri, 23 Sep 2016 13:00:10 +0200 Subject: [PATCH] Refactor dom initialize flag --- src/js/controller/FramesListController.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/js/controller/FramesListController.js b/src/js/controller/FramesListController.js index 8ec4fe05..0c690db0 100644 --- a/src/js/controller/FramesListController.js +++ b/src/js/controller/FramesListController.js @@ -11,10 +11,10 @@ ns.FramesListController = function (piskelController, container) { this.piskelController = piskelController; this.container = container; - this.domInitialized = false; this.refreshZoom_(); this.redrawFlag = true; + this.regenerateDomFlag = true; this.cachedFrameProcessor = new pskl.model.frame.CachedFrameProcessor(); this.cachedFrameProcessor.setFrameProcessor(this.frameToPreviewCanvas_.bind(this)); @@ -35,11 +35,11 @@ this.updateScrollerOverflows(); }; - ns.FramesListController.prototype.flagForRedraw_ = function (reinitializeDom) { + ns.FramesListController.prototype.flagForRedraw_ = function (regenerateDom) { this.redrawFlag = true; - if (reinitializeDom) { - this.domInitialized = false; + if (regenerateDom) { + this.regenerateDomFlag = true; } }; @@ -49,10 +49,12 @@ ns.FramesListController.prototype.render = function () { if (this.redrawFlag) { - if (!this.domInitialized) { + if (this.regenerateDomFlag) { this.tiles = []; this.addFrameTile = null; this.createPreviews_(); + + this.regenerateDomFlag = false; } this.updatePreviews_(); @@ -177,7 +179,6 @@ this.addFrameTile = newFrameButton; this.updateScrollerOverflows(); - this.domInitialized = true; }; /**