From 888ed525ada30687377f26fc801b885e5c6e6502 Mon Sep 17 00:00:00 2001 From: Till Breuer Date: Wed, 4 Dec 2013 11:17:30 +0100 Subject: [PATCH] Update timelines zoom slider directive (WIP) --- .../directives/timelines/zoom_slider_directive.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/angular/directives/timelines/zoom_slider_directive.js b/app/assets/javascripts/angular/directives/timelines/zoom_slider_directive.js index f2fb9538fd..17094350ea 100644 --- a/app/assets/javascripts/angular/directives/timelines/zoom_slider_directive.js +++ b/app/assets/javascripts/angular/directives/timelines/zoom_slider_directive.js @@ -2,18 +2,18 @@ timelinesApp.directive('zoomSlider', function() { return { restrict: 'A', link: function(scope, element, attributes) { - zooms = jQuery('select[name="zooms"]'); - element.slider({ + currentScaleIndex = Timeline.ZOOM_SCALES.indexOf(scope.currentScale); + scope.slider = element.slider({ min: 1, max: Timeline.ZOOM_SCALES.length, range: 'min', - value: zooms[0].selectedIndex + 1, + value: currentScaleIndex + 1, slide: function(event, ui) { - zooms[0].selectedIndex = ui.value - 1; + currentScaleIndex = ui.value - 1; }, change: function(event, ui) { - zooms[0].selectedIndex = ui.value - 1; - timeline.zoom(ui.value - 1); + currentScaleIndex = ui.value - 1; + scope.timeline.zoom(ui.value - 1); } }).css({ // top right bottom left @@ -22,3 +22,4 @@ timelinesApp.directive('zoomSlider', function() { } }; }); +