Closed dmartmillan closed 6 years ago
Solved!
html file:
<button (click)="click()">CLICK</button> <canvas #canvasElement> </canvas>
ts file:
export class AppComponent implements OnInit
project: Project; @ViewChild('canvasElement') canvasElement: ElementRef;
ngOnInit() { this.project = new Project(this.canvasElement.nativeElement); }
click() { let myCircle = new Path.Circle(new Point(100, 70), 50); myCircle.strokeColor = 'black'; myCircle.selected = false; }
Helped by this repository: https://github.com/matolucic22/Angular6-paperJS
Hello, I am making a simple Angular 6 project with PaperJS.
I would adding a Path.Circle but seems that the Path object does not work well.
I have this litte code: a button that if is clicked draw a Path circle.
html file: `<button (click)="click()">CLICK
` ts file: `import { Path, Point } from 'paper';` ... `click() { let myCircle = new Path.Circle(new Point(100, 70), 50); myCircle.strokeColor = 'black'; myCircle.selected = true; }` The error message that procude is this: `AppComponent.html:1 ERROR TypeError: Cannot read property '_currentStyle' of null` `at Path._initialize (paper-full.js:3007) at new Path (paper-full.js:7930) at createPath (paper-full.js:9495) at createEllipse (paper-full.js:9511) at new Circle (paper-full.js:9525) at AppComponent.push../src/app/app.component.ts.AppComponent.click (app.component.ts:12) at Object.eval [as handleEvent] (AppComponent.html:1) at handleEvent (core.js:10050) at callWithDebugContext (core.js:11143) at Object.debugHandleEvent [as handleEvent] (core.js:10846)` What is it wrong? Am I skipping something important on Angular project? Thanks and salutations.