Comparing version 0.0.12 to 0.0.13
@@ -9,3 +9,3 @@ "use strict"; | ||
let width = options.maxWidth; | ||
const treeWidth = trees.reduce((acc, tree) => acc + tree_1.computeWidth(ctx, options.style, tree) + tree_1.HORIZONTAL_TREE_SPACING, tree_1.HORIZONTAL_TREE_SPACING); | ||
const treeWidth = trees.reduce((acc, tree) => acc + tree_1.computeWidth(ctx, options.style, tree) + tree_1.HORIZONTAL_TREE_SPACING, -tree_1.HORIZONTAL_TREE_SPACING); | ||
const idealHeight = (width / treeWidth) * treeHeight; | ||
@@ -12,0 +12,0 @@ const height = options.maxHeight |
@@ -7,10 +7,10 @@ "use strict"; | ||
const ARROW_THICKNESS = 2; | ||
const ARROW_TOP_HEIGHT = 100; | ||
const ARROW_TOP_STRAIGHT = 30; | ||
const ARROW_CURVE_RADIUS = 30; | ||
const ARROW_TOP_HEIGHT = 60; | ||
const ARROW_TOP_STRAIGHT = 10; | ||
const ARROW_CURVE_RADIUS = 20; | ||
const ARROW_LABEL_WIDTH = 100; | ||
const ARROW_LABEL_HEIGHT = 30; | ||
const ARROW_LABEL_STRAIGHT = 10; | ||
const ARROW_BOTTOM_HEIGHT = 100; | ||
const ARROW_LABEL_FONT_SIZE = 16; | ||
const ARROW_BOTTOM_HEIGHT = 70; | ||
const ARROW_LABEL_FONT_SIZE = 18; | ||
const ARROW_HEAD_HEIGHT = 5; | ||
@@ -17,0 +17,0 @@ const ARROW_HEAD_WIDTH = 10; |
@@ -7,9 +7,9 @@ "use strict"; | ||
const text_1 = require("./elements/text"); | ||
const NODE_LABEL_HEIGHT = 30; | ||
const NODE_LABEL_HEIGHT = 40; | ||
const NODE_WIDTH_LARGE = 170; | ||
const NODE_WIDTH_SMALL = 120; | ||
const NODE_BORDER_RADIUS = 10; | ||
const TYPE_LABEL_FONT_SIZE = 12; | ||
const ATTRIBUTE_HEIGHT = 30; | ||
const ATTRIBUTE_FONT_SIZE = 14; | ||
const TYPE_LABEL_FONT_SIZE = 22; | ||
const ATTRIBUTE_HEIGHT = 34; | ||
const ATTRIBUTE_FONT_SIZE = 18; | ||
const TEXT_HORIZONTAL_PADDING = 8; | ||
@@ -30,3 +30,3 @@ /** | ||
: [NODE_BORDER_RADIUS, NODE_BORDER_RADIUS, 0, 0], colors.title.background); | ||
text_1.drawText(ctx, x, y, width, NODE_LABEL_HEIGHT, style.fontFamily, TYPE_LABEL_FONT_SIZE, colors.title.text, node.label || node.type.toUpperCase()); | ||
text_1.drawText(ctx, x, y, width, NODE_LABEL_HEIGHT, style.fontFamily, TYPE_LABEL_FONT_SIZE, colors.title.text, node.label || node.type); | ||
let nextAttributeY = y + NODE_LABEL_HEIGHT; | ||
@@ -33,0 +33,0 @@ for (const { key, value } of attributes) { |
@@ -10,3 +10,3 @@ "use strict"; | ||
const projectedContext = new projected_context_1.ProjectedRenderingContext2D(ctx, viewport); | ||
let x = tree_1.HORIZONTAL_TREE_SPACING; | ||
let x = 0; | ||
for (const tree of trees) { | ||
@@ -13,0 +13,0 @@ x += |
@@ -106,17 +106,28 @@ "use strict"; | ||
}); | ||
it("does something", () => { | ||
it("renders complex trees in a readable way", () => { | ||
const rendered = renderCanvas(` | ||
a | ||
name = root | ||
--entities--> | ||
a | ||
b | ||
c | ||
--folders--> | ||
b | ||
--files--> | ||
file 1 | ||
file 2 | ||
file 3 | ||
c | ||
block | ||
--entities--> | ||
entity | ||
name = a | ||
entity | ||
name = b | ||
--instructions--> | ||
assignment | ||
--to--> | ||
0⬆0 | ||
--value--> | ||
1 | ||
block | ||
--instructions--> | ||
assignment | ||
--to--> | ||
1⬆0 | ||
--value--> | ||
2 | ||
assignment | ||
--to--> | ||
0⬆0 | ||
--value--> | ||
3 | ||
`); | ||
@@ -123,0 +134,0 @@ expect(rendered).toMatchImageSnapshot(); |
{ | ||
"name": "ferns", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"author": "Francois Wouts", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
167321
1499