See Below Code:
import { Component, OnInit } from '@angular/core'; import { fabric } from "fabric/dist/fabric.js"; @Component({ selector: 'app-p-five', templateUrl: './p-five.component.html', styleUrls: ['./p-five.component.scss'] }) export class PFiveComponent implements OnInit { x:any; y:any; w:any; h:any; constructor() { } ngOnInit() { var canvas = new fabric.Canvas('c'); canvas.on('mouse:down'); var red = new fabric.Rect({ top: 100, left: 0, width: 80, height: 50, fill: 'red' }); canvas.add(red); var g = new fabric.Group([red]); g.inverted = true; } }
0 Answer(s)