svg-engine
Version:
Create SVG files in Node.js
48 lines • 1.65 kB
JavaScript
import { SVGInstance } from "../../browser/instance/SVGInstance.js";
//-- Mixins
import { applyMixins } from "../mixins/index.js";
// Permitted content
import { ShapeInstances } from "../mixins/permitted-content/shapeInstances.js";
import { SVGSVGInstance } from "./SVGSVGInstance.js";
// Presentation attributes
import { Color } from "../mixins/presentation-attributes/color.js";
import { Display } from "../mixins/presentation-attributes/display.js";
import { Fill } from "../mixins/presentation-attributes/fill.js";
import { Opacity } from "../mixins/presentation-attributes/opacity.js";
import { Stroke } from "../mixins/presentation-attributes/stroke.js";
import { VectorEffect } from "../mixins/presentation-attributes/vectorEffect.js";
import { Visibility } from "../mixins/presentation-attributes/visibility.js";
//-- Class
export class SVGGroupInstance extends SVGInstance {
constructor(_parent) {
super("g", _parent);
}
addGroup() {
const group = new SVGGroupInstance(this);
this.appendInstance(group);
return group;
}
addSVG(width, height) {
if (typeof width !== "undefined" && typeof height !== "undefined") {
const svg = new SVGSVGInstance(width, height);
this.appendInstance(svg);
return svg;
}
else {
const svg = new SVGSVGInstance();
this.appendInstance(svg);
return svg;
}
}
}
applyMixins(SVGGroupInstance, [
ShapeInstances,
Color,
Display,
Fill,
Opacity,
Stroke,
VectorEffect,
Visibility
]);
//# sourceMappingURL=SVGGroupInstance.js.map