kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
11 years ago
|
angular.module('openproject.uiComponents')
|
||
|
|
||
|
.directive('zoomSlider', function() {
|
||
11 years ago
|
// TODO pass options to directive and do not refer to timelines
|
||
11 years ago
|
return {
|
||
|
restrict: 'A',
|
||
|
link: function(scope, element, attributes) {
|
||
11 years ago
|
scope.currentScaleIndex = Timeline.ZOOM_SCALES.indexOf(scope.currentScaleName);
|
||
11 years ago
|
scope.slider = element.slider({
|
||
11 years ago
|
min: 1,
|
||
|
max: Timeline.ZOOM_SCALES.length,
|
||
|
range: 'min',
|
||
11 years ago
|
value: scope.currentScaleIndex + 1,
|
||
11 years ago
|
slide: function(event, ui) {
|
||
11 years ago
|
scope.currentScaleIndex = ui.value - 1;
|
||
11 years ago
|
scope.$apply();
|
||
11 years ago
|
},
|
||
|
change: function(event, ui) {
|
||
11 years ago
|
scope.currentScaleIndex = ui.value - 1;
|
||
11 years ago
|
}
|
||
|
}).css({
|
||
|
// top right bottom left
|
||
|
'margin': '4px 6px 3px'
|
||
|
});
|
||
11 years ago
|
|
||
|
// Slider
|
||
|
// TODO integrate angular-ui-slider
|
||
11 years ago
|
|
||
11 years ago
|
scope.$watch('currentScaleIndex', function(newIndex){
|
||
|
scope.currentScaleIndex = newIndex;
|
||
11 years ago
|
|
||
11 years ago
|
newScaleName = Timeline.ZOOM_SCALES[newIndex];
|
||
11 years ago
|
if (scope.currentScaleName !== newScaleName) {
|
||
|
scope.currentScaleName = newScaleName;
|
||
|
}
|
||
11 years ago
|
});
|
||
|
|
||
11 years ago
|
}
|
||
|
};
|
||
|
});
|
||
11 years ago
|
|