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
7eeea30b
Commit
7eeea30b
authored
Jun 11, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
render expander at layout vector
parent
aa0c2a52
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
23 deletions
+36
-23
kity
kity
+1
-1
connect.js
src/core/connect.js
+1
-2
default.js
src/layout/default.js
+25
-8
expand.js
src/module/expand.js
+4
-8
outline.js
src/module/outline.js
+2
-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 @
7eeea30b
...
@@ -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/layout/default.js
View file @
7eeea30b
...
@@ -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,10 +152,10 @@ KityMinder.registerConnectProvider('default', function(node, parent) {
...
@@ -139,10 +152,10 @@ 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
+=
1
;
...
@@ -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/expand.js
View file @
7eeea30b
...
@@ -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 @
7eeea30b
...
@@ -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/theme/default.js
View file @
7eeea30b
...
@@ -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