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
af01ed18
Commit
af01ed18
authored
Jan 06, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed data structure
parent
4ccb9c9b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
32 deletions
+23
-32
dev.html
demo/dev.html
+8
-10
connect.js
src/module/connect.js
+2
-2
layout.js
src/module/layout.js
+1
-5
render.js
src/module/render.js
+12
-15
No files found.
demo/dev.html
View file @
af01ed18
...
@@ -15,20 +15,18 @@
...
@@ -15,20 +15,18 @@
var
minderHeight
=
document
.
body
.
clientHeight
;
var
minderHeight
=
document
.
body
.
clientHeight
;
var
_root
=
minder
.
getRoot
();
var
_root
=
minder
.
getRoot
();
_root
.
setData
(
"data"
,{
_root
.
setData
(
"style"
,{
style
:{
radius
:
10
,
radius
:
10
,
fill
:
"orange"
,
fill
:
"orange"
,
stroke
:
"orange"
,
stroke
:
"orange"
,
color
:
"black"
,
color
:
"black"
,
padding
:[
10
,
10
,
10
,
10
],
padding
:[
10
,
10
,
10
,
10
],
fontSize
:
20
,
fontSize
:
20
,
},
text
:
"I am the root"
,
});
});
_root
.
setData
(
"x"
,
minderWidth
/
2
);
_root
.
setData
(
"x"
,
minderWidth
/
2
);
_root
.
setData
(
"y"
,
minderHeight
/
2
);
_root
.
setData
(
"y"
,
minderHeight
/
2
);
_root
.
setData
(
"align"
,
"center"
);
_root
.
setData
(
"align"
,
"center"
);
_root
.
setData
(
"text"
,
"I am the root"
);
minder
.
select
(
_root
);
minder
.
select
(
_root
);
minder
.
execCommand
(
"rendernode"
,
_root
);
minder
.
execCommand
(
"rendernode"
,
_root
);
...
...
src/module/connect.js
View file @
af01ed18
...
@@ -154,8 +154,8 @@ var ConnectModule = KityMinder.registerModule( "ConnectModule", function () {
...
@@ -154,8 +154,8 @@ var ConnectModule = KityMinder.registerModule( "ConnectModule", function () {
connectExist
.
updateConnection
();
connectExist
.
updateConnection
();
}
else
{
}
else
{
var
_connect
=
new
ConnectBezier
(
parent
.
getRenderContainer
(),
curnode
.
getRenderContainer
()
);
var
_connect
=
new
ConnectBezier
(
parent
.
getRenderContainer
(),
curnode
.
getRenderContainer
()
);
var
nodeD
=
curnode
.
getData
(
"
data
"
);
var
nodeD
=
curnode
.
getData
(
"
style
"
);
_connect
.
stroke
(
new
kity
.
Pen
(
nodeD
.
st
yle
.
stroke
,
nodeD
.
style
.
strokeWidth
)
);
_connect
.
stroke
(
new
kity
.
Pen
(
nodeD
.
st
roke
,
nodeD
.
strokeWidth
)
);
curnode
.
setData
(
"connect"
,
_connect
);
curnode
.
setData
(
"connect"
,
_connect
);
minder
.
getRenderContainer
().
addShape
(
_connect
);
minder
.
getRenderContainer
().
addShape
(
_connect
);
}
}
...
...
src/module/layout.js
View file @
af01ed18
...
@@ -7,10 +7,7 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -7,10 +7,7 @@ KityMinder.registerModule( "LayoutModule", function () {
_node
.
setData
(
"x"
,
parent
.
getData
(
"x"
)
+
200
);
_node
.
setData
(
"x"
,
parent
.
getData
(
"x"
)
+
200
);
_node
.
setData
(
"y"
,
Math
.
random
()
*
300
+
100
);
_node
.
setData
(
"y"
,
Math
.
random
()
*
300
+
100
);
_node
.
setData
(
"align"
,
"left"
);
_node
.
setData
(
"align"
,
"left"
);
var
_nodeD
=
{
_node
.
setData
(
"text"
,
"New Node"
);
text
:
"New Node"
,
align
:
"left"
};
switch
(
parent
.
branchside
)
{
switch
(
parent
.
branchside
)
{
case
"left"
:
case
"left"
:
break
;
break
;
...
@@ -22,7 +19,6 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -22,7 +19,6 @@ KityMinder.registerModule( "LayoutModule", function () {
}
)();
}
)();
break
;
break
;
}
}
_node
.
setData
(
"data"
,
_nodeD
);
parent
.
insertChild
(
_node
);
parent
.
insertChild
(
_node
);
km
.
execCommand
(
'rendernode'
,
_node
);
km
.
execCommand
(
'rendernode'
,
_node
);
return
_node
;
return
_node
;
...
...
src/module/render.js
View file @
af01ed18
...
@@ -19,25 +19,22 @@ KityMinder.registerModule( "RenderModule", function () {
...
@@ -19,25 +19,22 @@ KityMinder.registerModule( "RenderModule", function () {
}
)()
);
}
)()
);
var
renderNode
=
function
(
km
,
node
)
{
var
renderNode
=
function
(
km
,
node
)
{
var
node_default
=
{
var
styledefault
=
{
text
:
"Root"
,
radius
:
5
,
style
:
{
fill
:
"yellow"
,
radius
:
10
,
stroke
:
"orange"
,
fill
:
"yellow"
,
color
:
"black"
,
stroke
:
"orange"
,
padding
:
[
5
,
5
,
5
,
5
],
color
:
"black"
,
fontSize
:
14
padding
:
[
5
,
5
,
5
,
5
],
fontSize
:
12
}
};
};
var
kR
=
node
.
getRenderContainer
();
var
kR
=
node
.
getRenderContainer
();
var
nodeShape
=
new
MinderNodeShape
(
kR
);
var
nodeShape
=
new
MinderNodeShape
(
kR
);
var
nd
=
JSON
.
parse
(
JSON
.
stringify
(
node_
default
)
);
var
nd
=
JSON
.
parse
(
JSON
.
stringify
(
style
default
)
);
var
nodeD
=
Utils
.
extend
(
nd
,
node
.
getData
(
"
data
"
)
);
var
nodeD
=
Utils
.
extend
(
nd
,
node
.
getData
(
"
style
"
)
);
node
.
setData
(
"
data
"
,
nodeD
);
node
.
setData
(
"
style
"
,
nodeD
);
var
_style
=
nodeD
.
style
;
var
_style
=
nodeD
;
nodeShape
.
text
nodeShape
.
text
.
setContent
(
node
D
.
text
||
"Node"
)
.
setContent
(
node
.
getData
(
"text"
)
||
"Node"
)
.
setSize
(
nodeD
.
fontSize
)
.
setSize
(
nodeD
.
fontSize
)
.
fill
(
nodeD
.
color
);
.
fill
(
nodeD
.
color
);
var
txtWidth
=
nodeShape
.
text
.
getWidth
();
var
txtWidth
=
nodeShape
.
text
.
getWidth
();
...
...
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