aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2014-05-11 13:06:59 +0200
committerJakob Odersky <jodersky@gmail.com>2014-05-11 13:06:59 +0200
commitd56086505cfd3e0549438b8030c5677aab7770c1 (patch)
treea0596dbcdf0c4cb4e4b61abbfea13b28c0bf0065
parentf840698f6841353c83ed0a9225e741e59df5fb29 (diff)
downloadplayGraph-d56086505cfd3e0549438b8030c5677aab7770c1.tar.gz
playGraph-d56086505cfd3e0549438b8030c5677aab7770c1.tar.bz2
playGraph-d56086505cfd3e0549438b8030c5677aab7770c1.zip
reinstore scope for adding graph edges
-rw-r--r--app/index.html2
-rw-r--r--app/js/directives.js15
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 @@
</div>
<div id="column-middle">
<div class="world" style="width: 100%; height: 500px;">
- <div data-pg-line="line" class="line" resize></div>
+ <div data-pg-line data-line="line" data-points="points" 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/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: '<canvas width=100%; height: 100%></canvas>',
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);
-*/
+
}
}