Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Features] add new option cousin space #442

Merged
merged 3 commits into from
Apr 14, 2023
Merged

Conversation

hizzgdev
Copy link
Owner

Add new option layout.cousin_space to support the additional spacing between subnodes.

The default value is 0, which means no additional spacing as before.

The option can be set as below:

var options = {
    container: 'jsmind_container',
    layout: {
        cousin_space: 30
    }
};
var jm = new jsMind(options);
jm.show();
cousin_space = 0 cousin_space = 30
image image

@hizzgdev hizzgdev merged commit 3e9c954 into master Apr 14, 2023
@hizzgdev hizzgdev deleted the features/cousin-space branch April 14, 2023 17:46
@shine-lzx
Copy link

您好,我在使用jsmind的时候,配置了cousin_space 配置项在相邻子节点都只有一个的时候,这个属性似乎没有生效。
image
`<!-- <!DOCTYPE html>

<script type="text/javascript" src="//cdn.jsdelivr.net/npm/[email protected]/es6/jsmind.js"></script>
<script type="text/javascript"> var mind = { /* 元数据,定义思维导图的名称、作者、版本等信息 */ "meta": { "name": "jsMind-demo-tree", "author": "[email protected]", "version": "0.2" }, /* 数据格式声明 */ "format": "node_tree", /* 数据内容 */ "data": { "id": "root", "topic": "jsMind", "children": [ { "id": "easy", "topic": "Easy", "direction": "left", "expanded": false, "children": [ { "id": "easy1", "topic": "Easy to show" }, { "id": "easy2", "topic": "Easy to edit" }, { "id": "easy3", "topic": "Easy to store" }, { "id": "easy4", "topic": "Easy to embed" } ] }, { "id": "open", "topic": "Open Source", "direction": "right", "expanded": true, "children": [ { "id": "open1", "topic": "on GitHub" }, { "id": "open2", "topic": "BSD License" } ] }, { "id": "powerful", "topic": "Powerful", "direction": "right", "children": [ { "id": "powerful1", "topic": "Base on Javascript" }, { "id": "powerful2", "topic": "Base on HTML5" }, { "id": "powerful3", "topic": "Depends on you" } ] }, { "id": "other", "topic": "test node", "direction": "left", "children": [ { "id": "other1", "topic": "I'm from local variable" }, { "id": "other2", "topic": "I can do everything" } ] } ] } }; var options = { container: 'jsmind_container', theme: 'orange', editable: true, }; var jm = new jsMind(options); jm.show(mind); </script> --> <title>Document</title> <script type="text/javascript" src="//cdn.jsdelivr.net/npm/[email protected]/es6/jsmind.js"></script>
<script type="text/javascript"> var mind = { /* 元数据,定义思维导图的名称、作者、版本等信息 */ "meta": { "name": "jsMind-demo-tree", "author": "[email protected]", "version": "0.2" }, /* 数据格式声明 */ "format": "node_tree", /* 数据内容 */ "data": { "id": "root", "topic": "jsMind", "children": [ { "id": "easy", "topic": "Easy", "direction": "left", "expanded": false, "children": [ { "id": "easy1", "topic": "Easy to show" }, { "id": "easy2", "topic": "Easy to edit" }, { "id": "easy3", "topic": "Easy to store" }, { "id": "easy4", "topic": "Easy to embed" } ] }, { "id": "open", "topic": "Open Source", "direction": "right", "expanded": true, "children": [ { "id": "open1", "topic": "on GitHub" }, // { "id": "open2", "topic": "BSD License" } ] }, { "id": "powerful", "topic": "Powerful", "direction": "right", "children": [ { "id": "powerful1", "topic": "Base on Javascript" }, // { "id": "powerful2", "topic": "Base on HTML5" }, // { "id": "powerful3", "topic": "Depends on you" } ] }, { "id": "other", "topic": "test node", "direction": "left", "children": [ { "id": "other1", "topic": "I'm from local variable" }, { "id": "other2", "topic": "I can do everything" } ] } ] } }; var options = { container: 'jsmind_container', theme: 'orange', editable: true, /* 设置cousin_space后,左边超过两个子节点生效,右边的不生效 */ layout: { hspace: 30, // 节点之间的水平间距 vspace: 20, // 节点之间的垂直间距 pspace: 13, // 节点与连接线之间的水平间距(用于容纳节点收缩/展开控制器) cousin_space: 100 // 相邻节点的子节点之间的额外的垂直间距 }, }; var jm = new jsMind(options); jm.show(mind); </script> `

@hizzgdev
Copy link
Owner Author

The issue #633 has been resolved by #634

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants