Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
22479859
Commit
22479859
authored
Jan 17, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store
parent
7c7ac886
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
30 deletions
+29
-30
dev.html
demo/dev.html
+0
-6
node.js
src/core/node.js
+1
-1
layout.default.js
src/module/layout.default.js
+28
-23
No files found.
demo/dev.html
View file @
22479859
...
...
@@ -16,13 +16,7 @@
</body>
<script>
minder
=
KM
.
createMinder
(
kityminder
);
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
(
'dsf'
));
minder
.
execCommand
(
"appendsiblingnode"
,
new
MinderNode
(
'sdf'
));
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
(
'sdf'
));
minder
.
execCommand
(
"appendsiblingnode"
,
new
MinderNode
(
'df'
));
var
del
=
new
MinderNode
(
'sdfsdf'
);
minder
.
execCommand
(
"appendsiblingnode"
,
del
);
minder
.
execCommand
(
"removenode"
,
del
);
</script>
</html>
\ No newline at end of file
src/core/node.js
View file @
22479859
...
...
@@ -75,7 +75,7 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
node
.
root
=
parent
.
root
;
this
.
children
.
splice
(
index
,
0
,
node
);
// this.handelInsert( node );
// this.handelInsert( node );
},
//
...
...
src/module/layout.default.js
View file @
22479859
...
...
@@ -213,6 +213,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
};
//绘制node
var
drawNode
=
function
(
node
)
{
console
.
log
(
node
);
var
container
=
node
.
getRenderContainer
();
var
shape
=
node
.
getData
(
"shape"
);
if
(
!
shape
)
new
MinderNodeShape
(
node
);
...
...
@@ -310,27 +311,32 @@ KityMinder.registerModule( "LayoutDefault", function () {
return
effectSet
;
};
//以某个节点为seed对水平方向进行调整
//以某个节点为seed对水平方向进行调整
(调整子树)
var
updateLayoutHorizon
=
function
(
node
)
{
var
effectSet
=
[];
if
(
!
node
.
getParent
()
)
{
return
[
node
];
}
node
.
preTraverse
(
function
(
n
)
{
var
_style
=
n
.
getData
(
"style"
);
var
parent
=
node
.
getParent
();
var
_parentStyle
=
parent
.
getData
(
"style"
);
var
parentX
=
parent
.
getData
(
"x"
);
var
parentAlign
=
parent
.
getData
(
"align"
);
var
parentWidth
=
parent
.
getRenderContainer
().
getWidth
();
if
(
parentAlign
===
"center"
)
parentWidth
=
parentWidth
/
2
;
var
selfAppendSide
=
n
.
getData
(
"appendside"
);
if
(
selfAppendSide
===
"right"
)
n
.
setData
(
"x"
,
parentX
+
parentWidth
+
_style
.
margin
[
3
]
+
_parentStyle
.
margin
[
1
]
);
else
n
.
setData
(
"x"
,
parentX
-
parentWidth
-
_style
.
margin
[
3
]
-
_parentStyle
.
margin
[
1
]
);
effectSet
.
push
(
n
);
}
);
node
.
preTraverse
(
function
(
n
)
{
var
parent
=
n
.
getParent
();
if
(
!
parent
)
{
return
false
;
}
var
sX
=
parent
.
getData
(
"x"
);
var
_style
=
n
.
getData
(
"style"
);
var
marginLeft
=
_style
.
margin
[
3
];
var
marginRight
=
_style
.
margin
[
1
];
var
parentWidth
=
parent
.
getRenderContainer
().
getWidth
();
if
(
parent
.
getData
(
"align"
)
===
"center"
)
{
parentWidth
=
parentWidth
/
2
;
}
var
selfAlign
=
n
.
getData
(
"align"
);
if
(
selfAlign
===
"left"
)
{
n
.
setData
(
"x"
,
sX
+
parentWidth
+
marginLeft
+
marginRight
);
}
else
{
n
.
setData
(
"x"
,
sX
-
parentWidth
-
marginLeft
-
marginRight
);
}
effectSet
.
push
(
n
);
}
);
return
effectSet
;
};
...
...
@@ -361,21 +367,20 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
);
_root
.
setData
(
"x"
,
minderWidth
/
2
);
_root
.
setData
(
"y"
,
minderHeight
/
2
);
_root
.
setData
(
"layer"
,
0
);
_root
.
setData
(
"align"
,
"center"
);
_root
.
setData
(
"text"
,
"I am the root"
);
_root
.
setData
(
"appendside"
,
"right"
);
var
children
=
_root
.
getChildren
();
console
.
log
(
children
);
_root
.
setData
(
"leftList"
,
[]
);
_root
.
setData
(
"rightList"
,
[]
);
minder
.
renderNode
(
_root
);
var
_rootRenderContainer
=
_root
.
getRenderContainer
();
_root
.
setData
(
"leftHeight"
,
_rootRenderContainer
.
getHeight
()
);
_root
.
setData
(
"rightHeight"
,
_rootRenderContainer
.
getHeight
()
);
updateArrangement
(
_root
);
minder
.
renderNode
(
_root
);
//如果是从其他style切过来的,需要重新布局
var
_buffer
=
_root
.
getChildren
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment