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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
'use strict';
/* Controllers */
var p = new Point(1,2);
app.controller('pointCtrl', function($scope, $http, pathService){
$scope.points=dummyPoints;
$scope.line = [];
var update = function(newPoints, newLine) {
if(newLine.length > 0) {
$scope.playseq=pathService.computePlaylist(newPoints, newLine, 60);
startSongWithDuration($scope.playseq[0].id, $scope.playseq[0].duration);
}
}
$scope.$watch('points', function(newVal, oldVal) {
console.log("r")
update(newVal, $scope.line);
}, true);
$scope.$watch('line', function(newVal) {
update($scope.points, newVal);
}, true);
// $scope.line=constList;
$scope.addNewSongToGraph = function(id, titre, link, duration)
{
var newSong = {
x:100,
y:100,
label:titre,
id:id,
link:link,
duration:duration
};
$scope.points.push(newSong);
console.log(newSong);
$scope.$apply();
};
$scope.getColor = function(point) {
if (playlist.indexOf(point) == -1) {
return "white"
} else {
return "red"
}
}
$scope.foo = function (event) {
console.log("foobar");
$scope.points.push({
x: 250,
y: 250
});
};
});
|