102 lines
3.8 KiB
JavaScript
102 lines
3.8 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.SVGPathInstance = void 0;
|
|
const SVGInstance_js_1 = require("../../browser/instance/SVGInstance.js");
|
|
//-- Mixins
|
|
const index_js_1 = require("../mixins/index.js");
|
|
// Presentation attributes
|
|
const color_js_1 = require("../mixins/presentation-attributes/color.js");
|
|
const display_js_1 = require("../mixins/presentation-attributes/display.js");
|
|
const fill_js_1 = require("../mixins/presentation-attributes/fill.js");
|
|
const opacity_js_1 = require("../mixins/presentation-attributes/opacity.js");
|
|
const stroke_js_1 = require("../mixins/presentation-attributes/stroke.js");
|
|
const vectorEffect_js_1 = require("../mixins/presentation-attributes/vectorEffect.js");
|
|
const visibility_js_1 = require("../mixins/presentation-attributes/visibility.js");
|
|
//-- Class
|
|
class SVGPathInstance extends SVGInstance_js_1.SVGInstance {
|
|
constructor(_parent) {
|
|
super("path", _parent);
|
|
}
|
|
lineTo(x, y, relative = false) {
|
|
var _a;
|
|
let d = (_a = this.attr("d")) !== null && _a !== void 0 ? _a : "";
|
|
d += (relative === false ? " L " : " l ");
|
|
d += ` ${x}, ${y} `;
|
|
this.attr("d", d);
|
|
return this;
|
|
}
|
|
moveTo(x, y, relative = false) {
|
|
var _a;
|
|
let d = (_a = this.attr("d")) !== null && _a !== void 0 ? _a : "";
|
|
d += (relative === false ? " M " : " m ");
|
|
d += ` ${x}, ${y} `;
|
|
this.attr("d", d);
|
|
return this;
|
|
}
|
|
cubicBezierCurveTo(p1x, p1y, p2x, p2y, x, y, relative = false) {
|
|
var _a;
|
|
let d = (_a = this.attr("d")) !== null && _a !== void 0 ? _a : "";
|
|
d += (relative === false ? " C " : " c ");
|
|
d += ` ${p1x} ${p1y}, ${p2x} ${p2y}, ${x} ${y} `;
|
|
this.attr("d", d);
|
|
return this;
|
|
}
|
|
smoothBezierCurveTo(x2, y2, x, y, relative = false) {
|
|
var _a;
|
|
let d = (_a = this.attr("d")) !== null && _a !== void 0 ? _a : "";
|
|
d += (relative === false ? " S " : " s ");
|
|
d += ` ${x2}, ${y2} ${x}, ${y} `;
|
|
this.attr("d", d);
|
|
return this;
|
|
}
|
|
quadraticBezierCurveTo(p1x, p1y, x, y, relative = false) {
|
|
var _a;
|
|
let d = (_a = this.attr("d")) !== null && _a !== void 0 ? _a : "";
|
|
d += (relative === false ? " Q " : " q ");
|
|
d += ` ${p1x} ${p1y}, ${x} ${y} `;
|
|
this.attr("d", d);
|
|
return this;
|
|
}
|
|
smoothQuadraticBezierCurveTo(x, y, relative = false) {
|
|
var _a;
|
|
let d = (_a = this.attr("d")) !== null && _a !== void 0 ? _a : "";
|
|
d += (relative === false ? " T " : " t ");
|
|
d += ` ${x}, ${y} `;
|
|
this.attr("d", d);
|
|
return this;
|
|
}
|
|
ellipticalArcCurveTo(rx, ry, xRot, largeArc, sweep, x, y, relative = false) {
|
|
var _a;
|
|
let d = (_a = this.attr("d")) !== null && _a !== void 0 ? _a : "";
|
|
d += (relative === false ? " A " : " a ");
|
|
d += ` ${rx}, ${ry} ${xRot} ${largeArc ? 1 : 0} ${sweep ? 1 : 0} ${x} ${y} `;
|
|
this.attr("d", d);
|
|
return this;
|
|
}
|
|
curveTo(x, y, x1, y1, relative = false) {
|
|
var _a;
|
|
let d = (_a = this.attr("d")) !== null && _a !== void 0 ? _a : "";
|
|
d += (relative === false ? " S " : " s ");
|
|
d += ` ${x}, ${y} ${x1}, ${y1} `;
|
|
this.attr("d", d);
|
|
return this;
|
|
}
|
|
close() {
|
|
var _a;
|
|
let d = (_a = this.attr("d")) !== null && _a !== void 0 ? _a : "";
|
|
d += " Z";
|
|
this.attr("d", d);
|
|
return this;
|
|
}
|
|
}
|
|
exports.SVGPathInstance = SVGPathInstance;
|
|
(0, index_js_1.applyMixins)(SVGPathInstance, [
|
|
color_js_1.Color,
|
|
display_js_1.Display,
|
|
fill_js_1.Fill,
|
|
opacity_js_1.Opacity,
|
|
stroke_js_1.Stroke,
|
|
vectorEffect_js_1.VectorEffect,
|
|
visibility_js_1.Visibility
|
|
]);
|
|
//# sourceMappingURL=SVGPathInstance.js.map
|