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
ba2e8cfd
Commit
ba2e8cfd
authored
Jan 17, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added highlight
parent
63e5cf18
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
layout.default.js
src/module/layout.default.js
+20
-10
No files found.
src/module/layout.default.js
View file @
ba2e8cfd
...
...
@@ -148,20 +148,31 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
MinderNodeShape
=
kity
.
createClass
(
"MinderNodeShape"
,
(
function
()
{
return
{
constructor
:
function
(
node
)
{
var
txt
=
new
kity
.
Text
();
var
rect
=
new
kity
.
Rect
();
var
txt
=
this
.
_txt
=
new
kity
.
Text
();
var
rect
=
this
.
_rect
=
new
kity
.
Rect
();
this
.
_node
=
node
;
var
container
=
node
.
getRenderContainer
();
container
.
addShapes
(
[
rect
,
txt
]
);
node
.
setData
(
"shape"
,
this
);
var
ND
=
JSON
.
parse
(
JSON
.
stringify
(
nodeDefautStyle
)
);
node
.
setData
(
"style"
,
Utils
.
extend
(
ND
,
node
.
getData
(
"style"
)
)
);
var
_style
=
node
.
getData
(
"style"
);
var
container
=
node
.
getRenderContainer
();
container
.
addShapes
(
[
rect
,
txt
]
);
txt
.
setContent
(
node
.
getData
(
"text"
)
||
"新建节点"
).
setSize
(
_style
.
fontSize
).
fill
(
_style
.
color
);
var
_txtHeight
=
txt
.
getHeight
();
txt
.
translate
(
_style
.
padding
[
3
],
_txtHeight
+
_style
.
padding
[
0
]
);
this
.
update
();
},
update
:
function
()
{
var
node
=
this
.
_node
;
var
txt
=
this
.
_txt
;
var
rect
=
this
.
_rect
;
var
_style
=
node
.
getData
(
"style"
);
txt
.
setContent
(
node
.
getData
(
"text"
)
||
"新建节点"
).
setSize
(
_style
.
fontSize
).
fill
(
_style
.
color
);
var
_txtHeight
=
txt
.
getHeight
();
var
_rectWidth
=
_style
.
padding
[
1
]
+
_style
.
padding
[
3
]
+
txt
.
getWidth
();
var
_rectHeight
=
_style
.
padding
[
0
]
+
_style
.
padding
[
2
]
+
_txtHeight
;
rect
.
fill
(
_style
.
fill
).
stroke
(
_style
.
stroke
).
setRadius
(
_style
.
radius
).
setWidth
(
_rectWidth
).
setHeight
(
_rectHeight
);
if
(
node
.
highlight
)
{
if
(
node
.
getData
(
"highlight"
)
)
{
rect
.
stroke
(
new
kity
.
Pen
(
"white"
,
3
)
);
}
}
...
...
@@ -200,8 +211,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
//绘制node
var
drawNode
=
function
(
node
)
{
var
container
=
node
.
getRenderContainer
();
container
.
clear
();
var
shape
=
new
MinderNodeShape
(
node
);
var
shape
=
node
.
getData
(
"shape"
);
if
(
!
shape
)
new
MinderNodeShape
(
node
);
else
shape
.
update
();
updateConnect
(
minder
,
node
);
};
//调整node的位置
...
...
@@ -240,9 +252,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
centerY
=
node
.
getData
(
"y"
);
var
nodeBranchHeight
=
node
.
getData
(
appendside
+
"Height"
)
||
node
.
getData
(
"branchheight"
);
var
nodeChildren
=
node
.
getData
(
appendside
+
"List"
)
||
node
.
getChildren
();
if
(
node
===
root
)
{
console
.
log
(
nodeChildren
);
}
var
sY
=
centerY
-
nodeBranchHeight
/
2
;
for
(
var
i
=
0
;
i
<
nodeChildren
.
length
;
i
++
)
{
var
childBranchHeight
=
nodeChildren
[
i
].
getData
(
"branchheight"
);
...
...
@@ -327,6 +336,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
set2
=
updateLayoutVertical
(
node
,
node
.
getParent
(),
"append"
);
//获取水平方向和垂直方向受影响的点的并集然后进行统一translate
var
set
=
uSet
(
set1
,
set2
);
console
.
log
(
set
);
for
(
var
i
=
0
;
i
<
set
.
length
;
i
++
)
{
translateNode
(
set
[
i
]
);
}
...
...
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