Skip to content

Commit

Permalink
Improve navigation control
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesus89 committed Oct 26, 2018
1 parent b7771c9 commit 1044f95
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions app/scripts/controllers/design.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ angular.module('icestudio')
$scope.profile = profile;
$scope.information = {};
$scope.topModule = true;
$scope.isNavigating = false;

// Intialization

Expand All @@ -23,17 +24,23 @@ angular.module('icestudio')

$scope.breadcrumbsNavitate = function(selectedItem) {
var item;
do {
graph.breadcrumbs.pop();
item = graph.breadcrumbs.slice(-1)[0];
if (!$scope.isNavigating) {
$scope.isNavigating = true;
do {
graph.breadcrumbs.pop();
item = graph.breadcrumbs.slice(-1)[0];
}
while (selectedItem !== item);
loadSelectedGraph();
}
while (selectedItem !== item);
loadSelectedGraph();
};

$scope.breadcrumbsBack = function() {
graph.breadcrumbs.pop();
loadSelectedGraph();
if (!$scope.isNavigating) {
$scope.isNavigating = true;
graph.breadcrumbs.pop();
loadSelectedGraph();
}
};

function loadSelectedGraph() {
Expand All @@ -42,14 +49,17 @@ angular.module('icestudio')
if (n === 1) {
var design = project.get('design');
opt.disabled = false;
graph.loadDesign(design, opt);
graph.loadDesign(design, opt, function() {
$scope.isNavigating = false;
});
$scope.topModule = true;
}
else {
var type = graph.breadcrumbs[n-1].type;
var dependency = common.allDependencies[type];
graph.loadDesign(dependency.design, opt, function() {
graph.fitContent();
$scope.isNavigating = false;
});
$scope.information = dependency.package;
}
Expand Down

0 comments on commit 1044f95

Please sign in to comment.