Skip to content

Commit

Permalink
fixup the bug that cousin space doesn't take effect on 1-child-node (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hizzgdev authored Oct 17, 2024
1 parent 6feb452 commit 79a5704
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/jsmind.layout_provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ export class LayoutProvider {
this.set_visible(node.children, false);
}
node_outer_height = Math.max(node._data.view.height, node_outer_height);
if (node.children.length > 1) {

if (this._should_reserve_cousin_space(node)) {
node_outer_height += this.opts.cousin_space;
}

Expand Down Expand Up @@ -196,7 +197,7 @@ export class LayoutProvider {
node_outer_height = 0;
}
node_outer_height = Math.max(node._data.view.height, node_outer_height);
if (node.children.length > 1) {
if (this._should_reserve_cousin_space(node)) {
node_outer_height += this.opts.cousin_space;
}

Expand All @@ -216,6 +217,9 @@ export class LayoutProvider {
}
return total_height;
}
_should_reserve_cousin_space(node) {
return node.children.length > 0 && node.parent.children.length > 1;
}
get_node_offset(node) {
var layout_data = node._data.layout;
var offset_cache = null;
Expand Down

0 comments on commit 79a5704

Please sign in to comment.