Tell me how to properly connect the svg.filter.js library in the Angular project
Tried to do something like that svg.js + Angular 7.3: Build in production mode get 'not a constructor'
import { Component, OnInit } from '@angular/core';
import SVG from "@svgdotjs/svg.js/src/svg" //v 3.0.12
import Filter from '@svgdotjs/svg.filter.js/src/svg.filter';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
title = 'svgjs30';
draw: any
ngOnInit() {
this.draw = SVG().addTo('#canvas').viewbox(0, 0, 300, 140)
this.grayFilter = new Filter();
this.grayFilter.colorMatrix('saturate', 1);
this.draw.image(imagePath)
.size(v.imageWidth, v.imageHeight)
.move(v.compPosX, v.compPosY)
.attr({id: 'obj' + v.compID}).filterWith(this.grayFilter);
}
}
But with this use, I get a new svg element at the end of the document.
<svg id="SvgjsSvg1001" width="2" height="0" style="overflow: hidden; top: -100%; left: -100%; position: absolute; opacity: 0;"><defs id="SvgjsDefs1002"></defs><polyline id="SvgjsPolyline1003" points="0,0"></polyline><path id="SvgjsPath1004" d="M0 0 "></path></svg>