ast-parentchild
Version:
Convert your JavaScript file to acron AST format and then output a json file whihc have parent-child realtionship between nodes
22 lines (14 loc) • 420 B
JavaScript
const Node = require('./node.js');
module.exports = class StringNode extends Node {
constructor(data) {
super(data, []);
this.textPad = 4;
}
_render(g) {
const bbox = appendRectText(g, 0, 0, this.data, this.textPad);
this.width = bbox.width;
this.height = bbox.height;
this.linkX = Math.round(this.width / 2);
this.linkY = Math.round(this.height / 2);
}
}