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
211403ac
Commit
211403ac
authored
Apr 23, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolved code error
parent
02961137
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
227 additions
and
220 deletions
+227
-220
Gruntfile.js
Gruntfile.js
+11
-13
saveto.js
src/adapter/saveto.js
+1
-1
editor.receiver.js
src/module/editor.receiver.js
+175
-177
history.js
src/module/history.js
+28
-17
layout.default.js
src/module/layout.default.js
+9
-9
layout.js
src/module/layout.js
+3
-3
No files found.
Gruntfile.js
View file @
211403ac
...
@@ -61,31 +61,29 @@ module.exports = function ( grunt ) {
...
@@ -61,31 +61,29 @@ module.exports = function ( grunt ) {
options
:
{
options
:
{
banner
:
banner
banner
:
banner
},
},
files
:
(
function
()
{
files
:
(
function
()
{
var
files
=
{};
var
files
=
{};
files
[
distPath
+
'kityminder.all.js'
]
=
distPath
+
'kityminder.all.min.js'
;
files
[
distPath
+
'kityminder.all.js'
]
=
distPath
+
'kityminder.all.min.js'
;
return
files
;
return
files
;
})()
}
)()
}
}
},
},
copy
:
{
copy
:
{
dir
:
{
dir
:
{
files
:
[
files
:
[
{
{
src
:
[
'dialogs/**'
,
'lang/**'
,
'lib/**'
,
'social/**'
,
'themes/**'
],
src
:
[
'dialogs/**'
,
'lang/**'
,
'lib/**'
,
'social/**'
,
'themes/**'
],
dest
:
distPath
dest
:
distPath
}
]
}
]
}
}
},
},
replace
:
{
replace
:
{
online
:
{
online
:
{
src
:
distPath
+
'index.html'
,
src
:
distPath
+
'index.html'
,
overwrite
:
true
,
overwrite
:
true
,
replacements
:
[
{
replacements
:
[
{
from
:
/1234567890/ig
,
from
:
/1234567890/ig
,
to
:
'1234567890'
to
:
'1234567890'
}]
}
]
}
}
},
},
...
@@ -123,8 +121,8 @@ module.exports = function ( grunt ) {
...
@@ -123,8 +121,8 @@ module.exports = function ( grunt ) {
/* [Build plugin & task ] ------------------------------------*/
/* [Build plugin & task ] ------------------------------------*/
grunt
.
loadNpmTasks
(
'grunt-contrib-concat'
);
grunt
.
loadNpmTasks
(
'grunt-contrib-concat'
);
grunt
.
loadNpmTasks
(
'grunt-contrib-uglify'
);
grunt
.
loadNpmTasks
(
'grunt-contrib-uglify'
);
grunt
.
loadNpmTasks
(
'grunt-contrib-copy'
);
grunt
.
loadNpmTasks
(
'grunt-contrib-copy'
);
grunt
.
loadNpmTasks
(
'grunt-text-replace'
);
grunt
.
loadNpmTasks
(
'grunt-text-replace'
);
// Build task(s).
// Build task(s).
grunt
.
registerTask
(
'default'
,
[
'concat'
,
'uglify'
,
'copy'
,
'replace'
]
);
grunt
.
registerTask
(
'default'
,
[
'concat'
,
'uglify'
,
'copy'
,
'replace'
]
);
...
...
src/adapter/saveto.js
View file @
211403ac
...
@@ -70,7 +70,7 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
...
@@ -70,7 +70,7 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
if
(
typeof
(
data
)
==
'string'
)
{
if
(
typeof
(
data
)
==
'string'
)
{
var
url
=
'data:text/plain; utf-8,'
+
encodeURIComponent
(
data
);
var
url
=
'data:text/plain; utf-8,'
+
encodeURIComponent
(
data
);
if
(
ie_ver
()
>
0
)
{
if
(
ie_ver
()
>
0
)
{
console
.
log
(
p
.
fileExtension
);
//
console.log( p.fileExtension );
if
(
p
.
fileExtension
===
'.km'
)
{
if
(
p
.
fileExtension
===
'.km'
)
{
doSave
(
'application/x-javascript'
,
data
,
me
.
getMinderTitle
()
);
doSave
(
'application/x-javascript'
,
data
,
me
.
getMinderTitle
()
);
}
else
if
(
p
.
fileExtension
===
'.svg'
)
{
}
else
if
(
p
.
fileExtension
===
'.svg'
)
{
...
...
src/module/editor.receiver.js
View file @
211403ac
This diff is collapsed.
Click to expand it.
src/module/history.js
View file @
211403ac
...
@@ -58,8 +58,8 @@ KityMinder.registerModule( "HistoryModule", function () {
...
@@ -58,8 +58,8 @@ KityMinder.registerModule( "HistoryModule", function () {
this
.
km
.
initStyle
();
this
.
km
.
initStyle
();
this
.
update
();
this
.
update
();
this
.
km
.
fire
(
'restoreScene'
);
this
.
km
.
fire
(
'restoreScene'
);
this
.
km
.
fire
(
'contentChange'
);
this
.
km
.
fire
(
'contentChange'
);
},
},
getScene
:
function
()
{
getScene
:
function
()
{
return
new
Scene
(
this
.
km
.
getRoot
()
)
return
new
Scene
(
this
.
km
.
getRoot
()
)
...
@@ -95,16 +95,26 @@ KityMinder.registerModule( "HistoryModule", function () {
...
@@ -95,16 +95,26 @@ KityMinder.registerModule( "HistoryModule", function () {
this
.
historyManager
=
new
HistoryManager
(
this
);
this
.
historyManager
=
new
HistoryManager
(
this
);
var
keys
=
{
var
keys
=
{
/*Shift*/
16
:
1
,
/*Ctrl*/
17
:
1
,
/*Alt*/
18
:
1
,
/*Command*/
91
:
1
,
/*Shift*/
37
:
1
,
38
:
1
,
39
:
1
,
40
:
1
16
:
1
,
},
/*Ctrl*/
17
:
1
,
/*Alt*/
18
:
1
,
/*Command*/
91
:
1
,
37
:
1
,
38
:
1
,
39
:
1
,
40
:
1
},
keycont
=
0
,
keycont
=
0
,
lastKeyCode
,
lastKeyCode
,
saveSceneTimer
;
saveSceneTimer
;
return
{
return
{
defaultOptions
:
{
defaultOptions
:
{
maxUndoCount
:
20
,
maxUndoCount
:
20
,
maxInputCount
:
20
maxInputCount
:
20
},
},
"commands"
:
{
"commands"
:
{
"undo"
:
kity
.
createClass
(
"UndoCommand"
,
{
"undo"
:
kity
.
createClass
(
"UndoCommand"
,
{
...
@@ -143,38 +153,39 @@ KityMinder.registerModule( "HistoryModule", function () {
...
@@ -143,38 +153,39 @@ KityMinder.registerModule( "HistoryModule", function () {
},
},
"events"
:
{
"events"
:
{
"saveScene"
:
function
(
e
)
{
"saveScene"
:
function
(
e
)
{
debugger
;
this
.
historyManager
.
saveScene
();
this
.
historyManager
.
saveScene
();
},
},
"renderNode"
:
function
(
e
)
{
"renderNode"
:
function
(
e
)
{
var
node
=
e
.
node
;
var
node
=
e
.
node
;
if
(
node
.
isHighlight
())
{
if
(
node
.
isHighlight
()
)
{
km
.
select
(
node
);
km
.
select
(
node
);
}
}
},
},
"keydown"
:
function
(
e
)
{
"keydown"
:
function
(
e
)
{
var
orgEvt
=
e
.
originEvent
;
var
orgEvt
=
e
.
originEvent
;
var
keyCode
=
orgEvt
.
keyCode
||
orgEvt
.
which
;
var
keyCode
=
orgEvt
.
keyCode
||
orgEvt
.
which
;
if
(
!
keys
[
keyCode
]
&&
!
orgEvt
.
ctrlKey
&&
!
orgEvt
.
metaKey
&&
!
orgEvt
.
shiftKey
&&
!
orgEvt
.
altKey
)
{
if
(
!
keys
[
keyCode
]
&&
!
orgEvt
.
ctrlKey
&&
!
orgEvt
.
metaKey
&&
!
orgEvt
.
shiftKey
&&
!
orgEvt
.
altKey
)
{
if
(
km
.
historyManager
.
list
.
length
==
0
)
{
if
(
km
.
historyManager
.
list
.
length
==
0
)
{
km
.
historyManager
.
saveScene
();
km
.
historyManager
.
saveScene
();
}
}
clearTimeout
(
saveSceneTimer
);
clearTimeout
(
saveSceneTimer
);
saveSceneTimer
=
setTimeout
(
function
()
{
saveSceneTimer
=
setTimeout
(
function
()
{
km
.
historyManager
.
saveScene
();
km
.
historyManager
.
saveScene
();
},
200
);
},
200
);
lastKeyCode
=
keyCode
;
lastKeyCode
=
keyCode
;
keycont
++
;
keycont
++
;
if
(
keycont
>=
km
.
getOptions
(
'maxInputCount'
)
)
{
if
(
keycont
>=
km
.
getOptions
(
'maxInputCount'
)
)
{
km
.
historyManager
.
saveScene
()
km
.
historyManager
.
saveScene
()
}
}
}
}
},
},
"import"
:
function
()
{
"import"
:
function
()
{
this
.
historyManager
.
reset
()
this
.
historyManager
.
reset
()
}
}
}
}
...
...
src/module/layout.default.js
View file @
211403ac
...
@@ -394,18 +394,18 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -394,18 +394,18 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
}
};
};
var
showNodeInView
=
function
(
node
)
{
var
showNodeInView
=
function
(
node
)
{
var
padding
=
5
;
var
padding
=
5
;
var
viewport
=
minder
.
getPaper
().
getViewPort
();
var
viewport
=
minder
.
getPaper
().
getViewPort
();
var
offset
=
node
.
getRenderContainer
().
getRenderBox
(
minder
.
getRenderContainer
()
);
var
offset
=
node
.
getRenderContainer
().
getRenderBox
(
minder
.
getRenderContainer
()
);
var
tmpX
=
viewport
.
center
.
x
*
2
-
(
offset
.
x
+
offset
.
width
);
var
tmpX
=
viewport
.
center
.
x
*
2
-
(
offset
.
x
+
offset
.
width
);
var
tmpY
=
viewport
.
center
.
y
*
2
-
(
offset
.
y
+
offset
.
height
);
var
tmpY
=
viewport
.
center
.
y
*
2
-
(
offset
.
y
+
offset
.
height
);
var
dx
=
offset
.
x
<
0
?
-
offset
.
x
:
Math
.
min
(
tmpX
,
0
);
var
dx
=
offset
.
x
<
0
?
-
offset
.
x
:
Math
.
min
(
tmpX
,
0
);
var
dy
=
offset
.
y
<
0
?
-
offset
.
y
:
Math
.
min
(
tmpY
,
0
);
var
dy
=
offset
.
y
<
0
?
-
offset
.
y
:
Math
.
min
(
tmpY
,
0
);
km
.
getRenderContainer
().
fxTranslate
(
dx
,
dy
,
100
,
"easeOutQuint"
);
km
.
getRenderContainer
().
fxTranslate
(
dx
,
dy
,
100
,
"easeOutQuint"
);
};
};
var
_style
=
{
var
_style
=
{
...
@@ -585,7 +585,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -585,7 +585,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
updateConnectAndshIcon
(
set
[
i
]
);
updateConnectAndshIcon
(
set
[
i
]
);
}
}
if
(
focus
)
{
if
(
focus
)
{
showNodeInView
(
node
);
showNodeInView
(
node
);
}
}
},
},
...
...
src/module/layout.js
View file @
211403ac
...
@@ -107,7 +107,7 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -107,7 +107,7 @@ KityMinder.registerModule( "LayoutModule", function () {
execute
:
function
(
km
,
node
,
focus
,
silbling
)
{
execute
:
function
(
km
,
node
,
focus
,
silbling
)
{
var
parent
=
km
.
getSelectedNode
();
var
parent
=
km
.
getSelectedNode
();
if
(
!
parent
)
{
if
(
!
parent
)
{
return
null
;
return
null
;
}
}
...
@@ -134,7 +134,7 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -134,7 +134,7 @@ KityMinder.registerModule( "LayoutModule", function () {
base
:
Command
,
base
:
Command
,
execute
:
function
(
km
,
node
,
focus
)
{
execute
:
function
(
km
,
node
,
focus
)
{
var
selectedNode
=
km
.
getSelectedNode
();
var
selectedNode
=
km
.
getSelectedNode
();
if
(
!
selectedNode
)
{
if
(
!
selectedNode
)
{
return
null
;
return
null
;
}
}
...
@@ -163,7 +163,7 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -163,7 +163,7 @@ KityMinder.registerModule( "LayoutModule", function () {
base
:
Command
,
base
:
Command
,
execute
:
function
(
km
)
{
execute
:
function
(
km
)
{
if
(
km
.
getRoot
().
children
.
length
==
0
)
{
if
(
km
.
getRoot
().
children
.
length
==
0
)
{
return
;
return
;
}
}
...
...
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