diff options
-rw-r--r-- | app/data.json | 60 | ||||
-rw-r--r-- | app/index.html | 15 | ||||
-rw-r--r-- | app/js/app.js | 76 | ||||
-rw-r--r-- | app/js/controllers.js | 19 |
4 files changed, 165 insertions, 5 deletions
diff --git a/app/data.json b/app/data.json new file mode 100644 index 0000000..ea4e559 --- /dev/null +++ b/app/data.json @@ -0,0 +1,60 @@ +{ + "points": [ + { + "x": 10, + "y": 20 + }, + { + "x": 30, + "y": 30 + }, + { + "x": 50, + "y": 25 + }, + { + "x": 60, + "y": 200 + }, + { + "x": 90, + "y": 230 + }, + { + "x": 400, + "y": 300 + }, + { + "x": 100, + "y": 220 + }, + { + "x": 200, + "y": 20 + }, + { + "x": 150, + "y": 450 + }, + { + "x": 70, + "y": 80 + }, + { + "x": 400, + "y": 80 + } + { + "x": 420, + "y": 40 + } + { + "x": 390, + "y": 65 + } + { + "x": 440, + "y": 120 + } + ] +}
\ No newline at end of file diff --git a/app/index.html b/app/index.html index 1aba8dd..fd16e1f 100644 --- a/app/index.html +++ b/app/index.html @@ -11,6 +11,21 @@ </head> <body ng-app="playGraph" ng-controller="pointCtrl"> + <svg id="world" width="500" height="500"> + <circle data-ng-repeat="point in points" cx="{{point.x}}" cy="{{point.y}}" r="10" stroke="gray" stroke-width="2" fill="white"></circle> + </svg> + + <script> + /* + $(document).onload(function() { + var svg = $('#world').svg('get'); + $('circle', svg.root()).click(function () { + attr('cx', '300'); + }); + }); + */ + </script + <p>Nothing here {{text}}</p> </body> </html> diff --git a/app/js/app.js b/app/js/app.js index d2acc77..fab738a 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -7,6 +7,82 @@ var Point = function(x,y){ this.y = y; }; +var dummyPoints= [ + { + x: 10, + y: 20 + }, + { + x: 30, + y: 30 + }, + { + x: 50, + y: 25 + }, + { + x: 60, + y: 200 + }, + { + x: 90, + y: 230 + }, + { + x: 400, + y: 300 + }, + { + x: 100, + y: 220 + }, + { + x: 200, + y: 20 + }, + { + x: 150, + y: 450 + }, + { + x: 70, + y: 80 + }, + { + x: 400, + y: 80 + }, + { + x: 430, + y: 90 + }, + { + x: 420, + y: 65 + }, + { + x: 380, + y: 320 + }, + { + x: 490, + y: 340 + }, + { + x: 400, + y: 400 + }, + { + x: 480, + y: 360 + }, + { + x: 420, + y: 490 + } + + ] + var Song = function(point){ this.point = point; }; diff --git a/app/js/controllers.js b/app/js/controllers.js index 0a2931e..cb061da 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -3,8 +3,17 @@ /* Controllers */ var p = new Point(1,2); -app.controller('pointCtrl', function($scope, pathService){ - pathService.computePlaylist(); - $scope.song= [ - ]; -}); +app.controller('pointCtrl', ['$scope', '$http', function($scope, $http){ + var constList = [ + {x: 10, y:20}, + {x: 100, y:50}, + {x: 100, y:200} + ] + pathService.computePlaylist(dummyPoints,); + $scope.points=dummyPoints; + + /*$http.get('data.json').then( function (response) { + console.log(response.data.points); + $scope.points=JSON.parse(response.data.points); + });*/ +}]);
\ No newline at end of file |