aboutsummaryrefslogtreecommitdiff
path: root/app/js/controllers.js
blob: f49f1b1548c40233dcff02bd03c6fadf3433d708 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'use strict';

/* Controllers */
var p = new Point(1, 2);



app.controller('pointCtrl', function($scope, $http, pathService, musicPlayer) {

    $scope.points = dummyPoints;
    $scope.line = [];

    var update = function(newPoints, newLine) {
        if (newLine.length > 0) {
            $scope.playseq = pathService.computePlaylist(newPoints, newLine, 60);
            musicPlayer.startSongWithDuration($scope.playseq[0].id, $scope.playseq[0].duration);
        }
    };

    $scope.$watch('points', function(newVal) {
        update(newVal, $scope.line);
    }, true);

    $scope.$watch('line', function(newVal) {
        update($scope.points, newVal);
    }, true);


//	$scope.line=constList;

    $scope.addNewSongToGraph = function(newSong)
    {
        newSong.x = 100;
        newSong.y = 100;
        $scope.points.push(newSong);
    };
});

app.controller('searchCtrl', function($scope) {

    $scope.points = dummyPoints;
    $scope.line = [];

});