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 @@
...
@@ -16,13 +16,7 @@
</body>
</body>
<script>
<script>
minder
=
KM
.
createMinder
(
kityminder
);
minder
=
KM
.
createMinder
(
kityminder
);
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
(
'dsf'
));
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
(
'dsf'
));
minder
.
execCommand
(
"appendsiblingnode"
,
new
MinderNode
(
'sdf'
));
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>
</script>
</html>
</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", {
...
@@ -75,7 +75,7 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
node
.
root
=
parent
.
root
;
node
.
root
=
parent
.
root
;
this
.
children
.
splice
(
index
,
0
,
node
);
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 () {
...
@@ -213,6 +213,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
};
};
//绘制node
//绘制node
var
drawNode
=
function
(
node
)
{
var
drawNode
=
function
(
node
)
{
console
.
log
(
node
);
var
container
=
node
.
getRenderContainer
();
var
container
=
node
.
getRenderContainer
();
var
shape
=
node
.
getData
(
"shape"
);
var
shape
=
node
.
getData
(
"shape"
);
if
(
!
shape
)
new
MinderNodeShape
(
node
);
if
(
!
shape
)
new
MinderNodeShape
(
node
);
...
@@ -310,27 +311,32 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -310,27 +311,32 @@ KityMinder.registerModule( "LayoutDefault", function () {
return
effectSet
;
return
effectSet
;
};
};
//以某个节点为seed对水平方向进行调整
//以某个节点为seed对水平方向进行调整
(调整子树)
var
updateLayoutHorizon
=
function
(
node
)
{
var
updateLayoutHorizon
=
function
(
node
)
{
var
effectSet
=
[];
var
effectSet
=
[];
if
(
!
node
.
getParent
()
)
{
node
.
preTraverse
(
return
[
node
];
function
(
n
)
{
}
var
parent
=
n
.
getParent
();
node
.
preTraverse
(
function
(
n
)
{
if
(
!
parent
)
{
var
_style
=
n
.
getData
(
"style"
);
return
false
;
var
parent
=
node
.
getParent
();
}
var
_parentStyle
=
parent
.
getData
(
"style"
);
var
sX
=
parent
.
getData
(
"x"
);
var
parentX
=
parent
.
getData
(
"x"
);
var
_style
=
n
.
getData
(
"style"
);
var
parentAlign
=
parent
.
getData
(
"align"
);
var
marginLeft
=
_style
.
margin
[
3
];
var
parentWidth
=
parent
.
getRenderContainer
().
getWidth
();
var
marginRight
=
_style
.
margin
[
1
];
if
(
parentAlign
===
"center"
)
parentWidth
=
parentWidth
/
2
;
var
parentWidth
=
parent
.
getRenderContainer
().
getWidth
();
var
selfAppendSide
=
n
.
getData
(
"appendside"
);
if
(
parent
.
getData
(
"align"
)
===
"center"
)
{
if
(
selfAppendSide
===
"right"
)
parentWidth
=
parentWidth
/
2
;
n
.
setData
(
"x"
,
parentX
+
parentWidth
+
_style
.
margin
[
3
]
+
_parentStyle
.
margin
[
1
]
);
}
else
var
selfAlign
=
n
.
getData
(
"align"
);
n
.
setData
(
"x"
,
parentX
-
parentWidth
-
_style
.
margin
[
3
]
-
_parentStyle
.
margin
[
1
]
);
if
(
selfAlign
===
"left"
)
{
effectSet
.
push
(
n
);
n
.
setData
(
"x"
,
sX
+
parentWidth
+
marginLeft
+
marginRight
);
}
);
}
else
{
n
.
setData
(
"x"
,
sX
-
parentWidth
-
marginLeft
-
marginRight
);
}
effectSet
.
push
(
n
);
}
);
return
effectSet
;
return
effectSet
;
};
};
...
@@ -361,21 +367,20 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -361,21 +367,20 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
);
}
);
_root
.
setData
(
"x"
,
minderWidth
/
2
);
_root
.
setData
(
"x"
,
minderWidth
/
2
);
_root
.
setData
(
"y"
,
minderHeight
/
2
);
_root
.
setData
(
"y"
,
minderHeight
/
2
);
_root
.
setData
(
"layer"
,
0
);
_root
.
setData
(
"align"
,
"center"
);
_root
.
setData
(
"align"
,
"center"
);
_root
.
setData
(
"text"
,
"I am the root"
);
_root
.
setData
(
"text"
,
"I am the root"
);
_root
.
setData
(
"appendside"
,
"right"
);
_root
.
setData
(
"appendside"
,
"right"
);
var
children
=
_root
.
getChildren
();
var
children
=
_root
.
getChildren
();
console
.
log
(
children
);
_root
.
setData
(
"leftList"
,
[]
);
_root
.
setData
(
"leftList"
,
[]
);
_root
.
setData
(
"rightList"
,
[]
);
_root
.
setData
(
"rightList"
,
[]
);
minder
.
renderNode
(
_root
);
var
_rootRenderContainer
=
_root
.
getRenderContainer
();
var
_rootRenderContainer
=
_root
.
getRenderContainer
();
_root
.
setData
(
"leftHeight"
,
_rootRenderContainer
.
getHeight
()
);
_root
.
setData
(
"leftHeight"
,
_rootRenderContainer
.
getHeight
()
);
_root
.
setData
(
"rightHeight"
,
_rootRenderContainer
.
getHeight
()
);
_root
.
setData
(
"rightHeight"
,
_rootRenderContainer
.
getHeight
()
);
updateArrangement
(
_root
);
minder
.
renderNode
(
_root
);
//如果是从其他style切过来的,需要重新布局
//如果是从其他style切过来的,需要重新布局
var
_buffer
=
_root
.
getChildren
();
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