diff options
Diffstat (limited to 'app/js/directives.js')
-rw-r--r-- | app/js/directives.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/app/js/directives.js b/app/js/directives.js index a460d93..d20c034 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -4,10 +4,11 @@ app.directive('pgLine', function () { return { restrict: 'A', replace: 'false', - template: '<canvas resize></canvas>', + template: '<canvas width=100%; height: 100%></canvas>', link: function (scope, elems, attrs) { var canvas = elems[0]; var mainTool = new paper.Tool(); + mainTool.activate(); scope.line = scope.$eval(attrs.pgLine); @@ -18,6 +19,7 @@ app.directive('pgLine', function () { var selected = null; var drag = false; + mainTool.onMouseDown = function(event) { var hit = paper.project.hitTest(event.point) if (hit) { @@ -33,9 +35,10 @@ app.directive('pgLine', function () { // Create a new path and set its stroke color to black: path = new paper.Path({ segments: [event.point], - strokeColor: 'black', - strokeWidth: 2, - fullySelected: true + strokeColor: 'rgba(7,140,255,.5)', + strokeWidth: 100, + fullySelected: true, + strokeCap: 'round' }); selected = null; }; @@ -44,6 +47,7 @@ app.directive('pgLine', function () { }; mainTool.onMouseMove = function(event) { + console.log(event.point); if (drag) { if (selected) { selected.position = event.point; @@ -61,7 +65,7 @@ app.directive('pgLine', function () { var points = Array(); // When the mouse is released, simplify it: - path.simplify(10); + path.simplify(1); for(var i=0; i<path._segments.length; i++) { |