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
38b96851
Commit
38b96851
authored
Jul 02, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
非常清晰的脑图
parent
51354b02
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
55 additions
and
30 deletions
+55
-30
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
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
+2
-2
snow.js
src/theme/snow.js
+19
-4
No files found.
src/core/layout.js
View file @
38b96851
...
...
@@ -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 @
38b96851
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 @
38b96851
...
...
@@ -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 @
38b96851
...
...
@@ -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/select.js
View file @
38b96851
...
...
@@ -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 @
38b96851
...
...
@@ -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 @
38b96851
...
...
@@ -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 @
38b96851
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 @
38b96851
...
...
@@ -9,7 +9,7 @@
'root-color'
:
'white'
,
'root-background'
:
hsl
(
h
,
37
,
60
),
'root-stroke'
:
'none'
,
'root-stroke'
:
hsl
(
h
,
37
,
60
)
,
'root-font-size'
:
16
,
'root-padding'
:
[
12
,
24
],
'root-margin'
:
[
30
,
100
],
...
...
@@ -52,7 +52,7 @@
'order-hint-area-color'
:
hsl
(
h
,
100
,
95
).
set
(
'a'
,
0.5
),
'order-hint-path-color'
:
hsl
(
h
,
100
,
25
),
'order-hint-path-width'
:
2
'order-hint-path-width'
:
1
};
}
...
...
src/theme/snow.js
View file @
38b96851
...
...
@@ -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