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
0034c01d
Commit
0034c01d
authored
Oct 11, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加节点收起功能
parent
0feacf5a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
8 deletions
+38
-8
zh-cn.js
lang/zh-cn/zh-cn.js
+3
-1
keymap.js
src/core/keymap.js
+9
-0
expand.js
src/module/expand.js
+15
-4
contextmenu.js
ui/contextmenu.js
+11
-3
No files found.
lang/zh-cn/zh-cn.js
View file @
0034c01d
...
...
@@ -137,7 +137,9 @@ KityMinder.LANG['zh-cn'] = {
'editnode'
:
'编辑'
,
'arrangeup'
:
'上移'
,
'arrangedown'
:
'下移'
,
'resetlayout'
:
'整理布局'
'resetlayout'
:
'整理布局'
,
'expandtoleave'
:
'展开全部节点'
,
'collapsetolevel1'
:
'收起到一级节点'
},
'back'
:
'返回'
,
...
...
src/core/keymap.js
View file @
0034c01d
...
...
@@ -9,9 +9,17 @@ var keymap = KityMinder.keymap = (function(origin) {
var
aKeyCode
=
65
;
var
aCharCode
=
'a'
.
charCodeAt
(
0
);
// letters
'abcdefghijklmnopqrstuvwxyz'
.
split
(
''
).
forEach
(
function
(
letter
)
{
ret
[
letter
]
=
aKeyCode
+
(
letter
.
charCodeAt
(
0
)
-
aCharCode
);
});
// numbers
var
n
=
9
;
do
{
ret
[
n
.
toString
()]
=
n
+
48
;
}
while
(
--
n
);
return
ret
;
})({
'Backspace'
:
8
,
...
...
@@ -65,6 +73,7 @@ var keymap = KityMinder.keymap = (function(origin) {
'F11'
:
121
,
'F12'
:
122
,
'`'
:
192
,
'='
:
187
,
'-'
:
189
,
...
...
src/module/expand.js
View file @
0034c01d
...
...
@@ -151,7 +151,7 @@ KityMinder.registerModule('Expand', function() {
});
},
queryState
:
function
(
km
)
{
return
0
;
return
!
km
.
getSelectedNode
()
?
0
:
-
1
;
}
});
var
CollapseNodeCommand
=
kity
.
createClass
(
'CollapseNodeCommand'
,
{
...
...
@@ -163,7 +163,7 @@ KityMinder.registerModule('Expand', function() {
});
},
queryState
:
function
(
km
)
{
return
0
;
return
!
km
.
getSelectedNode
()
?
0
:
-
1
;
}
});
var
Expander
=
kity
.
createClass
(
'Expander'
,
{
...
...
@@ -241,8 +241,8 @@ KityMinder.registerModule('Expand', function() {
});
return
{
commands
:
{
'
ExpandNod
e'
:
ExpandNodeCommand
,
'
CollapseNode
'
:
CollapseNodeCommand
'
expandtoleav
e'
:
ExpandNodeCommand
,
'
collapsetolevel1
'
:
CollapseNodeCommand
},
events
:
{
'layoutapply'
:
function
(
e
)
{
...
...
@@ -276,6 +276,17 @@ KityMinder.registerModule('Expand', function() {
},
renderers
:
{
outside
:
ExpanderRenderer
},
contextmenu
:
[{
command
:
'expandtoleave'
},
{
command
:
'collapsetolevel1'
},
{
divider
:
true
}],
commandShortcutKeys
:
{
'expandtoleave'
:
'Alt+`'
,
'collapsetolevel1'
:
'Alt+1'
}
};
});
\ No newline at end of file
ui/contextmenu.js
View file @
0034c01d
...
...
@@ -20,6 +20,13 @@ KityMinder.registerUI('contextmenu', function(minder) {
var
downPosition
;
function
distance
(
p1
,
p2
)
{
var
dx
=
p1
[
0
]
-
p2
[
0
];
var
dy
=
p1
[
1
]
-
p2
[
1
];
var
ds
=
Math
.
sqrt
(
dx
*
dx
+
dy
*
dy
);
return
ds
;
}
$menu
.
delegate
(
'li'
,
'mousedown'
,
function
(
e
,
info
)
{
var
item
=
$
(
e
.
target
).
closest
(
'li'
).
data
(
'menu'
);
if
(
item
.
command
)
{
...
...
@@ -34,7 +41,7 @@ KityMinder.registerUI('contextmenu', function(minder) {
$
(
'#content-wrapper'
).
on
(
'mousedown'
,
function
(
e
)
{
$menu
.
hide
();
if
(
e
.
button
==
2
)
{
downPosition
=
[
e
.
pageX
,
e
.
pageY
]
.
join
(
','
)
;
downPosition
=
[
e
.
pageX
,
e
.
pageY
];
}
else
{
downPosition
=
null
;
}
...
...
@@ -46,8 +53,9 @@ KityMinder.registerUI('contextmenu', function(minder) {
if
(
!
e
.
isRightMB
())
return
;
e
=
e
.
originEvent
;
if
(
downPosition
!=
[
e
.
pageX
,
e
.
pageY
].
join
(
','
))
return
;
var
d
=
distance
(
downPosition
,
[
e
.
pageX
,
e
.
pageY
]);
if
(
isNaN
(
d
)
||
d
>
5
)
return
;
$menu
.
empty
();
...
...
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