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
0b706bfa
Commit
0b706bfa
authored
Jun 27, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复undo/redo操作
parent
216d693f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
49 deletions
+9
-49
history.js
src/module/history.js
+9
-49
No files found.
src/module/history.js
View file @
0b706bfa
...
...
@@ -69,7 +69,9 @@ KityMinder.registerModule("HistoryModule", function() {
}
function
appendChildNode
(
parent
,
child
)
{
if
(
child
.
isSelected
())
{
selectedNodes
.
push
(
child
);
}
km
.
appendNode
(
child
,
parent
);
child
.
render
();
for
(
var
i
=
0
,
ci
;
ci
=
child
.
children
[
i
++
];)
{
...
...
@@ -81,9 +83,11 @@ KityMinder.registerModule("HistoryModule", function() {
if
(
compareNode
(
srcNode
,
tagNode
)
===
false
)
{
srcNode
.
setValue
(
tagNode
);
srcNode
.
render
();
if
(
srcNode
.
isSelected
())
{
selectedNodes
.
push
(
srcNode
);
}
}
for
(
var
i
=
0
,
j
=
0
,
si
,
tj
;
(
si
=
srcNode
.
children
[
i
],
tj
=
tagNode
.
children
[
j
],
si
||
tj
);
i
++
,
j
++
)
{
...
...
@@ -145,23 +149,7 @@ KityMinder.registerModule("HistoryModule", function() {
//为km实例添加history管理
this
.
historyManager
=
new
HistoryManager
(
this
);
var
keys
=
{
/*Shift*/
16
:
1
,
/*Ctrl*/
17
:
1
,
/*Alt*/
18
:
1
,
/*Command*/
91
:
1
,
37
:
1
,
38
:
1
,
39
:
1
,
40
:
1
},
keycont
=
0
,
lastKeyCode
,
saveSceneTimer
;
return
{
defaultOptions
:
{
maxUndoCount
:
20
,
...
...
@@ -172,7 +160,7 @@ KityMinder.registerModule("HistoryModule", function() {
base
:
Command
,
execute
:
function
(
km
)
{
km
.
historyManager
.
undo
()
km
.
historyManager
.
undo
()
;
},
queryState
:
function
(
km
)
{
...
...
@@ -187,7 +175,7 @@ KityMinder.registerModule("HistoryModule", function() {
base
:
Command
,
execute
:
function
(
km
)
{
km
.
historyManager
.
redo
()
km
.
historyManager
.
redo
()
;
},
queryState
:
function
(
km
)
{
...
...
@@ -206,36 +194,8 @@ KityMinder.registerModule("HistoryModule", function() {
"saveScene"
:
function
(
e
)
{
this
.
historyManager
.
saveScene
();
},
'renderNode'
:
function
(
e
)
{
var
node
=
e
.
node
;
if
(
node
.
isSelected
())
{
this
.
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()
// }
// }
// },
"import"
:
function
()
{
this
.
historyManager
.
reset
()
this
.
historyManager
.
reset
()
;
}
}
};
...
...
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