Wire up outline level in timeline toolbar

pull/1301/head
Till Breuer 11 years ago
parent 7b5b4dd997
commit 6ac30c3587
  1. 10
      app/assets/javascripts/angular/controllers/timelines_controller.js
  2. 11
      app/assets/javascripts/timelines/ui.js

@ -39,7 +39,15 @@ timelinesApp.controller('TimelinesController', ['$scope', '$window', 'TimelineSe
$scope.currentScaleIndex = Timeline.ZOOM_SCALES.indexOf($scope.currentScaleName);
$scope.slider.slider('value', $scope.currentScaleIndex + 1);
$scope.timeline.zoom($scope.currentScaleIndex);
$scope.timeline.zoom($scope.currentScaleIndex); // TODO replace event-driven adaption by bindings
}
});
$scope.$watch('currentOutlineLevel', function(outlineLevel, formerLevel) {
if (outlineLevel !== formerLevel) {
$scope.timeline.expansionIndex = Timeline.OUTLINE_LEVELS.indexOf(outlineLevel);
$scope.timeline.expandToOutlineLevel(outlineLevel); // TODO replace event-driven adaption by bindings
}
});

@ -192,19 +192,20 @@ jQuery.extend(Timeline, {
var result = (0.299 * parts[0] + 0.587 * parts[1] + 0.114 * parts[2]) / 256;
return result;
},
expandTo: function(index) {
var level;
var outlineLevel;
index = Math.max(index, 0);
level = Timeline.OUTLINE_CONFIGURATIONS[Timeline.OUTLINE_LEVELS[index]].level;
this.expansionIndex = index;
this.expandToOutlineLevel(Timeline.OUTLINE_LEVELS[index]);
},
expandToOutlineLevel: function(outlineLevel) {
var level = Timeline.OUTLINE_CONFIGURATIONS[outlineLevel].level;
if (this.options.hide_tree_root) {
level++;
}
level = this.getLefthandTree().expandTo(level);
this.expansionIndex = index;
this.rebuildAll();
},
zoom: function(index) {
if (index === undefined) {
index = this.zoomIndex;

Loading…
Cancel
Save