diff options
author | Jakob Odersky <jodersky@gmail.com> | 2014-05-11 13:16:15 +0200 |
---|---|---|
committer | Jakob Odersky <jodersky@gmail.com> | 2014-05-11 13:16:15 +0200 |
commit | 071d1be3301f85bcf33e2bcfb649979935a6bd31 (patch) | |
tree | d5568354f65ed599ba43e0f489ab117793879f0b | |
parent | d56086505cfd3e0549438b8030c5677aab7770c1 (diff) | |
download | playGraph-071d1be3301f85bcf33e2bcfb649979935a6bd31.tar.gz playGraph-071d1be3301f85bcf33e2bcfb649979935a6bd31.tar.bz2 playGraph-071d1be3301f85bcf33e2bcfb649979935a6bd31.zip |
refactor playlist to playseq
-rw-r--r-- | app/index.html | 2 | ||||
-rw-r--r-- | app/js/controllers.js | 2 | ||||
-rw-r--r-- | app/js/directives.js | 22 |
3 files changed, 13 insertions, 13 deletions
diff --git a/app/index.html b/app/index.html index 86f9db3..082899f 100644 --- a/app/index.html +++ b/app/index.html @@ -46,7 +46,7 @@ </div> <div id="column-middle"> <div class="world" style="width: 100%; height: 500px;"> - <div data-pg-line data-line="line" data-points="points" class="line" resize></div> + <div data-pg-line data-line="line" data-list="playseq"class="line" resize></div> <div data-ng-repeat="point in points" data-pg-draggable="point" class="point" style="top: {{point.y}}px; left: {{point.x}}px;" data-ng-class="{selected: point.selected==true}"><div></div></div> </div> diff --git a/app/js/controllers.js b/app/js/controllers.js index 97e6366..11e6950 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -12,7 +12,7 @@ app.controller('pointCtrl', function($scope, $http, pathService){ var update = function(newPoints, newLine) { if(newLine.length > 0) { - $scope.playlist=pathService.computePlaylist(newPoints, newLine, 60); + $scope.playseq=pathService.computePlaylist(newPoints, newLine, 60); } } diff --git a/app/js/directives.js b/app/js/directives.js index 57186f3..f8b8403 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -6,7 +6,7 @@ app.directive('pgLine', function () { replace: 'false', scope: { line: '=', - points: '@' + list: '=' }, template: '<canvas width=100%; height: 100%></canvas>', link: function (scope, elems, attrs) { @@ -68,19 +68,19 @@ app.directive('pgLine', function () { - scope.$watchCollection('points', function(newVal) { + scope.$watch('list', function(newPoints) { console.log("update"); - if (newVal) { - - - - paper.project.clear(); - drawPoints(scope.points); + if (newPoints) { + for (var i = 0; i < newPoints.length - 1; ++i) { + if (newPoints[i].selected) { + var line = paper.Path.Line(newPoints[i], newPoints[i+1]); + line.strokeColor = 'red'; + line.strokeWidth = 2; + } + } } }, true); - - - } + } } }); |