@thi.ng/geom
Version:
Functional, polymorphic API for 2D geometry types & SVG generation
28 lines (27 loc) • 545 B
JavaScript
import { set } from "@thi.ng/vectors/set";
import { __copyAttribs } from "../internal/copy.js";
class Text {
constructor(pos, body, attribs) {
this.pos = pos;
this.body = body;
this.attribs = attribs;
}
type = "text";
dim = 2;
copy() {
return new Text(
set([], this.pos),
this.body,
__copyAttribs(this.attribs)
);
}
withAttribs(attribs) {
return new Text(this.pos, this.body, attribs);
}
toHiccup() {
return [this.type, this.attribs, this.pos, this.body];
}
}
export {
Text
};