diff --git a/app/scripts/controllers/design.js b/app/scripts/controllers/design.js index 2f9a4bb2c..f745debad 100644 --- a/app/scripts/controllers/design.js +++ b/app/scripts/controllers/design.js @@ -55,9 +55,16 @@ angular do { graph.breadcrumbs.pop(); + common.submoduleHeap.pop(); item = graph.breadcrumbs.slice(-1)[0]; } while (selectedItem !== item); + if(common.submoduleHeap.length>0){ + const last=common.submoduleHeap.length - 1; + common.submoduleId=common.submoduleHeap[last].id; + common.submoduleUID=common.submoduleHeap[last].uid; + } + loadSelectedGraph(); } } @@ -67,8 +74,13 @@ angular if (!$scope.isNavigating) { $scope.isNavigating = true; graph.breadcrumbs.pop(); - - loadSelectedGraph(); + common.submoduleHeap.pop(); + if(common.submoduleHeap.length>0){ + const last=common.submoduleHeap.length - 1; + common.submoduleId=common.submoduleHeap[last].id; + common.submoduleUID=common.submoduleHeap[last].uid; + } + loadSelectedGraph(); } }; @@ -112,7 +124,6 @@ angular tmp = utils.clone(common.allDependencies[block.type]); tmp.design.graph = p.design.graph; /*var hId = utils.dependencyID(tmp);*/ - var hId = block.type; common.allDependencies[hId] = tmp; $scope.toRestore = hId; @@ -152,7 +163,6 @@ angular var design = false; var i = 0; if (n === 1) { - design = project.get('design'); opt.disabled = false; if ($scope.toRestore !== false && @@ -190,7 +200,6 @@ angular } $scope.toRestore = false; } - graph.fitContent(); graph.resetView(); graph.loadDesign(dependency.design, opt, function () { @@ -203,21 +212,30 @@ angular $rootScope.$on('navigateProject', function (event, args) { var opt = { disabled: true }; + if(typeof common.submoduleHeap === 'undefined'){ + common.submoduleHeap=[]; + } + let heap={id:false,uid:false}; if (typeof args.submodule !== 'undefined') { common.submoduleId = args.submodule; - + heap.id=args.submodule; } if (typeof args.submoduleId !== 'undefined') { common.submoduleUID = args.submoduleId; + heap.uid=args.submoduleId; } + + if(heap.id !== false || heap.uid !== false) { + common.submoduleHeap.push(heap); + } + if (typeof args.editMode !== 'undefined') { opt.disabled = args.editMode; } - if (args.update) { graph.resetView(); project.update({ deps: false }, function () { @@ -257,4 +275,4 @@ angular }); - }); \ No newline at end of file + }); diff --git a/app/scripts/controllers/menu.js b/app/scripts/controllers/menu.js index 74922e120..3473a3863 100644 --- a/app/scripts/controllers/menu.js +++ b/app/scripts/controllers/menu.js @@ -998,6 +998,7 @@ angular function getProjectInformation() { var p = false; + console.log('INFO:',subModuleActive,common); if ( subModuleActive && typeof common.submoduleId !== "undefined" && diff --git a/app/scripts/services/graph.js b/app/scripts/services/graph.js index c7cdf8952..996965d5c 100644 --- a/app/scripts/services/graph.js +++ b/app/scripts/services/graph.js @@ -31,9 +31,9 @@ angular.module('icestudio') between modules, we fix with the new engine , meanwhile this works --*/ let _this=this; $('body').on('Graph::updateWires',function(){ - // setTimeout(function(){ + setTimeout(function(){ _this.updateWires(); - // },2000); + },100); }); //-- ZOOM constants diff --git a/app/scripts/services/utils.js b/app/scripts/services/utils.js index 7fc87e30a..fb157b942 100644 --- a/app/scripts/services/utils.js +++ b/app/scripts/services/utils.js @@ -1525,8 +1525,10 @@ angular.module('icestudio') this.endBlockingTask = function () { $('body').trigger('Graph::updateWires'); - angular.element('#menu').removeClass('is-disabled'); - $('body').removeClass('waiting'); + setTimeout(function(){ + angular.element('#menu').removeClass('is-disabled'); + $('body').removeClass('waiting'); + },750); }; this.isFunction = function (functionToCheck) {