aboutsummaryrefslogblamecommitdiff
path: root/app/js/controllers.js
blob: 97e636627f29b02492fcea7a1aba4d805018496e (plain) (tree)
1
2
3
4
5
6
7
8
9


                 

                       

 
                                                                 
 
                                  







                                                                                            
                                                          










                                              







                                                    
 

                                       
 


                                    
                   

          
 
  
'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.playlist=pathService.computePlaylist(newPoints, newLine, 60);
		}
	}

	$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.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
		});
	};


});