svg-engine
Version:
Create SVG files in Node.js
29 lines • 859 B
JavaScript
import { SVGInstance } from "../../../browser/instance/SVGInstance.js";
export class XYPositioning extends SVGInstance {
moveTo(x, y) {
this.attr("x", x);
this.attr("y", y);
return this;
}
moveBy(dx, dy) {
var _a, _b;
const x = (_a = this.attr("x")) !== null && _a !== void 0 ? _a : 0 + dx;
const y = (_b = this.attr("y")) !== null && _b !== void 0 ? _b : 0 + dy;
return this.moveTo(x, y);
}
x(x) {
if (typeof x === "string" || typeof x === "number") {
this.attr("x", x);
return this;
}
return this.attr("x");
}
y(y) {
if (typeof y === "string" || typeof y === "number") {
this.attr("y", y);
return this;
}
return this.attr("y");
}
}
//# sourceMappingURL=xyPositioning.js.map