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
4735257a
Commit
4735257a
authored
May 05, 2014
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/fex-team/kityminder
into dev
parents
d9aca907
af830a57
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
235 additions
and
61 deletions
+235
-61
CHANGELOG.md
CHANGELOG.md
+9
-2
preference.js
dialogs/preference/preference.js
+33
-0
import.js
import.js
+2
-0
kityminder.config.js
kityminder.config.js
+10
-3
zh-cn.js
lang/zh-cn/zh-cn.js
+4
-2
social.js
social/social.js
+1
-1
dialog.js
src/adapter/dialog.js
+1
-1
node.js
src/adapter/node.js
+2
-1
preference.js
src/adapter/preference.js
+6
-0
keymap.js
src/core/keymap.js
+28
-24
kityminder.js
src/core/kityminder.js
+1
-1
minder.js
src/core/minder.js
+5
-2
dragtree.js
src/module/dragtree.js
+10
-3
editor.js
src/module/editor.js
+7
-5
editor.receiver.js
src/module/editor.receiver.js
+7
-2
icon.js
src/module/icon.js
+4
-2
keyboard.js
src/module/keyboard.js
+4
-0
layout.default.js
src/module/layout.default.js
+49
-11
layout.js
src/module/layout.js
+47
-0
nodetext.js
src/module/nodetext.js
+2
-1
buttonicon.css
themes/default/css/buttonicon.css
+3
-0
setting.png
themes/default/images/setting.png
+0
-0
No files found.
CHANGELOG.md
View file @
4735257a
# KityMinder 更新日志
##1.
2.0
##1.
1.3
###功能更新
1.
添加保存时可修改文件名
2.
添加超链接
3.
优化了当输入中文时,中文显示位置与光标距离过远的问题
3.
优化了当输入中文时,中文显示位置与光标距离过远的问题
4.
###问题修复
1.
修复当滚动鼠标滚轮时,光标不跟着移动的问题
2.
优化了拖拽节点操作体验
## v1.1.3
### 功能更新
### 问题修复
1.
优化加载速度、拖拽速度
## v1.1.2
...
...
dialogs/preference/preference.js
0 → 100644
View file @
4735257a
(
function
()
{
var
preferenceContent
=
'<div class="help-content" style="padding:20px;width:360px;">'
;
preferenceContent
+=
'<h3>展开属性设置</h3>'
;
preferenceContent
+=
'<p><label><input type="radio" name="expand" checked value="all"/>全部展开</label><label><input type="radio" name="expand" value="limit"/>局部展开</label></p>'
;
preferenceContent
+=
'</div>'
;
KM
.
registerWidget
(
'preference'
,
{
tpl
:
preferenceContent
,
initContent
:
function
(
km
)
{
var
lang
=
km
.
getLang
(
'dialogs.help'
),
html
;
if
(
lang
)
{
html
=
$
.
parseTmpl
(
this
.
tpl
,
lang
);
}
this
.
root
().
html
(
html
);
},
initEvent
:
function
(
km
,
$w
)
{
$w
.
on
(
'click'
,
'.kmui-close'
,
function
(
e
)
{
//写cookies
var
setCookie
=
function
(
name
,
value
,
exp
)
{
document
.
cookie
=
name
+
"="
+
escape
(
value
)
+
";expires="
+
exp
.
toGMTString
();
}
var
expand
=
$
(
"input[type='radio'][name='expand']:checked"
).
val
();
var
Days
=
30
;
var
exp
=
new
Date
();
exp
.
setTime
(
exp
.
getTime
()
+
Days
*
24
*
60
*
60
*
1000
);
setCookie
(
'expand'
,
expand
,
exp
);
console
.
log
(
document
.
cookie
);
}
);
},
width
:
400
}
);
}
)();
\ No newline at end of file
import.js
View file @
4735257a
...
...
@@ -70,6 +70,7 @@
,
'adapter/node.js'
,
'adapter/contextmenu.js'
,
'adapter/dialog.js'
,
'adapter/preference.js'
,
'protocal/xmind.js'
,
'protocal/freemind.js'
,
'protocal/mindmanager.js'
...
...
@@ -77,6 +78,7 @@
,
'protocal/json.js'
,
'protocal/png.js'
,
'protocal/svg.js'
),
baseURL
=
'src/'
;
for
(
var
i
=
0
,
pi
;
pi
=
paths
[
i
++
];)
{
...
...
kityminder.config.js
View file @
4735257a
...
...
@@ -60,10 +60,10 @@
}
window
.
KITYMINDER_CONFIG
=
{
'KITYMINDER_HOME_URL'
:
getKMBasePath
()
'KITYMINDER_HOME_URL'
:
getKMBasePath
()
,
//定义工具栏
,
toolbars
:
[
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers | node | help'
toolbars
:
[
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers | node |
preference |
help'
]
//只读模式,默认是false
//readOnly: true
...
...
@@ -80,5 +80,12 @@
//设置km整体的z-index大小
//,zIndex : 1000
//设置初始加载时展开的层数和子节点数目阈值
//默认是全部展开,0表示全部展开
,
defaultExpand
:
{
defaultLayer
:
2
,
defaultSubShow
:
5
}
};
}
)();
\ No newline at end of file
lang/zh-cn/zh-cn.js
View file @
4735257a
...
...
@@ -17,7 +17,8 @@ KityMinder.LANG[ 'zh-cn' ] = {
'zoom-out'
:
'缩小'
,
'markers'
:
'添加标签'
,
'switchlayout'
:
'切换主题'
,
'help'
:
'帮助'
'help'
:
'帮助'
,
'preference'
:
'偏好设置'
},
'popupcolor'
:
{
'clearColor'
:
'清空颜色'
,
...
...
@@ -48,7 +49,8 @@ KityMinder.LANG[ 'zh-cn' ] = {
'node'
:
{
'appendsiblingnode'
:
'插入同级节点'
,
'appendchildnode'
:
'插入子节点'
,
'removenode'
:
'删除节点'
'removenode'
:
'删除节点'
,
'editnode'
:
'编辑节点'
},
'layout'
:
{
'default'
:
'左右展开'
,
...
...
social/social.js
View file @
4735257a
...
...
@@ -449,7 +449,7 @@ $( function () {
// 从路径中抽取文件名
function
getFileName
(
path
)
{
var
filename
=
path
.
substr
(
path
.
lastIndexOf
(
'/'
)
+
1
);
return
filename
.
substr
(
0
,
filename
.
lastIndexOf
(
'.'
)
);
return
filename
//
.substr( 0, filename.lastIndexOf( '.' ) );
}
// 点击文件菜单
...
...
src/adapter/dialog.js
View file @
4735257a
KM
.
registerToolbarUI
(
'markers help'
,
function
(
name
)
{
KM
.
registerToolbarUI
(
'markers help
preference
'
,
function
(
name
)
{
var
me
=
this
,
currentRange
,
$dialog
,
...
...
src/adapter/node.js
View file @
4735257a
...
...
@@ -2,7 +2,8 @@ KM.registerToolbarUI( 'node', function ( name ) {
var
shortcutKeys
=
{
"appendsiblingnode"
:
"enter"
,
"appendchildnode"
:
"tab"
,
"removenode"
:
"del|backspace"
"removenode"
:
"del|backspace"
,
"editnode"
:
"F2"
};
var
me
=
this
,
...
...
src/adapter/preference.js
0 → 100644
View file @
4735257a
KM
.
registerUI
(
'preference'
,
function
(
name
)
{
var
km
=
this
;
//读取偏好设置,设置参数
}
);
\ No newline at end of file
src/core/keymap.js
View file @
4735257a
...
...
@@ -3,41 +3,45 @@ var keymap = KityMinder.keymap = {
'Tab'
:
9
,
'Enter'
:
13
,
'Shift'
:
16
,
'Control'
:
17
,
'Alt'
:
18
,
'CapsLock'
:
20
,
'Shift'
:
16
,
'Control'
:
17
,
'Alt'
:
18
,
'CapsLock'
:
20
,
'Esc'
:
27
,
'Esc'
:
27
,
'Spacebar'
:
32
,
'Spacebar'
:
32
,
'PageUp'
:
33
,
'PageDown'
:
34
,
'End'
:
35
,
'Home'
:
36
,
'PageUp'
:
33
,
'PageDown'
:
34
,
'End'
:
35
,
'Home'
:
36
,
'Left'
:
37
,
'Up'
:
38
,
'Right'
:
39
,
'Down'
:
40
,
'Left'
:
37
,
'Up'
:
38
,
'Right'
:
39
,
'Down'
:
40
,
'Insert'
:
45
,
'Insert'
:
45
,
'Del'
:
46
,
'Del'
:
46
,
'NumLock'
:
144
,
'NumLock'
:
144
,
'Cmd'
:
91
,
'Cmd'
:
91
,
'='
:
187
,
'-'
:
189
,
'F2'
:
113
,
'F3'
:
114
,
'F4'
:
115
,
"b"
:
66
,
'i'
:
73
,
'='
:
187
,
'-'
:
189
,
"b"
:
66
,
'i'
:
73
,
//回退
'z'
:
90
,
'y'
:
89
,
'z'
:
90
,
'y'
:
89
,
//粘贴
'v'
:
86
,
'x'
:
88
,
...
...
src/core/kityminder.js
View file @
4735257a
var
KityMinder
=
window
.
KM
=
window
.
KityMinder
=
function
()
{
var
instanceMap
=
{},
instanceId
=
0
;
return
{
version
:
'1.
2.0
'
,
version
:
'1.
1.3
'
,
createMinder
:
function
(
renderTarget
,
options
)
{
options
=
options
||
{};
options
.
renderTo
=
Utils
.
isString
(
renderTarget
)
?
document
.
getElementById
(
renderTarget
)
:
renderTarget
;
...
...
src/core/minder.js
View file @
4735257a
...
...
@@ -18,14 +18,17 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
getOptions
:
function
(
key
)
{
return
this
.
_options
[
key
];
},
setDefaultOptions
:
function
(
key
,
val
)
{
setDefaultOptions
:
function
(
key
,
val
,
cover
)
{
var
obj
=
{};
if
(
Utils
.
isString
(
key
)
)
{
obj
[
key
]
=
val
;
}
else
{
obj
=
key
;
}
utils
.
extend
(
this
.
_options
,
obj
,
true
);
utils
.
extend
(
this
.
_options
,
obj
,
!
cover
);
},
setOptions
:
function
(
key
,
val
)
{
this
.
setDefaultOptions
(
key
,
val
,
true
)
},
_initMinder
:
function
()
{
...
...
src/module/dragtree.js
View file @
4735257a
...
...
@@ -21,11 +21,10 @@ var MoveToParentCommand = kity.createClass( 'MoveToParentCommand', {
for
(
var
i
=
nodes
.
length
-
1
;
i
>=
0
;
i
--
)
{
node
=
nodes
[
i
];
if
(
node
.
getParent
()
)
{
node
.
getParent
().
removeChild
(
node
);
parent
.
appendChild
(
node
);
minder
.
removeNode
(
[
node
]
);
minder
.
appendChildNode
(
parent
,
node
);
}
}
minder
.
initStyle
(
minder
.
getRoot
()
);
minder
.
select
(
nodes
,
true
);
}
}
);
...
...
@@ -128,6 +127,7 @@ var DragBox = kity.createClass( "DragBox", {
this
.
remove
();
this
.
_dragMode
=
false
;
this
.
_dropSucceedTarget
=
null
;
this
.
_removeDropHint
();
},
_drawForDragMode
:
function
()
{
this
.
_text
.
setContent
(
this
.
_dragSources
.
length
+
' items'
);
...
...
@@ -192,6 +192,13 @@ var DragBox = kity.createClass( "DragBox", {
this
.
_lastSucceedTarget
=
target
;
},
_removeDropHint
:
function
()
{
var
lastTarget
=
this
.
_lastSucceedTarget
;
if
(
lastTarget
)
{
this
.
_removeDropStyle
(
lastTarget
);
}
},
_removeDropStyle
:
function
(
node
)
{
node
.
_layout
.
bgRect
.
stroke
(
'none'
);
this
.
_rect
.
stroke
(
'#3399ff'
,
1
);
...
...
src/module/editor.js
View file @
4735257a
...
...
@@ -97,7 +97,8 @@ KityMinder.registerModule( "TextEditModule", function () {
var
offset
=
e
.
getPosition
();
if
(
Math
.
abs
(
offset
.
y
-
lastEvtPosition
.
y
)
>
2
&&
Math
.
abs
(
lastEvtPosition
.
x
-
offset
.
x
)
<
1
){
if
(
Math
.
abs
(
offset
.
y
-
lastEvtPosition
.
y
)
>=
1
&&
Math
.
abs
(
lastEvtPosition
.
x
-
offset
.
x
)
<=
1
){
sel
.
setHide
();
mouseDownStatus
=
false
;
return
;
...
...
@@ -134,12 +135,13 @@ KityMinder.registerModule( "TextEditModule", function () {
"resize"
:
function
(
e
)
{
sel
.
setHide
();
},
'execCommand'
:
function
(
e
)
{
"execCommand"
:
function
(
e
)
{
var
cmds
=
{
'appendchildnode'
:
1
,
'appendsiblingnode'
:
1
'appendchildnode'
:
1
,
'appendsiblingnode'
:
1
,
'editnode'
:
1
};
if
(
cmds
[
e
.
commandName
]
){
if
(
cmds
[
e
.
commandName
]
){
var
node
=
km
.
getSelectedNode
();
if
(
!
node
){
...
...
src/module/editor.receiver.js
View file @
4735257a
...
...
@@ -175,6 +175,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
switch
(
keyCode
)
{
case
keymap
.
Enter
:
case
keymap
.
Tab
:
case
keymap
.
F2
:
if
(
this
.
keydownNode
===
this
.
minderNode
)
{
this
.
rollbackStatus
();
this
.
setTextEditStatus
(
false
);
...
...
@@ -226,8 +227,12 @@ Minder.Receiver = kity.createClass( 'Receiver', {
}
return
this
;
},
getBaseOffset
:
function
(
node
)
{
getBaseOffset
:
function
(
)
{
var
rb
=
this
.
textShape
.
getRenderBox
(
this
.
km
.
getRenderContainer
()
);
// if(!this.pr) {
// this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green'));
// }
// this.pr.setSize(rb.width, rb.height).setPosition(rb.x, rb.y);
return
rb
;
},
setBaseOffset
:
function
()
{
...
...
@@ -235,7 +240,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
return
this
;
},
setContainerStyle
:
function
()
{
var
textShapeBox
=
this
.
getBaseOffset
(
'top'
);
var
textShapeBox
=
this
.
getBaseOffset
();
this
.
container
.
style
.
cssText
=
";left:"
+
textShapeBox
.
x
+
'px;top:'
+
(
textShapeBox
.
y
-
5
)
+
'px;width:'
+
textShapeBox
.
width
+
'px;height:'
+
textShapeBox
.
height
+
'px;'
;
return
this
;
...
...
src/module/icon.js
View file @
4735257a
KityMinder
.
registerModule
(
"IconModule"
,
function
()
{
var
minder
=
this
;
var
renderPriorityIcon
=
function
(
node
,
val
)
{
var
colors
=
[
""
,
"#A92E24"
,
"#29A6BD"
,
"#1E8D54"
,
"#eb6100"
,
"#876DDA"
];
var
_bg
=
new
kity
.
Rect
().
fill
(
colors
[
val
]
).
setRadius
(
3
).
setWidth
(
20
).
setHeight
(
20
);
...
...
@@ -45,8 +46,9 @@ KityMinder.registerModule( "IconModule", function () {
if
(
val
<
5
)
d
.
close
();
_percent
.
fill
(
"#29A6BD"
);
var
pre
=
node
.
getData
(
"PriorityIcon"
);
if
(
!
pre
)
_rc
.
setTranslate
(
_contRc
.
getWidth
()
-
_rc
.
getWidth
()
/
2
,
0
);
else
_rc
.
setTranslate
(
_contRc
.
getWidth
()
+
_rc
.
getWidth
()
/
2
,
0
);
var
style
=
minder
.
getCurrentLayoutStyle
()[
node
.
getType
()
];
if
(
!
pre
)
_rc
.
setTranslate
(
_rc
.
getWidth
()
/
2
,
0
);
else
_rc
.
setTranslate
(
_contRc
.
getWidth
()
+
style
.
spaceLeft
,
0
);
};
var
setPriorityCommand
=
kity
.
createClass
(
"SetPriorityCommand"
,
(
function
()
{
return
{
...
...
src/module/keyboard.js
View file @
4735257a
...
...
@@ -146,6 +146,10 @@ KityMinder.registerModule( "KeyboardModule", function () {
e
.
preventDefault
();
if
(
this
.
queryCommandState
(
'removenode'
)
!==
-
1
)
this
.
execCommand
(
'removenode'
);
break
;
case
keys
.
F2
:
e
.
preventDefault
();
if
(
this
.
queryCommandState
(
'editnode'
)
!==
-
1
)
this
.
execCommand
(
'editnode'
);
break
;
case
keys
.
Left
:
navigateTo
(
this
,
'left'
);
...
...
src/module/layout.default.js
View file @
4735257a
...
...
@@ -33,7 +33,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
minder
.
getRenderContainer
().
addShape
(
iconShape
);
iconShape
.
addShapes
(
[
circle
,
plus
,
dec
]
);
this
.
update
();
//this.switchState();
},
switchState
:
function
()
{
if
(
!
this
.
_show
)
{
...
...
@@ -84,7 +83,11 @@ KityMinder.registerModule( "LayoutDefault", function () {
padding
:
[
15.5
,
25.5
,
15.5
,
25.5
],
margin
:
[
0
,
0
,
0
,
0
],
radius
:
30
,
highlight
:
'rgb(254, 219, 0)'
highlight
:
'rgb(254, 219, 0)'
,
spaceLeft
:
3
,
spaceRight
:
0
,
spaceTop
:
3
,
spaceBottom
:
3
},
"main"
:
{
stroke
:
new
kity
.
Pen
(
"white"
,
2
).
setLineCap
(
"round"
).
setLineJoin
(
"round"
),
...
...
@@ -94,7 +97,12 @@ KityMinder.registerModule( "LayoutDefault", function () {
fontSize
:
16
,
margin
:
[
0
,
10
,
30
,
50
],
radius
:
10
,
highlight
:
'rgb(254, 219, 0)'
highlight
:
'rgb(254, 219, 0)'
,
spaceLeft
:
5
,
spaceRight
:
0
,
spaceTop
:
2
,
spaceBottom
:
2
},
"sub"
:
{
stroke
:
new
kity
.
Pen
(
"white"
,
2
).
setLineCap
(
"round"
).
setLineJoin
(
"round"
),
...
...
@@ -102,7 +110,11 @@ KityMinder.registerModule( "LayoutDefault", function () {
fontSize
:
12
,
margin
:
[
0
,
10
,
20
,
6
],
padding
:
[
5
,
10
,
5.5
,
10
],
highlight
:
'rgb(254, 219, 0)'
highlight
:
'rgb(254, 219, 0)'
,
spaceLeft
:
4
,
spaceRight
:
0
,
spaceTop
:
2
,
spaceBottom
:
2
}
};
//更新背景
...
...
@@ -392,7 +404,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
.
clear
()
.
moveTo
(
sX
,
sY
)
.
lineTo
(
sX
,
nodeY
>
sY
?
(
nodeY
-
nodeStyle
.
margin
[
3
]
)
:
(
nodeY
+
nodeStyle
.
margin
[
3
]
)
);
if
(
nodeY
>
sY
)
connect
.
getDrawer
().
carcTo
(
nodeStyle
.
margin
[
3
],
0
,
1
,
nodeX
,
nodeY
,
0
,
1
);
if
(
nodeY
>
sY
)
connect
.
getDrawer
().
carcTo
(
nodeStyle
.
margin
[
3
],
0
,
1
,
nodeX
,
nodeY
);
else
connect
.
getDrawer
().
carcTo
(
nodeStyle
.
margin
[
3
],
0
,
0
,
nodeX
,
nodeY
);
connect
.
stroke
(
nodeStyle
.
stroke
);
}
else
{
...
...
@@ -430,7 +442,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
dx
=
offset
.
x
<
0
?
-
offset
.
x
:
Math
.
min
(
tmpX
,
0
);
var
dy
=
offset
.
y
<
0
?
-
offset
.
y
:
Math
.
min
(
tmpY
,
0
);
km
.
getRenderContainer
().
fxTranslate
(
dx
,
dy
,
100
,
"easeOutQuint"
);
minder
.
getRenderContainer
().
fxTranslate
(
dx
,
dy
,
100
,
"easeOutQuint"
);
};
var
_style
=
{
...
...
@@ -524,20 +536,46 @@ KityMinder.registerModule( "LayoutDefault", function () {
updateLayoutVertical
(
_root
);
translateNode
(
_root
);
if
(
historyPoint
)
_root
.
setPoint
(
historyPoint
.
x
,
historyPoint
.
y
);
var
expandoptions
=
minder
.
getOptions
(
'defaultExpand'
);
var
cur_layer
=
0
;
var
expand_layer
=
expandoptions
.
defaultLayer
;
var
mains
=
_root
.
getChildren
();
for
(
var
i
=
0
;
i
<
mains
.
length
;
i
++
)
{
this
.
appendChildNode
(
_root
,
mains
[
i
]
);
}
for
(
var
j
=
0
;
j
<
mains
.
length
;
j
++
)
{
var
c
=
mains
[
j
].
getChildren
();
if
(
c
.
length
<
10
&&
c
.
length
!==
0
)
{
this
.
expandNode
(
mains
[
j
]
);
cur_layer
++
;
//创建一级节点的副本
var
_buffer
=
(
function
()
{
var
items
=
[];
for
(
var
i
=
0
;
i
<
mains
.
length
;
i
++
)
{
items
.
push
(
mains
[
i
]
);
}
return
items
;
}
)();
next
=
[];
var
layer_nolimit
=
(
expand_layer
<
1
)
||
false
;
var
sub_nolimit
=
(
expandoptions
.
defaultSubShow
<
1
)
||
false
;
var
loopcontinue
=
function
()
{
return
(
layer_nolimit
?
(
_buffer
.
length
!==
0
)
:
(
_buffer
.
length
!==
0
&&
cur_layer
<
expand_layer
)
);
};
while
(
loopcontinue
()
)
{
cur_layer
++
;
var
layer_len
=
_buffer
.
length
;
for
(
var
j
=
0
;
j
<
layer_len
;
j
++
)
{
var
c
=
_buffer
[
j
].
getChildren
();
if
(
(
sub_nolimit
||
(
c
.
length
<=
expandoptions
.
defaultSubShow
)
)
&&
c
.
length
!==
0
)
{
this
.
expandNode
(
_buffer
[
j
]
);
_buffer
=
_buffer
.
concat
(
_buffer
[
j
].
getChildren
()
);
}
}
_buffer
.
splice
(
0
,
layer_len
);
}
_root
.
setPoint
(
_root
.
getLayout
().
x
,
_root
.
getLayout
().
y
);
},
appendChildNode
:
function
(
parent
,
node
,
focus
,
sibling
)
{
if
(
parent
.
getType
()
!==
"root"
&&
parent
.
getChildren
().
length
!==
0
&&
parent
.
getData
(
"expand"
)
===
false
)
{
minder
.
expandNode
(
parent
);
}
minder
.
handelNodeInsert
(
node
);
node
.
clearLayout
();
node
.
getContRc
().
clear
();
...
...
src/module/layout.js
View file @
4735257a
...
...
@@ -195,18 +195,54 @@ KityMinder.registerModule( "LayoutModule", function () {
}
};
}
)()
);
var
EditNodeCommand
=
kity
.
createClass
(
"EditNodeCommand"
,
(
function
()
{
return
{
base
:
Command
,
execute
:
function
(
km
)
{
var
selectedNode
=
km
.
getSelectedNode
();
if
(
!
selectedNode
)
{
return
null
;
}
km
.
select
(
selectedNode
,
true
);
},
queryState
:
function
(
km
)
{
var
selectedNode
=
km
.
getSelectedNode
();
if
(
!
selectedNode
)
{
return
-
1
;
}
else
{
return
0
;
}
}
};
}
)()
);
return
{
"commands"
:
{
"appendchildnode"
:
AppendChildNodeCommand
,
"appendsiblingnode"
:
AppendSiblingNodeCommand
,
"removenode"
:
RemoveNodeCommand
,
"editnode"
:
EditNodeCommand
,
"switchlayout"
:
SwitchLayoutCommand
},
"events"
:
{
"ready"
:
function
()
{
this
.
setDefaultOptions
(
'layoutstyle'
,
this
.
getLayoutStyleItems
()
);
switchLayout
(
this
,
this
.
getOptions
(
'defaultlayoutstyle'
)
);
//读取cookies
var
getCookie
=
function
(
name
)
{
var
arr
,
reg
=
new
RegExp
(
"(^| )"
+
name
+
"=([^;]*)(;|$)"
);
if
(
arr
=
document
.
cookie
.
match
(
reg
)
)
return
unescape
(
arr
[
2
]
);
else
return
null
;
}
var
expand
=
getCookie
(
'expand'
);
if
(
expand
)
{
if
(
expand
===
'all'
)
{
this
.
setOptions
(
'defaultExpand'
,
{
'defaultLayer'
:
0
,
'defaultSubShow'
:
0
}
);
}
}
},
"click"
:
function
(
e
)
{
var
ico
=
e
.
kityEvent
.
targetShape
&&
e
.
kityEvent
.
targetShape
.
container
;
...
...
@@ -236,6 +272,12 @@ KityMinder.registerModule( "LayoutModule", function () {
this
.
execCommand
(
'appendchildnode'
,
new
MinderNode
(
this
.
getLang
(
'topic'
)
)
)
},
cmdName
:
'appendchildnode'
},
{
label
:
this
.
getLang
(
'node.editnode'
),
exec
:
function
()
{
this
.
execCommand
(
'editnode'
,
null
);
},
cmdName
:
'editnode'
},
{
label
:
this
.
getLang
(
'node.removenode'
),
cmdName
:
'removenode'
...
...
@@ -249,7 +291,12 @@ KityMinder.registerModule( "LayoutModule", function () {
"node"
:
{
'appendsiblingnode'
:
'appendsiblingnode'
,
'appendchildnode'
:
'appendchildnode'
,
'editnode'
:
'editnode'
,
'removenode'
:
'removenode'
},
'defaultExpand'
:
{
'defaultLayer'
:
0
,
'defaultSubShow'
:
0
}
}
};
...
...
src/module/nodetext.js
View file @
4735257a
...
...
@@ -9,7 +9,8 @@ KityMinder.registerModule( "NodeText", function () {
node
.
getContRc
().
appendShape
(
textShape
);
var
style
=
this
.
getCurrentLayoutStyle
()[
node
.
getType
()
];
textShape
.
fill
(
style
.
color
).
setSize
(
style
.
fontSize
);
textShape
.
setPosition
(
width
,
textShape
.
getHeight
()
*
.
25
)
textShape
.
setTranslate
(
width
+
style
.
spaceLeft
,
0
);
textShape
.
setVerticalAlign
(
'middle'
);
}
}
}
...
...
themes/default/css/buttonicon.css
View file @
4735257a
...
...
@@ -32,3 +32,6 @@
.kmui-btn-toolbar
.kmui-btn
.kmui-icon-help
{
background
:
url(../images/help.png)
no-repeat
2px
2px
;
}
.kmui-btn-toolbar
.kmui-btn
.kmui-icon-preference
{
background
:
url(../images/setting.png)
no-repeat
2px
2px
;
}
\ No newline at end of file
themes/default/images/setting.png
0 → 100644
View file @
4735257a
1 KB
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