Skip to content

Commit

Permalink
move endBlockingTask() out of graph.loadDesign
Browse files Browse the repository at this point in the history
- and fitContent() is always done in loadDesign, after the callback
  • Loading branch information
TimRudy committed Apr 22, 2024
1 parent b4fb242 commit 4a858b4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 33 deletions.
27 changes: 9 additions & 18 deletions app/scripts/controllers/design.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -166,8 +171,7 @@ angular
graph.resetView();
graph.loadDesign(design, opt, function () {
$scope.isNavigating = false;
graph.fitContent();

utils.endBlockingTask();
});
$scope.topModule = true;
}
Expand All @@ -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') {
Expand All @@ -230,9 +223,7 @@ angular
graph.resetView();
project.update({ deps: false }, function () {
graph.loadDesign(args.project.design, opt, function () {

utils.endBlockingTask();

});

});
Expand Down
19 changes: 5 additions & 14 deletions app/scripts/services/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ angular.module('icestudio')

let cells = graphToCells(design.graph, opt);

self.fitContent();
self.fitContent();

graph.addCells(cells);

Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/services/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4a858b4

Please sign in to comment.