diff --git a/layout.pde b/layout.pde index 1f2adf9..66fbecd 100644 --- a/layout.pde +++ b/layout.pde @@ -89,6 +89,13 @@ class Layout { void _position(Node n) { + boolean centeredVertically = false; + + if (n.parent != null) { + if (n.parent.parent == null) + centeredVertically = true; + } + Style style = n.style; Rect exT = style.calculateTextExtents(n.text, style.textSize); Rect exS = style.calculateTextExtents(" ", style.textSize); @@ -123,6 +130,10 @@ class Layout { _position(nc); } + + if (centeredVertically && ! n.childrenDirection.equals("down") && children.size() > 1) { + n.layout.y = n.layout.y + (n.layout.bounds.height / 2); + } } void _calculatePorts(Node n) { @@ -222,7 +233,7 @@ class Layout { _reset(n); _calculateSize(n); - int d = _getDepth(); + int d = 1; // _getDepth(); for (int i=0; i x + width || py < y || py > y +height) + return false; + return true; + } } \ No newline at end of file diff --git a/render.pde b/render.pde index 6122899..3390b03 100644 --- a/render.pde +++ b/render.pde @@ -97,10 +97,17 @@ class Renderer { float tx = (eh.height / 2) + (r.width / 2) - (ew.width / 2); float ty = (eh.height / 1.6) + (r.height / 2) - (ew.height / 2); - g.textFont(gs.font, style.textSize); - g.textAlign(style.textAlign); - g.fill(style.textColor); - g.text(n.text, r.x + tx, r.y + ty); + if (previewOnly) { + int border = 8; + g.fill(style.textColor); + g.noStroke(); + g.rect(r.x + (border*2), r.y + (border*2), r.width - (border*4), r.height - (border*4)); + } else { + g.textFont(gs.font, style.textSize); + g.textAlign(style.textAlign); + g.fill(style.textColor); + g.text(n.text, r.x + tx, r.y + ty); + } for (Object c : n.children) { Node nc = (Node)c; diff --git a/yaml2mindmap.pde b/yaml2mindmap.pde index 548acc2..fcb622e 100644 --- a/yaml2mindmap.pde +++ b/yaml2mindmap.pde @@ -1,4 +1,6 @@ -String project = "civpro"; +String project = "crim2b"; + +boolean previewOnly = false; Node root; @@ -23,6 +25,9 @@ void doRedraw() { void settings() { + if (previewOnly) { + scale = 0.25; + } size((int)(1280*windowScale), (int)(720*windowScale)); } @@ -117,8 +122,11 @@ void keyReleased() { { if (key == 'i') { + boolean tmp = previewOnly; + previewOnly = false; println("saving image"); globalRenderer.saveImage(root, fileScale); + previewOnly = tmp; } }