Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private buildIconUI() {
this.iconGroup = this.paper.g();
this.iconGroup.addClass("iconStyle");
this.iconBackgrounRect = this.paper.rect(0, 0, ToolbarIcon.IconWidth, ToolbarIcon.IconHeight);
this.iconBackgrounRect.addClass("iconBGRectStyle");
this.iconGroup.add(this.iconBackgrounRect);
this.iconImage = this.paper.g();
if (this.description.iconUrl !== undefined) {
Snap.load(this.description.iconUrl, (fragment) => {
this.iconImage.append(fragment);
this.iconImageSVG = this.iconImage.children().find((element) => {
return (element.type === "svg");
});
if (this.iconImageSVG !== undefined) {
this.iconImageSVG.attr({
width: ToolbarIcon.IconWidth,
height: ToolbarIcon.IconHeight
});
this.move(this.x, this.y);
}
});
}
this.iconImage.addClass("iconImageStyle");
this.iconGroup.add(this.iconImage);
componentDidMount() {
Snap.load(this.props.svg, this.loadFile);
}