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 @@
var
minderHeight
=
document
.
body
.
clientHeight
;
var
_root
=
minder
.
getRoot
();
_root
.
setData
(
"data"
,{
style
:{
radius
:
10
,
fill
:
"orange"
,
stroke
:
"orange"
,
color
:
"black"
,
padding
:[
10
,
10
,
10
,
10
],
fontSize
:
20
,
},
text
:
"I am the root"
,
_root
.
setData
(
"style"
,{
radius
:
10
,
fill
:
"orange"
,
stroke
:
"orange"
,
color
:
"black"
,
padding
:[
10
,
10
,
10
,
10
],
fontSize
:
20
,
});
_root
.
setData
(
"x"
,
minderWidth
/
2
);
_root
.
setData
(
"y"
,
minderHeight
/
2
);
_root
.
setData
(
"align"
,
"center"
);
_root
.
setData
(
"text"
,
"I am the root"
);
minder
.
select
(
_root
);
minder
.
execCommand
(
"rendernode"
,
_root
);
...
...
src/module/connect.js
View file @
af01ed18
...
...
@@ -154,8 +154,8 @@ var ConnectModule = KityMinder.registerModule( "ConnectModule", function () {
connectExist
.
updateConnection
();
}
else
{
var
_connect
=
new
ConnectBezier
(
parent
.
getRenderContainer
(),
curnode
.
getRenderContainer
()
);
var
nodeD
=
curnode
.
getData
(
"
data
"
);
_connect
.
stroke
(
new
kity
.
Pen
(
nodeD
.
st
yle
.
stroke
,
nodeD
.
style
.
strokeWidth
)
);
var
nodeD
=
curnode
.
getData
(
"
style
"
);
_connect
.
stroke
(
new
kity
.
Pen
(
nodeD
.
st
roke
,
nodeD
.
strokeWidth
)
);
curnode
.
setData
(
"connect"
,
_connect
);
minder
.
getRenderContainer
().
addShape
(
_connect
);
}
...
...
src/module/layout.js
View file @
af01ed18
...
...
@@ -7,10 +7,7 @@ KityMinder.registerModule( "LayoutModule", function () {
_node
.
setData
(
"x"
,
parent
.
getData
(
"x"
)
+
200
);
_node
.
setData
(
"y"
,
Math
.
random
()
*
300
+
100
);
_node
.
setData
(
"align"
,
"left"
);
var
_nodeD
=
{
text
:
"New Node"
,
align
:
"left"
};
_node
.
setData
(
"text"
,
"New Node"
);
switch
(
parent
.
branchside
)
{
case
"left"
:
break
;
...
...
@@ -22,7 +19,6 @@ KityMinder.registerModule( "LayoutModule", function () {
}
)();
break
;
}
_node
.
setData
(
"data"
,
_nodeD
);
parent
.
insertChild
(
_node
);
km
.
execCommand
(
'rendernode'
,
_node
);
return
_node
;
...
...
src/module/render.js
View file @
af01ed18
...
...
@@ -19,25 +19,22 @@ KityMinder.registerModule( "RenderModule", function () {
}
)()
);
var
renderNode
=
function
(
km
,
node
)
{
var
node_default
=
{
text
:
"Root"
,
style
:
{
radius
:
10
,
fill
:
"yellow"
,
stroke
:
"orange"
,
color
:
"black"
,
padding
:
[
5
,
5
,
5
,
5
],
fontSize
:
12
}
var
styledefault
=
{
radius
:
5
,
fill
:
"yellow"
,
stroke
:
"orange"
,
color
:
"black"
,
padding
:
[
5
,
5
,
5
,
5
],
fontSize
:
14
};
var
kR
=
node
.
getRenderContainer
();
var
nodeShape
=
new
MinderNodeShape
(
kR
);
var
nd
=
JSON
.
parse
(
JSON
.
stringify
(
node_
default
)
);
var
nodeD
=
Utils
.
extend
(
nd
,
node
.
getData
(
"
data
"
)
);
node
.
setData
(
"
data
"
,
nodeD
);
var
_style
=
nodeD
.
style
;
var
nd
=
JSON
.
parse
(
JSON
.
stringify
(
style
default
)
);
var
nodeD
=
Utils
.
extend
(
nd
,
node
.
getData
(
"
style
"
)
);
node
.
setData
(
"
style
"
,
nodeD
);
var
_style
=
nodeD
;
nodeShape
.
text
.
setContent
(
node
D
.
text
||
"Node"
)
.
setContent
(
node
.
getData
(
"text"
)
||
"Node"
)
.
setSize
(
nodeD
.
fontSize
)
.
fill
(
nodeD
.
color
);
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