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
6ab996cf
Commit
6ab996cf
authored
Jul 02, 2014
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into ui-for-1.2.0
parents
d84392fd
38b96851
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
133 additions
and
89 deletions
+133
-89
zh-cn.js
lang/zh-cn/zh-cn.js
+6
-1
layout.js
src/core/layout.js
+3
-0
default.connect.js
src/layout/default.connect.js
+12
-6
default.js
src/layout/default.js
+1
-1
filetree.js
src/layout/filetree.js
+4
-3
outline.js
src/module/outline.js
+2
-2
select.js
src/module/select.js
+4
-1
text.js
src/module/text.js
+4
-2
view.js
src/module/view.js
+2
-5
default.js
src/theme/default.js
+4
-6
fresh.js
src/theme/fresh.js
+72
-58
snow.js
src/theme/snow.js
+19
-4
No files found.
lang/zh-cn/zh-cn.js
View file @
6ab996cf
...
...
@@ -6,7 +6,12 @@ KityMinder.LANG['zh-cn'] = {
'theme'
:
{
'default'
:
'脑图经典'
,
'snow'
:
'温柔冷光'
,
'fresh'
:
'文艺小清新'
'fresh-red'
:
'清新红'
,
'fresh-soil'
:
'泥土'
,
'fresh-green'
:
'自然'
,
'fresh-blue'
:
'天空'
,
'fresh-purple'
:
'浪漫'
,
'fresh-pink'
:
'可爱'
},
'maintopic'
:
'中心主题'
,
'topic'
:
'分支主题'
,
...
...
src/core/layout.js
View file @
6ab996cf
...
...
@@ -192,6 +192,9 @@ kity.extendClass(Minder, {
var
offset
=
node
.
getLayoutOffset
();
matrix
.
translate
(
offset
.
x
,
offset
.
y
);
matrix
.
m
.
e
=
Math
.
round
(
matrix
.
m
.
e
);
matrix
.
m
.
f
=
Math
.
round
(
matrix
.
m
.
f
);
if
(
!
matrix
.
equals
(
lastMatrix
)
||
true
)
{
// 如果当前有动画,停止动画
...
...
src/layout/default.connect.js
View file @
6ab996cf
var
connectMarker
=
new
kity
.
Marker
().
pipe
(
function
()
{
var
r
=
4
;
var
dot
=
new
kity
.
Circle
(
r
);
var
r
=
7
;
var
dot
=
new
kity
.
Circle
(
r
-
1
);
this
.
addShape
(
dot
);
this
.
setRef
(
r
,
0
).
setViewBox
(
-
r
,
-
r
,
r
+
r
,
r
+
r
).
setWidth
(
r
).
setHeight
(
r
);
this
.
setRef
(
r
-
1
,
0
).
setViewBox
(
-
r
,
-
r
,
r
+
r
,
r
+
r
).
setWidth
(
r
).
setHeight
(
r
);
this
.
dot
=
dot
;
this
.
node
.
setAttribute
(
'markerUnits'
,
'userSpaceOnUse'
);
});
KityMinder
.
registerConnectProvider
(
'default'
,
function
(
node
,
parent
,
connection
,
width
,
color
)
{
...
...
@@ -39,22 +40,27 @@ KityMinder.registerConnectProvider('default', function(node, parent, connection,
case
'sub'
:
var
radius
=
node
.
getStyle
(
'connect-radius'
);
var
underY
=
box
.
bottom
+
2
;
var
underY
=
box
.
bottom
+
3
;
var
startY
=
parent
.
getType
()
==
'sub'
?
pBox
.
bottom
+
2
:
pBox
.
cy
;
var
p1
,
p2
,
p3
,
mx
;
if
(
side
==
'right'
)
{
p1
=
new
kity
.
Point
(
pBox
.
right
+
10
,
startY
);
p2
=
new
kity
.
Point
(
box
.
left
,
underY
);
p3
=
new
kity
.
Point
(
box
.
right
+
10
.5
,
underY
);
p3
=
new
kity
.
Point
(
box
.
right
+
10
,
underY
);
}
else
{
p1
=
new
kity
.
Point
(
pBox
.
left
-
10
,
startY
);
p2
=
new
kity
.
Point
(
box
.
right
,
underY
);
p3
=
new
kity
.
Point
(
box
.
left
-
10
.5
,
underY
);
p3
=
new
kity
.
Point
(
box
.
left
-
10
,
underY
);
}
mx
=
(
p1
.
x
+
p2
.
x
)
/
2
;
if
(
width
%
2
===
0
)
{
p2
.
y
+=
0.5
;
p3
.
y
+=
0.5
;
}
pathData
.
push
(
'M'
,
p1
);
pathData
.
push
(
'C'
,
mx
,
p1
.
y
,
mx
,
p2
.
y
,
p2
);
pathData
.
push
(
'L'
,
p3
);
...
...
src/layout/default.js
View file @
6ab996cf
...
...
@@ -116,7 +116,7 @@ KityMinder.registerLayout('default', kity.createClass({
getOrderHint
:
function
(
node
)
{
var
hint
=
[];
var
box
=
node
.
getLayoutBox
();
var
offset
=
node
.
getLevel
()
>
1
?
3
:
5
;
var
offset
=
5
;
hint
.
push
({
type
:
'up'
,
...
...
src/layout/filetree.js
View file @
6ab996cf
...
...
@@ -91,8 +91,9 @@ KityMinder.registerConnectProvider('filetree', function(node, parent, connection
pBox
=
parent
.
getLayoutBox
();
var
pathData
=
[];
var
left
=
parent
.
getLayoutPoint
().
x
;
pathData
.
push
(
'M'
,
new
kity
.
Point
(
left
,
pBox
.
bottom
+
1
));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
left
,
box
.
cy
));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
box
.
left
,
box
.
cy
));
var
r
=
Math
.
round
;
pathData
.
push
(
'M'
,
new
kity
.
Point
(
r
(
left
),
r
(
pBox
.
bottom
)));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
r
(
left
),
r
(
box
.
cy
)));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
r
(
box
.
left
),
r
(
box
.
cy
)));
connection
.
setPathData
(
pathData
);
});
\ No newline at end of file
src/module/outline.js
View file @
6ab996cf
...
...
@@ -34,8 +34,8 @@ var OutlineRenderer = kity.createClass('OutlineRenderer', {
.
setPosition
(
outlineBox
.
x
,
outlineBox
.
y
)
.
setSize
(
outlineBox
.
width
,
outlineBox
.
height
)
.
setRadius
(
node
.
getStyle
(
'radius'
))
.
fill
(
node
.
getStyle
(
prefix
+
'background'
))
.
stroke
(
node
.
getStyle
(
prefix
+
'stroke'
),
.
fill
(
node
.
getStyle
(
prefix
+
'background'
)
||
node
.
getStyle
(
'background'
)
)
.
stroke
(
node
.
getStyle
(
prefix
+
'stroke'
||
node
.
getStyle
(
'stroke'
)
),
node
.
getStyle
(
prefix
+
'stroke-width'
));
return
outlineBox
;
...
...
src/module/select.js
View file @
6ab996cf
...
...
@@ -56,7 +56,10 @@ KityMinder.registerModule('Select', function() {
selectedNodes
=
[];
// 使其犀利
g
.
snapToSharp
(
marquee
);
marquee
.
left
=
Math
.
round
(
marquee
.
left
);
marquee
.
top
=
Math
.
round
(
marquee
.
top
);
marquee
.
right
=
Math
.
round
(
marquee
.
right
);
marquee
.
bottom
=
Math
.
round
(
marquee
.
bottom
);
// 选区形状更新
marqueeShape
.
getDrawer
().
pipe
(
function
()
{
...
...
src/module/text.js
View file @
6ab996cf
...
...
@@ -11,7 +11,9 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
update
:
function
(
text
,
node
)
{
this
.
setTextStyle
(
node
,
text
.
setContent
(
node
.
getText
()));
return
text
.
getBoundaryBox
();
var
box
=
text
.
getBoundaryBox
();
var
r
=
Math
.
round
;
return
new
kity
.
Box
(
r
(
box
.
x
),
r
(
box
.
y
),
r
(
box
.
width
),
r
(
box
.
height
));
},
setTextStyle
:
function
(
node
,
text
)
{
...
...
@@ -31,7 +33,7 @@ utils.extend(TextRenderer, {
});
kity
.
extendClass
(
MinderNode
,{
getTextShape
:
function
(){
getTextShape
:
function
()
{
return
this
.
getRenderer
(
'TextRenderer'
).
getRenderShape
();
}
});
...
...
src/module/view.js
View file @
6ab996cf
...
...
@@ -2,11 +2,8 @@ var ViewDragger = kity.createClass("ViewDragger", {
constructor
:
function
(
minder
)
{
this
.
_minder
=
minder
;
this
.
_enabled
=
false
;
this
.
_offset
=
{
x
:
0
,
y
:
0
};
this
.
_bind
();
this
.
_minder
.
getRenderContainer
().
translate
(
0.5
,
0.5
);
},
isEnabled
:
function
()
{
return
this
.
_enabled
;
...
...
@@ -203,7 +200,7 @@ KityMinder.registerModule('View', function() {
},
b
=
this
.
_lastClientSize
;
this
.
getRenderContainer
().
translate
(
(
a
.
width
-
b
.
width
)
/
2
,
(
a
.
height
-
b
.
height
)
/
2
);
(
a
.
width
-
b
.
width
)
/
2
|
0
,
(
a
.
height
-
b
.
height
)
/
2
|
0
);
this
.
_lastClientSize
=
a
;
}
}
...
...
src/theme/default.js
View file @
6ab996cf
KityMinder
.
registerTheme
(
'default'
,
{
'name'
:
'脑图经典'
,
'root-color'
:
'#430'
,
'root-background'
:
'#e9df98'
,
'root-stroke'
:
'
none
'
,
'root-stroke'
:
'
#e9df98
'
,
'root-font-size'
:
24
,
'root-padding'
:
[
15
,
25
],
'root-margin'
:
[
30
,
100
],
...
...
@@ -14,7 +11,7 @@ KityMinder.registerTheme('default', {
'main-color'
:
'#333'
,
'main-background'
:
'#a4c5c0'
,
'main-stroke'
:
'
none
'
,
'main-stroke'
:
'
#a4c5c0
'
,
'main-font-size'
:
16
,
'main-padding'
:
[
6
,
20
],
'main-margin'
:
20
,
...
...
@@ -37,6 +34,7 @@ KityMinder.registerTheme('default', {
'connect-radius'
:
5
,
'selected-background'
:
'rgb(254, 219, 0)'
,
'selected-stroke'
:
'rgb(254, 219, 0)'
,
'selected-color'
:
'black'
,
'marquee-background'
:
'rgba(255,255,255,.3)'
,
...
...
@@ -49,5 +47,5 @@ KityMinder.registerTheme('default', {
'order-hint-area-color'
:
'rgba(0, 255, 0, .5)'
,
'order-hint-path-color'
:
'#0f0'
,
'order-hint-path-width'
:
2
'order-hint-path-width'
:
1
});
\ No newline at end of file
src/theme/fresh.js
View file @
6ab996cf
KityMinder
.
registerTheme
(
'fresh'
,
{
'name'
:
'文艺小清新'
,
'background'
:
'white'
,
'root-color'
:
'#fff'
,
'root-background'
:
'#73bf75'
,
'root-selected-background'
:
'#73bf75'
,
'root-stroke'
:
'none'
,
'root-font-size'
:
16
,
'root-padding'
:
[
12
,
24
],
'root-margin'
:
[
30
,
100
],
'root-radius'
:
5
,
'root-space'
:
10
,
'main-color'
:
'#000'
,
'main-background'
:
'#f3f9f3'
,
'main-selected-background'
:
'#f3f9f3'
,
'main-stroke'
:
'#beddbf'
,
'main-stroke-width'
:
1
,
'main-font-size'
:
16
,
'main-padding'
:
[
6
,
20
],
'main-margin'
:
20
,
'main-radius'
:
3
,
'main-space'
:
5
,
'sub-color'
:
'black'
,
'sub-background'
:
'none'
,
'sub-selected-background'
:
'none'
,
'sub-stroke'
:
'none'
,
'sub-font-size'
:
12
,
'sub-padding'
:
[
5
,
10
],
'sub-margin'
:
[
15
,
20
],
'sub-tree-margin'
:
30
,
'sub-radius'
:
5
,
'sub-space'
:
5
,
'connect-color'
:
'#80bf82'
,
'connect-width'
:
2
,
'connect-radius'
:
5
,
'selected-stroke'
:
'#437152'
,
'selected-stroke-width'
:
'3'
,
'marquee-background'
:
'rgba(154,255,156,.1)'
,
'marquee-stroke'
:
'#73bf75'
,
'drop-hint-color'
:
'#437152'
,
'sub-drop-hint-width'
:
2
,
'main-drop-hint-width'
:
4
,
'root-drop-hint-width'
:
4
,
'order-hint-area-color'
:
'rgba(0, 255, 0, .5)'
,
'order-hint-path-color'
:
'#0f0'
,
'order-hint-path-width'
:
2
});
\ No newline at end of file
(
function
()
{
function
hsl
(
h
,
s
,
l
)
{
return
kity
.
Color
.
createHSL
(
h
,
s
,
l
);
}
function
generate
(
h
)
{
return
{
'background'
:
'#fefefe'
,
'root-color'
:
'white'
,
'root-background'
:
hsl
(
h
,
37
,
60
),
'root-stroke'
:
hsl
(
h
,
37
,
60
),
'root-font-size'
:
16
,
'root-padding'
:
[
12
,
24
],
'root-margin'
:
[
30
,
100
],
'root-radius'
:
5
,
'root-space'
:
10
,
'main-color'
:
'black'
,
'main-background'
:
hsl
(
h
,
33
,
95
),
'main-stroke'
:
hsl
(
h
,
37
,
60
),
'main-stroke-width'
:
1
,
'main-font-size'
:
16
,
'main-padding'
:
[
6
,
20
],
'main-margin'
:
20
,
'main-radius'
:
3
,
'main-space'
:
5
,
'sub-color'
:
'black'
,
'sub-background'
:
'none'
,
'sub-stroke'
:
'none'
,
'sub-font-size'
:
12
,
'sub-padding'
:
[
5
,
10
],
'sub-margin'
:
[
15
,
20
],
'sub-tree-margin'
:
30
,
'sub-radius'
:
5
,
'sub-space'
:
5
,
'connect-color'
:
hsl
(
h
,
37
,
60
),
'connect-width'
:
1
,
'connect-radius'
:
5
,
'selected-stroke'
:
hsl
(
h
,
26
,
30
),
'selected-stroke-width'
:
'3'
,
'marquee-background'
:
hsl
(
h
,
100
,
80
).
set
(
'a'
,
0.1
),
'marquee-stroke'
:
hsl
(
h
,
37
,
60
),
'drop-hint-color'
:
hsl
(
h
,
26
,
35
),
'drop-hint-width'
:
5
,
'order-hint-area-color'
:
hsl
(
h
,
100
,
95
).
set
(
'a'
,
0.5
),
'order-hint-path-color'
:
hsl
(
h
,
100
,
25
),
'order-hint-path-width'
:
1
};
}
var
plans
=
{
red
:
0
,
soil
:
25
,
green
:
122
,
blue
:
204
,
purple
:
246
,
pink
:
334
};
for
(
var
name
in
plans
)
{
KityMinder
.
registerTheme
(
'fresh-'
+
name
,
generate
(
plans
[
name
]));
}
})();
\ No newline at end of file
src/theme/snow.js
View file @
6ab996cf
...
...
@@ -2,25 +2,27 @@ KityMinder.registerTheme('snow', {
'root-color'
:
'#430'
,
'root-background'
:
'#e9df98'
,
'root-stroke'
:
'
none
'
,
'root-stroke'
:
'
#e9df98
'
,
'root-font-size'
:
24
,
'root-padding'
:
[
15
,
25
],
'root-margin'
:
30
,
'root-radius'
:
5
,
'root-space'
:
10
,
'root-shadow'
:
'rgba(0, 0, 0, .25)'
,
'main-color'
:
'#333'
,
'main-background'
:
'#a4c5c0'
,
'main-stroke'
:
'
none
'
,
'main-stroke'
:
'
#a4c5c0
'
,
'main-font-size'
:
16
,
'main-padding'
:
[
6
,
20
],
'main-margin'
:
[
20
,
40
],
'main-radius'
:
5
,
'main-space'
:
5
,
'main-shadow'
:
'rgba(0, 0, 0, .25)'
,
'sub-color'
:
'black'
,
'sub-background'
:
'white'
,
'sub-stroke'
:
'
non
e'
,
'sub-stroke'
:
'
whit
e'
,
'sub-font-size'
:
12
,
'sub-padding'
:
[
5
,
10
],
'sub-margin'
:
[
10
,
20
],
...
...
@@ -31,5 +33,18 @@ KityMinder.registerTheme('snow', {
'connect-width'
:
2
,
'connect-radius'
:
5
,
'selected-background'
:
'rgb(254, 219, 0)'
'selected-background'
:
'rgb(254, 219, 0)'
,
'selected-stroke'
:
'rgb(254, 219, 0)'
,
'marquee-background'
:
'rgba(255,255,255,.3)'
,
'marquee-stroke'
:
'white'
,
'drop-hint-color'
:
'yellow'
,
'sub-drop-hint-width'
:
2
,
'main-drop-hint-width'
:
4
,
'root-drop-hint-width'
:
4
,
'order-hint-area-color'
:
'rgba(0, 255, 0, .5)'
,
'order-hint-path-color'
:
'#0f0'
,
'order-hint-path-width'
:
1
});
\ No newline at end of file
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