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
342ffba9
Commit
342ffba9
authored
Feb 13, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
by zhanyi
parent
68fb69e2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
3 deletions
+64
-3
minder.select.js
src/core/minder.select.js
+2
-2
node.js
src/core/node.js
+19
-0
history.js
src/module/history.js
+43
-1
No files found.
src/core/minder.select.js
View file @
342ffba9
// 选区管理
kity
.
extendClass
(
Minder
,
function
()
{
function
highlightNode
(
km
,
node
)
{
node
.
set
Data
(
"highlight"
,
true
);
node
.
set
Attr
(
"highlight"
,
true
);
km
.
highlightNode
(
node
);
}
function
unhighlightNode
(
km
,
node
)
{
node
.
set
Data
(
"highlight"
,
false
);
node
.
set
Attr
(
"highlight"
,
false
);
km
.
highlightNode
(
node
);
}
return
{
...
...
src/core/node.js
View file @
342ffba9
...
...
@@ -269,5 +269,24 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
},
clearChildren
:
function
()
{
this
.
children
=
[];
},
isHighlight
:
function
(){
return
this
.
getAttr
(
'highlight'
)
},
setAttr
:
function
(
a
,
v
){
var
me
=
this
;
if
(
utils
.
isObject
(
a
)){
utils
.
each
(
a
,
function
(
val
,
key
){
me
.
setAttr
(
key
,
val
)
})
}
if
(
v
===
undefined
||
v
===
null
||
v
===
''
){
this
.
node
.
removeAttribute
(
a
);
}
else
{
this
.
node
.
setAttribute
(
a
,
v
);
}
},
getAttr
:
function
(
a
){
return
this
.
node
.
getAttribute
(
a
)
}
}
);
\ No newline at end of file
src/module/history.js
View file @
342ffba9
KityMinder
.
registerModule
(
"HistoryModule"
,
function
()
{
var
km
=
this
;
var
Scene
=
kity
.
createClass
(
'Scene'
,
{
constructor
:
function
(
root
)
{
this
.
data
=
root
.
clone
();
...
...
@@ -51,8 +53,11 @@ KityMinder.registerModule( "HistoryModule", function () {
},
restore
:
function
()
{
var
scene
=
this
.
list
[
this
.
index
];
this
.
km
.
setRoot
(
scene
.
cloneData
()
);
this
.
km
.
removeAllSelectedNodes
();
this
.
km
.
initStyle
();
this
.
update
();
},
getScene
:
function
()
{
...
...
@@ -88,9 +93,18 @@ KityMinder.registerModule( "HistoryModule", function () {
//为km实例添加history管理
this
.
historyManager
=
new
HistoryManager
(
this
);
var
keys
=
{
// /*Backspace*/ 8:1, /*Delete*/ 46:1,
/*Shift*/
16
:
1
,
/*Ctrl*/
17
:
1
,
/*Alt*/
18
:
1
,
37
:
1
,
38
:
1
,
39
:
1
,
40
:
1
},
keycont
=
0
,
lastKeyCode
,
saveSceneTimer
;
return
{
defaultOptions
:
{
maxUndoCount
:
20
maxUndoCount
:
20
,
maxInputCount
:
20
},
"commands"
:
{
"undo"
:
kity
.
createClass
(
"UndoCommand"
,
{
...
...
@@ -130,6 +144,34 @@ KityMinder.registerModule( "HistoryModule", function () {
"events"
:
{
"saveScene"
:
function
(
e
)
{
this
.
historyManager
.
saveScene
();
},
"renderNode"
:
function
(
e
){
var
node
=
e
.
node
;
if
(
node
.
isHighlight
()){
km
.
select
(
node
);
}
},
"keydown"
:
function
(
e
){
// var orgEvt = e.originEvent;
// var keyCode = orgEvt.keyCode || orgEvt.which;
// if (!keys[keyCode] && !orgEvt.ctrlKey && !orgEvt.metaKey && !orgEvt.shiftKey && !orgEvt.altKey) {
//
//
// if (km.historyManager.list.length == 0) {
// km.historyManager.saveScene();
// }
// clearTimeout(saveSceneTimer);
//
// saveSceneTimer = setTimeout(function(){
// km.historyManager.saveScene();
// },200);
//
// lastKeyCode = keyCode;
// keycont++;
// if (keycont >= km.getOptions('maxInputCount') ) {
// km.historyManager.saveScene()
// }
// }
}
}
};
...
...
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