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
4a5ccc85
Commit
4a5ccc85
authored
Jun 16, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/fex-team/kityminder
into dev
parents
6c107013
721273a5
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
60 additions
and
31 deletions
+60
-31
kity
kity
+1
-1
connect.js
src/core/connect.js
+1
-2
layout.js
src/core/layout.js
+8
-0
default.js
src/layout/default.js
+26
-9
dragtree.js
src/module/dragtree.js
+5
-5
expand.js
src/module/expand.js
+4
-8
outline.js
src/module/outline.js
+2
-2
xmind.js
src/protocal/xmind.js
+10
-2
default.js
src/theme/default.js
+3
-2
No files found.
kity
@
022e5cb4
Subproject commit
f62ec70beb8198072693e1b7f1748cca46b685fb
Subproject commit
022e5cb489e65df8a38eedf8508478ee1d29c29c
src/core/connect.js
View file @
4a5ccc85
...
@@ -56,9 +56,8 @@ kity.extendClass(Minder, {
...
@@ -56,9 +56,8 @@ kity.extendClass(Minder, {
connection
.
setVisible
(
true
);
connection
.
setVisible
(
true
);
var
provider
=
KityMinder
.
getConnectProvider
(
node
.
getLayout
());
var
provider
=
KityMinder
.
getConnectProvider
(
node
.
getLayout
());
var
pathData
=
provider
(
node
,
parent
);
connection
.
setPathData
(
pathData
);
provider
(
node
,
parent
,
connection
);
}
}
});
});
...
...
src/core/layout.js
View file @
4a5ccc85
...
@@ -105,6 +105,7 @@ kity.extendClass(MinderNode, {
...
@@ -105,6 +105,7 @@ kity.extendClass(MinderNode, {
x
:
p
.
x
,
x
:
p
.
x
,
y
:
p
.
y
y
:
p
.
y
});
});
return
this
;
},
},
getLayoutRoot
:
function
()
{
getLayoutRoot
:
function
()
{
...
@@ -130,6 +131,10 @@ kity.extendClass(MinderNode, {
...
@@ -130,6 +131,10 @@ kity.extendClass(MinderNode, {
this
.
getMinder
().
layout
(
duration
);
this
.
getMinder
().
layout
(
duration
);
return
this
;
return
this
;
},
getPositionContext
:
function
(
node
,
position
)
{
}
}
});
});
...
@@ -167,6 +172,9 @@ kity.extendClass(Minder, {
...
@@ -167,6 +172,9 @@ kity.extendClass(Minder, {
var
matrix
=
node
.
getLayoutTransform
().
merge
(
pMatrix
);
var
matrix
=
node
.
getLayoutTransform
().
merge
(
pMatrix
);
var
lastMatrix
=
node
.
_lastLayoutTransform
||
new
kity
.
Matrix
();
var
lastMatrix
=
node
.
_lastLayoutTransform
||
new
kity
.
Matrix
();
var
offset
=
node
.
getLayoutOffset
();
matrix
.
translate
(
offset
.
x
,
offset
.
y
);
if
(
!
matrix
.
equals
(
lastMatrix
)
||
true
)
{
if
(
!
matrix
.
equals
(
lastMatrix
)
||
true
)
{
// 如果当前有动画,停止动画
// 如果当前有动画,停止动画
...
...
src/layout/default.js
View file @
4a5ccc85
...
@@ -79,12 +79,12 @@ KityMinder.registerLayout('default', kity.createClass({
...
@@ -79,12 +79,12 @@ KityMinder.registerLayout('default', kity.createClass({
x
=
nodeContentBox
.
right
-
childContentBox
.
left
;
x
=
nodeContentBox
.
right
-
childContentBox
.
left
;
x
+=
parent
.
getStyle
(
'margin-right'
)
+
child
.
getStyle
(
'margin-left'
);
x
+=
parent
.
getStyle
(
'margin-right'
)
+
child
.
getStyle
(
'margin-left'
);
child
.
setLayoutVector
(
new
kity
.
Vector
(
childContentBox
.
lef
t
,
childContentBox
.
cy
));
child
.
setLayoutVector
(
new
kity
.
Vector
(
childContentBox
.
righ
t
,
childContentBox
.
cy
));
}
else
{
}
else
{
x
=
nodeContentBox
.
left
-
childContentBox
.
right
;
x
=
nodeContentBox
.
left
-
childContentBox
.
right
;
x
-=
parent
.
getStyle
(
'margin-left'
)
+
child
.
getStyle
(
'margin-right'
);
x
-=
parent
.
getStyle
(
'margin-left'
)
+
child
.
getStyle
(
'margin-right'
);
child
.
setLayoutVector
(
new
kity
.
Vector
(
childContentBox
.
righ
t
,
childContentBox
.
cy
));
child
.
setLayoutVector
(
new
kity
.
Vector
(
childContentBox
.
lef
t
,
childContentBox
.
cy
));
}
}
// 竖直方向上的布局
// 竖直方向上的布局
...
@@ -110,7 +110,14 @@ KityMinder.registerLayout('default', kity.createClass({
...
@@ -110,7 +110,14 @@ KityMinder.registerLayout('default', kity.createClass({
}
}
}));
}));
KityMinder
.
registerConnectProvider
(
'default'
,
function
(
node
,
parent
)
{
var
connectMarker
=
new
kity
.
Marker
().
pipe
(
function
()
{
var
r
=
4
;
var
dot
=
new
kity
.
Circle
(
r
).
fill
(
'white'
);
this
.
addShape
(
dot
);
this
.
setRef
(
r
,
0
).
setViewBox
(
-
r
,
-
r
,
r
+
r
,
r
+
r
).
setWidth
(
r
).
setHeight
(
r
);
});
KityMinder
.
registerConnectProvider
(
'default'
,
function
(
node
,
parent
,
connection
)
{
var
box
=
node
.
getLayoutBox
(),
var
box
=
node
.
getLayoutBox
(),
pBox
=
parent
.
getLayoutBox
();
pBox
=
parent
.
getLayoutBox
();
...
@@ -120,17 +127,23 @@ KityMinder.registerConnectProvider('default', function(node, parent) {
...
@@ -120,17 +127,23 @@ KityMinder.registerConnectProvider('default', function(node, parent) {
var
pathData
=
[];
var
pathData
=
[];
var
side
=
box
.
cx
>
pBox
.
cx
?
'right'
:
'left'
;
var
side
=
box
.
cx
>
pBox
.
cx
?
'right'
:
'left'
;
node
.
getMinder
().
getPaper
().
addResource
(
connectMarker
);
switch
(
node
.
getType
())
{
switch
(
node
.
getType
())
{
case
'main'
:
case
'main'
:
start
=
new
kity
.
Point
(
pBox
.
cx
,
pBox
.
cy
);
start
=
new
kity
.
Point
(
pBox
.
cx
,
pBox
.
cy
);
end
=
side
==
'left'
?
end
=
side
==
'left'
?
new
kity
.
Point
(
box
.
right
,
box
.
cy
)
:
new
kity
.
Point
(
box
.
right
+
2
,
box
.
cy
)
:
new
kity
.
Point
(
box
.
left
,
box
.
cy
);
new
kity
.
Point
(
box
.
left
-
2
,
box
.
cy
);
vector
=
kity
.
Vector
.
fromPoints
(
start
,
end
);
vector
=
kity
.
Vector
.
fromPoints
(
start
,
end
);
pathData
.
push
(
'M'
,
start
);
pathData
.
push
(
'M'
,
start
);
pathData
.
push
(
'A'
,
abs
(
vector
.
x
),
abs
(
vector
.
y
),
0
,
0
,
(
vector
.
x
*
vector
.
y
>
0
?
0
:
1
),
end
);
pathData
.
push
(
'A'
,
abs
(
vector
.
x
),
abs
(
vector
.
y
),
0
,
0
,
(
vector
.
x
*
vector
.
y
>
0
?
0
:
1
),
end
);
connection
.
setMarker
(
connectMarker
);
break
;
break
;
case
'sub'
:
case
'sub'
:
...
@@ -139,13 +152,13 @@ KityMinder.registerConnectProvider('default', function(node, parent) {
...
@@ -139,13 +152,13 @@ KityMinder.registerConnectProvider('default', function(node, parent) {
if
(
side
==
'right'
)
{
if
(
side
==
'right'
)
{
start
=
new
kity
.
Point
(
box
.
left
-
node
.
getStyle
(
'margin-left'
)
/
2
,
pBox
.
cy
);
start
=
new
kity
.
Point
(
box
.
left
-
node
.
getStyle
(
'margin-left'
)
/
2
,
pBox
.
cy
);
end
=
new
kity
.
Point
(
box
.
right
+
node
.
getStyle
(
'margin-right'
)
/
2
,
box
.
bottom
);
end
=
new
kity
.
Point
(
box
.
right
+
node
.
getStyle
(
'margin-right'
),
box
.
bottom
);
}
else
{
}
else
{
start
=
new
kity
.
Point
(
box
.
right
+
node
.
getStyle
(
'margin-right'
)
/
2
,
pBox
.
cy
);
start
=
new
kity
.
Point
(
box
.
right
+
node
.
getStyle
(
'margin-right'
)
/
2
,
pBox
.
cy
);
end
=
new
kity
.
Point
(
box
.
left
-
node
.
getStyle
(
'margin-left'
)
/
2
,
box
.
bottom
);
end
=
new
kity
.
Point
(
box
.
left
-
node
.
getStyle
(
'margin-left'
),
box
.
bottom
);
}
}
end
.
y
+=
1
;
end
.
y
+=
3
;
var
isTop
=
parent
.
children
.
length
>
1
&&
node
.
getIndex
()
===
0
;
var
isTop
=
parent
.
children
.
length
>
1
&&
node
.
getIndex
()
===
0
;
...
@@ -157,7 +170,11 @@ KityMinder.registerConnectProvider('default', function(node, parent) {
...
@@ -157,7 +170,11 @@ KityMinder.registerConnectProvider('default', function(node, parent) {
pathData
.
push
(
'A'
,
radius
,
radius
,
0
,
0
,
sf
,
ex
,
end
.
y
);
pathData
.
push
(
'A'
,
radius
,
radius
,
0
,
0
,
sf
,
ex
,
end
.
y
);
pathData
.
push
(
'L'
,
end
);
pathData
.
push
(
'L'
,
end
);
connection
.
setMarker
(
null
);
break
;
}
}
return
pathData
;
connection
.
setPathData
(
pathData
)
;
});
});
\ No newline at end of file
src/module/dragtree.js
View file @
4a5ccc85
...
@@ -234,11 +234,11 @@ var DragBox = kity.createClass('DragBox', {
...
@@ -234,11 +234,11 @@ var DragBox = kity.createClass('DragBox', {
}
}
var
movement
=
kity
.
Vector
.
fromPoints
(
this
.
_startPosition
,
this
.
_dragPosition
);
var
movement
=
kity
.
Vector
.
fromPoints
(
this
.
_startPosition
,
this
.
_dragPosition
);
//
var minder = this._minder;
var
minder
=
this
.
_minder
;
//
this._dragSources.forEach(function(source) {
this
.
_dragSources
.
forEach
(
function
(
source
)
{
//
source.setLayoutOffset(movement);
source
.
setLayoutOffset
(
movement
);
//
minder.layout();
minder
.
layout
();
//
});
});
this
.
setTranslate
(
movement
);
this
.
setTranslate
(
movement
);
...
...
src/module/expand.js
View file @
4a5ccc85
...
@@ -203,17 +203,13 @@ KityMinder.registerModule('Expand', function() {
...
@@ -203,17 +203,13 @@ KityMinder.registerModule('Expand', function() {
var
x
,
y
;
var
x
,
y
;
var
right
=
node
.
getLayoutPoint
().
x
>
node
.
parent
.
getLayoutPoint
().
x
;
var
pos
=
node
.
getLayoutVector
()
;
x
=
right
?
pos
=
new
kity
.
Vector
(
pos
.
x
,
pos
.
y
);
node
.
getContentBox
().
right
+
node
.
getStyle
(
'margin-right'
)
:
node
.
getContentBox
().
left
-
node
.
getStyle
(
'margin-left'
);
y
=
node
.
getType
()
==
'main'
?
pos
=
pos
.
normalize
(
pos
.
length
()
+
expander
.
radius
+
1
);
node
.
getContentBox
().
cy
:
node
.
getContentBox
().
bottom
;
this
.
expander
.
setTranslate
(
x
,
y
);
this
.
expander
.
setTranslate
(
pos
);
}
}
});
});
return
{
return
{
...
...
src/module/outline.js
View file @
4a5ccc85
...
@@ -17,7 +17,7 @@ KityMinder.registerModule('OutlineModule', function() {
...
@@ -17,7 +17,7 @@ KityMinder.registerModule('OutlineModule', function() {
var
shadow
=
this
.
shadow
=
new
kity
.
Rect
()
var
shadow
=
this
.
shadow
=
new
kity
.
Rect
()
.
setId
(
KityMinder
.
uuid
(
'node_shadow'
))
.
setId
(
KityMinder
.
uuid
(
'node_shadow'
))
.
fill
(
'black'
)
.
fill
(
'black'
)
.
setOpacity
(
0.2
);
.
setOpacity
(
0.2
5
);
group
.
addShapes
([
shadow
,
outline
]);
group
.
addShapes
([
shadow
,
outline
]);
...
@@ -62,7 +62,7 @@ KityMinder.registerModule('OutlineModule', function() {
...
@@ -62,7 +62,7 @@ KityMinder.registerModule('OutlineModule', function() {
if
(
node
.
getLevel
()
<
2
)
{
if
(
node
.
getLevel
()
<
2
)
{
this
.
shadow
this
.
shadow
.
setVisible
(
true
)
.
setVisible
(
true
)
.
setPosition
(
outlineBox
.
x
+
3
,
outlineBox
.
y
+
4
)
.
setPosition
(
outlineBox
.
x
+
4
,
outlineBox
.
y
+
5
)
.
setSize
(
outlineBox
.
width
,
outlineBox
.
height
)
.
setSize
(
outlineBox
.
width
,
outlineBox
.
height
)
.
setRadius
(
node
.
getStyle
(
'radius'
));
.
setRadius
(
node
.
getStyle
(
'radius'
));
}
else
{
}
else
{
...
...
src/protocal/xmind.js
View file @
4a5ccc85
...
@@ -29,6 +29,13 @@ KityMinder.registerProtocal( 'xmind', function () {
...
@@ -29,6 +29,13 @@ KityMinder.registerProtocal( 'xmind', function () {
,
'task-7oct'
:
null
,
'task-7oct'
:
null
};
};
function
getAttachedNode
(
arr
){
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
[
i
].
type
==
"attached"
)
return
arr
[
i
]
}
}
function
processTopic
(
topic
,
obj
){
function
processTopic
(
topic
,
obj
){
//处理文本
//处理文本
...
@@ -54,8 +61,9 @@ KityMinder.registerProtocal( 'xmind', function () {
...
@@ -54,8 +61,9 @@ KityMinder.registerProtocal( 'xmind', function () {
}
}
//处理子节点
//处理子节点
if
(
topic
.
children
&&
topic
.
children
.
topics
&&
topic
.
children
.
topics
.
topic
){
var
topics
;
var
tmp
=
topic
.
children
.
topics
.
topic
;
if
(
topic
.
children
&&
(
topics
=
topic
.
children
.
topics
)
&&
(
topics
.
topic
||
(
utils
.
isArray
(
topics
)
&&
topics
.
length
>
0
)
)
){
var
tmp
=
topics
.
topic
||
(
getAttachedNode
(
topics
)).
topic
;
if
(
tmp
.
length
&&
tmp
.
length
>
0
){
//多个子节点
if
(
tmp
.
length
&&
tmp
.
length
>
0
){
//多个子节点
obj
.
children
=
[];
obj
.
children
=
[];
...
...
src/theme/default.js
View file @
4a5ccc85
...
@@ -13,7 +13,7 @@ KityMinder.registerTheme('default', {
...
@@ -13,7 +13,7 @@ KityMinder.registerTheme('default', {
'main-stroke'
:
'none'
,
'main-stroke'
:
'none'
,
'main-font-size'
:
16
,
'main-font-size'
:
16
,
'main-padding'
:
[
6
,
20
],
'main-padding'
:
[
6
,
20
],
'main-margin'
:
[
30
,
6
],
'main-margin'
:
[
30
,
10
],
'main-radius'
:
10
,
'main-radius'
:
10
,
'main-space'
:
5
,
'main-space'
:
5
,
...
@@ -22,7 +22,8 @@ KityMinder.registerTheme('default', {
...
@@ -22,7 +22,8 @@ KityMinder.registerTheme('default', {
'sub-stroke'
:
'white'
,
'sub-stroke'
:
'white'
,
'sub-font-size'
:
12
,
'sub-font-size'
:
12
,
'sub-padding'
:
[
5
,
10
],
'sub-padding'
:
[
5
,
10
],
'sub-margin'
:
[
5
,
15
],
'sub-margin'
:
10
,
'sub-tree-margin'
:
30
,
'sub-radius'
:
5
,
'sub-radius'
:
5
,
'sub-space'
:
5
,
'sub-space'
:
5
,
...
...
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