Set timeline scale on zoom automatically

pull/2258/head
Hagen Schink 10 years ago
parent 76b2eb2034
commit cb954a8ddb
  1. 3
      app/assets/javascripts/angular/timelines/directives/timeline-toolbar-directive.js
  2. 5
      app/assets/javascripts/angular/timelines/models/mixins/ui.js

@ -61,9 +61,6 @@ angular.module('openproject.timelines.directives')
scope.$watch('currentScaleName', function(newScaleName, oldScaleName){
if (newScaleName !== oldScaleName) {
scope.currentScale = scope.timeline.ZOOM_CONFIGURATIONS[scope.currentScaleName].scale;
scope.timeline.scale = scope.currentScale;
scope.currentScaleIndex = scope.timeline.ZOOM_SCALES.indexOf(scope.currentScaleName);
scope.slider.slider('value', scope.currentScaleIndex + 1);

@ -197,7 +197,12 @@ angular.module('openproject.timelines.models')
index = this.zoomIndex;
}
index = Math.max(Math.min(this.ZOOM_SCALES.length - 1, index), 0);
var zoomScale = this.ZOOM_SCALES[index];
var scale = this.ZOOM_CONFIGURATIONS[zoomScale].scale;
this.zoomIndex = index;
this.scale = scale;
this.resetWidth();
this.triggerResize();
this.rebuildAll();

Loading…
Cancel
Save