From 4a858b46c5bbc1eca545e99216411e7ebb78262a Mon Sep 17 00:00:00 2001 From: TimRudy <3942818+TimRudy@users.noreply.github.com> Date: Sun, 21 Apr 2024 23:11:55 -0400 Subject: [PATCH] move endBlockingTask() out of graph.loadDesign - and fitContent() is always done in loadDesign, after the callback --- app/scripts/controllers/design.js | 27 +++++++++------------------ app/scripts/services/graph.js | 19 +++++-------------- app/scripts/services/project.js | 2 +- 3 files changed, 15 insertions(+), 33 deletions(-) diff --git a/app/scripts/controllers/design.js b/app/scripts/controllers/design.js index c96fcc2b9..f32245ef4 100644 --- a/app/scripts/controllers/design.js +++ b/app/scripts/controllers/design.js @@ -140,9 +140,14 @@ angular } }; + function loadSelectedGraph() { + utils.beginBlockingTask(); + setTimeout(function(){ + _decoupledLoadSelectedGraph(); + },500); + } + function _decoupledLoadSelectedGraph() { - - var n = graph.breadcrumbs.length; var opt = { disabled: true }; var design = false; @@ -166,8 +171,7 @@ angular graph.resetView(); graph.loadDesign(design, opt, function () { $scope.isNavigating = false; - graph.fitContent(); - + utils.endBlockingTask(); }); $scope.topModule = true; } @@ -191,24 +195,13 @@ angular graph.fitContent(); graph.resetView(); graph.loadDesign(dependency.design, opt, function () { - graph.fitContent(); $scope.isNavigating = false; - + utils.endBlockingTask(); }); $scope.information = dependency.package; } } - - - function loadSelectedGraph() { - - utils.beginBlockingTask(); - setTimeout(function(){ - _decoupledLoadSelectedGraph(); - },500); - } - $rootScope.$on('navigateProject', function (event, args) { var opt = { disabled: true }; if (typeof args.submodule !== 'undefined') { @@ -230,9 +223,7 @@ angular graph.resetView(); project.update({ deps: false }, function () { graph.loadDesign(args.project.design, opt, function () { - utils.endBlockingTask(); - }); }); diff --git a/app/scripts/services/graph.js b/app/scripts/services/graph.js index 09f553120..bb0d58c4f 100644 --- a/app/scripts/services/graph.js +++ b/app/scripts/services/graph.js @@ -1451,7 +1451,7 @@ angular.module('icestudio') let cells = graphToCells(design.graph, opt); - self.fitContent(); + self.fitContent(); graph.addCells(cells); @@ -1463,23 +1463,14 @@ angular.module('icestudio') } if (callback) { - - callback(); - - utils.endBlockingTask(); - - self.fitContent(); - } else { - - utils.endBlockingTask(); - - self.fitContent(); - } - + + self.fitContent(); return true; } + + return false; }; function graphToCells(_graph, opt) { diff --git a/app/scripts/services/project.js b/app/scripts/services/project.js index 411118c68..327c3f08c 100644 --- a/app/scripts/services/project.js +++ b/app/scripts/services/project.js @@ -142,9 +142,9 @@ angular.module('icestudio') var ret = graph.loadDesign(project.design, opt, function () { graph.resetCommandStack(); - graph.fitContent(); alertify.success(gettextCatalog.getString('Project {{name}} loaded', { name: utils.bold(name) })); common.hasChangesSinceBuild = true; + utils.endBlockingTask(); }); if (ret) {