@meta2d/core
Version:
@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .
19 lines • 542 B
JavaScript
import { s8 } from '../utils';
export function randomId(pen) {
pen.id = s8();
if (Array.isArray(pen.anchors)) {
for (const pt of pen.anchors) {
pen.type && (pt.id = s8());
pt.penId = pen.id;
if (pt.prev) {
pen.type && (pt.prev.id = s8());
pt.prev.penId = pen.id;
}
if (pt.next) {
pen.type && (pt.next.id = s8());
pt.next.penId = pen.id;
}
}
}
}
//# sourceMappingURL=utils.js.map