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
212a4e8c
Commit
212a4e8c
authored
Feb 13, 2014
by
campaign
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/kitygraph/kityminder
into dev
parents
8d134143
60a0ff9e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
15 deletions
+37
-15
kity
kity
+1
-1
minder.js
src/core/minder.js
+24
-3
keyboard.js
src/module/keyboard.js
+5
-4
layout.default.js
src/module/layout.default.js
+7
-7
No files found.
kity
@
97750df2
Subproject commit
1140e977283ecc038ea444dd1186eb77c59510fb
Subproject commit
97750df27bf46fbb96d182a25e39768f63f7545c
src/core/minder.js
View file @
212a4e8c
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
var
Minder
=
KityMinder
.
Minder
=
kity
.
createClass
(
"KityMinder"
,
{
var
Minder
=
KityMinder
.
Minder
=
kity
.
createClass
(
"KityMinder"
,
{
constructor
:
function
(
options
)
{
constructor
:
function
(
options
)
{
this
.
_options
=
Utils
.
extend
(
window
.
KITYMINDER_CONFIG
||
{},
options
);
this
.
_options
=
Utils
.
extend
(
window
.
KITYMINDER_CONFIG
||
{},
options
);
this
.
setDefaultOptions
(
KM
.
defaultOptions
);
this
.
setDefaultOptions
(
KM
.
defaultOptions
);
this
.
_initEvents
();
this
.
_initEvents
();
this
.
_initMinder
();
this
.
_initMinder
();
this
.
_initSelection
();
this
.
_initSelection
();
...
@@ -34,16 +34,37 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
...
@@ -34,16 +34,37 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
},
},
_initMinder
:
function
()
{
_initMinder
:
function
()
{
this
.
_rc
=
new
kity
.
Group
();
this
.
_paper
=
new
kity
.
Paper
();
this
.
_paper
=
new
kity
.
Paper
();
this
.
_paper
.
addShape
(
this
.
_rc
);
this
.
_paper
.
getNode
().
setAttribute
(
'contenteditable'
,
true
);
this
.
_paper
.
getNode
().
setAttribute
(
'contenteditable'
,
true
);
this
.
_addBackground
();
this
.
_addRenderContainer
();
this
.
_root
=
new
MinderNode
(
"Main Topic"
);
this
.
_root
=
new
MinderNode
(
"Main Topic"
);
this
.
_root
.
setType
(
"root"
);
this
.
_root
.
setType
(
"root"
);
if
(
this
.
_options
.
renderTo
)
{
if
(
this
.
_options
.
renderTo
)
{
this
.
renderTo
(
this
.
_options
.
renderTo
);
this
.
renderTo
(
this
.
_options
.
renderTo
);
}
}
},
},
_addRenderContainer
:
function
()
{
this
.
_rc
=
new
kity
.
Group
();
this
.
_paper
.
addShape
(
this
.
_rc
);
},
_addBackground
:
function
()
{
var
start
=
kity
.
Color
.
createHSL
(
200
,
8
,
40
);
var
end
=
start
.
dec
(
'l'
,
5
);
var
_paper
=
this
.
_paper
;
var
_bg
=
this
.
_background
=
new
kity
.
Ellipse
(
400
,
300
).
fill
(
new
kity
.
RadialGradientBrush
().
pipe
(
function
()
{
this
.
addStop
(
0
,
start
);
this
.
addStop
(
1
,
end
);
_paper
.
addResource
(
this
);
}
)
);
_paper
.
setStyle
(
'background'
,
end
.
toString
()
);
setTimeout
(
function
()
{
_bg
.
translate
(
_paper
.
getNode
().
clientWidth
/
2
,
_paper
.
getNode
().
clientHeight
/
2
);
},
100
);
_paper
.
addShape
(
this
.
_background
);
},
renderTo
:
function
(
target
)
{
renderTo
:
function
(
target
)
{
this
.
_paper
.
renderTo
(
this
.
_renderTarget
=
target
);
this
.
_paper
.
renderTo
(
this
.
_renderTarget
=
target
);
this
.
_bindEvents
();
this
.
_bindEvents
();
...
...
src/module/keyboard.js
View file @
212a4e8c
...
@@ -2,11 +2,12 @@ KityMinder.registerModule( "KeyboardModule", function () {
...
@@ -2,11 +2,12 @@ KityMinder.registerModule( "KeyboardModule", function () {
function
buildPositionNetwork
(
root
)
{
function
buildPositionNetwork
(
root
)
{
var
pointIndexes
=
[],
var
pointIndexes
=
[],
x
,
y
;
p
,
x
,
y
;
root
.
traverse
(
function
(
node
)
{
root
.
traverse
(
function
(
node
)
{
p
=
node
.
getData
(
'point'
);
pointIndexes
.
push
(
{
pointIndexes
.
push
(
{
x
:
node
.
getData
(
'x'
)
,
x
:
p
.
x
,
y
:
node
.
getData
(
'y'
)
,
y
:
p
.
y
,
node
:
node
node
:
node
}
);
}
);
}
);
}
);
...
@@ -50,7 +51,7 @@ KityMinder.registerModule( "KeyboardModule", function () {
...
@@ -50,7 +51,7 @@ KityMinder.registerModule( "KeyboardModule", function () {
function
navigateTo
(
km
,
direction
)
{
function
navigateTo
(
km
,
direction
)
{
var
nextNode
=
km
.
getSelectedNode
().
_nearestNodes
[
direction
];
var
nextNode
=
km
.
getSelectedNode
().
_nearestNodes
[
direction
];
if
(
nextNode
)
{
if
(
nextNode
)
{
km
.
select
(
nextNode
);
km
.
select
(
nextNode
,
true
);
}
}
}
}
return
{
return
{
...
...
src/module/layout.default.js
View file @
212a4e8c
...
@@ -72,13 +72,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -72,13 +72,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
//样式的配置(包括颜色、字号等)
//样式的配置(包括颜色、字号等)
var
nodeStyles
=
{
var
nodeStyles
=
{
"root"
:
{
"root"
:
{
color
:
"white"
,
color
:
kity
.
Color
.
createHSL
(
200
,
50
,
30
)
,
fill
:
"cadetblue"
,
fill
:
kity
.
Color
.
createHSL
(
200
,
30
,
80
)
,
fontSize
:
20
,
fontSize
:
20
,
padding
:
[
10.5
,
10
,
10.5
,
10
],
padding
:
[
10.5
,
10
.5
,
10.5
,
10.5
],
margin
:
[
0
,
0
,
0
,
0
],
margin
:
[
0
,
0
,
0
,
0
],
radius
:
15
,
radius
:
20
,
highlight
:
"
chocolate
"
highlight
:
"
lightgreen
"
},
},
"main"
:
{
"main"
:
{
stroke
:
new
kity
.
Pen
(
"white"
,
2
).
setLineCap
(
"round"
).
setLineJoin
(
"round"
),
stroke
:
new
kity
.
Pen
(
"white"
,
2
).
setLineCap
(
"round"
).
setLineJoin
(
"round"
),
...
@@ -88,7 +88,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -88,7 +88,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
fontSize
:
14
,
fontSize
:
14
,
margin
:
[
0
,
10
,
30
,
50
],
margin
:
[
0
,
10
,
30
,
50
],
radius
:
5
,
radius
:
5
,
highlight
:
"
chocolate
"
highlight
:
"
yellow
"
},
},
"sub"
:
{
"sub"
:
{
stroke
:
new
kity
.
Pen
(
"white"
,
2
).
setLineCap
(
"round"
).
setLineJoin
(
"round"
),
stroke
:
new
kity
.
Pen
(
"white"
,
2
).
setLineCap
(
"round"
).
setLineJoin
(
"round"
),
...
@@ -96,7 +96,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -96,7 +96,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
fontSize
:
12
,
fontSize
:
12
,
margin
:
[
0
,
10
,
20
,
6
],
margin
:
[
0
,
10
,
20
,
6
],
padding
:
[
5
,
10
,
5.5
,
10
],
padding
:
[
5
,
10
,
5.5
,
10
],
highlight
:
"chocolate"
highlight
:
kity
.
Color
.
createHSL
(
200
,
50
,
60
)
}
}
};
};
//更新背景
//更新背景
...
...
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