Skip to content

Commit

Permalink
Merge pull request #449 from acjim/394_animation_mode
Browse files Browse the repository at this point in the history
394 animation mode
  • Loading branch information
rohankoid authored Sep 8, 2016
2 parents bc90949 + d3e6ade commit 46b96b7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
25 changes: 14 additions & 11 deletions src/app/components/filehandling/fileHandlingService.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
// Start loading bar
$timeout(function () {
cfpLoadingBar.start();
}, 100);
}, 77);

if (!fs.existsSync(config.api.script)) { // If there is no AcmacsCore.bundle
return api.asyncTest().then(function () {
Expand Down Expand Up @@ -409,21 +409,24 @@
]).then(function (data) {
var unprocessed_data = JSON.parse(data);
var progressive_data = [];
var intermediate_size = unprocessed_data.intermediate_layouts.length;
var frequency = parseInt(intermediate_size/40); // selected intermediate states so that total number of steps be 40 (40 has been selected randomly)
//@TODO, write an algorithm which finds most distinguished changes to show as animation/intermediate states
var count = 0;
unprocessed_data.intermediate_layouts.forEach(function (layout, index) {
if(index ==0 || (index%frequency) == 0 || isNaN(index%frequency) || index == intermediate_size) {
progressive_data[count] = parseLayoutData(formatDataForIntermediateLayout(unprocessed_data, index));
count ++;
}
});
if(unprocessed_data.intermediate_layouts) {
var intermediate_size = unprocessed_data.intermediate_layouts.length;
var frequency = parseInt(intermediate_size / 77); // selected intermediate states so that total number of steps be 77 (77 has been selected randomly)
//@TODO, write an algorithm which finds most distinguished changes to show as animation/intermediate states
var count = 0;
unprocessed_data.intermediate_layouts.forEach(function (layout, index) {
if (index == 0 || (index % frequency) == 0 || isNaN(index % frequency) || index == intermediate_size) {
progressive_data[count] = parseLayoutData(formatDataForIntermediateLayout(unprocessed_data, index));
count++;
}
});
}
var map = unprocessed_data.map;
var map_data = {map:map[0], stress: map[0].stress};
mapData = parseLayoutData((map_data));
progressive_data[progressive_data.length] = mapData;
fileHandler.setMapIsChanged(true);
cfpLoadingBar.set(0.7);
return progressive_data;
});
}, function (reason) {
Expand Down
2 changes: 0 additions & 2 deletions src/app/components/map/mapController.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
$scope.pointsMoved = false;
$scope.data = result;
getErrorConnectionLines();
$scope.pointsMoved = true;
cfpLoadingBar.complete();
});
});

Expand Down
3 changes: 3 additions & 0 deletions src/app/components/map/mapDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ app.directive('d3Map', ['$rootScope', '$window', '$timeout', 'toolbar', 'toolbar

// Enter
nodeGroup = nodeGroup.data(data.layout);
scope.data.stress = data.stress;

nodeGroup.enter().append("path")
.attr("class", "point")
Expand Down Expand Up @@ -1312,6 +1313,7 @@ app.directive('d3Map', ['$rootScope', '$window', '$timeout', 'toolbar', 'toolbar
scope.$watch('data', function (newVals) {
if (!_.isUndefined(newVals)) {
if(_.isArray(newVals)) {
cfpLoadingBar.set(0.7);
var size = newVals.length;
var count = 0;
_.each(newVals, function(newVal) {
Expand All @@ -1321,6 +1323,7 @@ app.directive('d3Map', ['$rootScope', '$window', '$timeout', 'toolbar', 'toolbar
if(size == count) {
scope.data = newVal;
scope.data.stress = newVal.stress;
cfpLoadingBar.complete();
}
}, 2000);
})
Expand Down

0 comments on commit 46b96b7

Please sign in to comment.