From f840698f6841353c83ed0a9225e741e59df5fb29 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Sun, 11 May 2014 12:53:24 +0200 Subject: remove ability to move timeline --- app/css/app.css | 2 +- app/js/directives.js | 45 +++++++++++++++------------------------------ 2 files changed, 16 insertions(+), 31 deletions(-) diff --git a/app/css/app.css b/app/css/app.css index 1b32625..1b79d29 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -7,7 +7,7 @@ .world { position: relative; - overflow: hidden; + border: solid #999999 1px; } .world .line { diff --git a/app/js/directives.js b/app/js/directives.js index 2ae53e6..3004ebd 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -16,45 +16,30 @@ app.directive('pgLine', function () { paper.setup(canvas); var path; - var selected = null; var drag = false; mainTool.onMouseDown = function(event) { - var hit = paper.project.hitTest(event.point) - if (hit) { - selected = hit.item; - } else { - paper.project.clear(); - // If we produced a path before, deselect it: - if (path) { - - path.selected = false; - } - - // Create a new path and set its stroke color to black: - path = new paper.Path({ - segments: [event.point], - strokeColor: 'rgba(7,140,255,.5)', - strokeWidth: 100, - fullySelected: true, - strokeCap: 'round' - }); - selected = null; - }; - + paper.project.clear(); + // If we produced a path before, deselect it: + if (path) { + path.selected = false; + } + // Create a new path and set its stroke color to black: + path = new paper.Path({ + segments: [event.point], + strokeColor: 'rgba(7,140,255,.5)', + strokeWidth: 100, + fullySelected: true, + strokeCap: 'round' + }); + drag = true; }; mainTool.onMouseMove = function(event) { - console.log(event.point); if (drag) { - if (selected) { - selected.position = event.point; - scope.$apply(); - } else { - path.add(event.point); - } + path.add(event.point); } } -- cgit v1.2.3 From d56086505cfd3e0549438b8030c5677aab7770c1 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Sun, 11 May 2014 13:06:59 +0200 Subject: reinstore scope for adding graph edges --- app/index.html | 2 +- app/js/directives.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/index.html b/app/index.html index e7a7ea8..86f9db3 100644 --- a/app/index.html +++ b/app/index.html @@ -46,7 +46,7 @@
-
+
diff --git a/app/js/directives.js b/app/js/directives.js index 3004ebd..57186f3 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -4,6 +4,10 @@ app.directive('pgLine', function () { return { restrict: 'A', replace: 'false', + scope: { + line: '=', + points: '@' + }, template: '', link: function (scope, elems, attrs) { var canvas = elems[0]; @@ -11,7 +15,7 @@ app.directive('pgLine', function () { mainTool.activate(); - scope.line = scope.$eval(attrs.pgLine); + //scope.line = scope.$eval(attrs.pgLine); paper.setup(canvas); @@ -61,15 +65,20 @@ app.directive('pgLine', function () { scope.$apply(); } -/* + + + scope.$watchCollection('points', function(newVal) { console.log("update"); if (newVal) { + + + paper.project.clear(); drawPoints(scope.points); } }, true); -*/ + } } -- cgit v1.2.3 From 071d1be3301f85bcf33e2bcfb649979935a6bd31 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Sun, 11 May 2014 13:16:15 +0200 Subject: refactor playlist to playseq --- app/index.html | 2 +- app/js/controllers.js | 2 +- 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 @@
-
+
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: '', 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); - - - } + } } }); -- cgit v1.2.3