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
f95f1796
Commit
f95f1796
authored
May 14, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
改进history的性能
parent
ead205d7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
8 deletions
+23
-8
editor.js
src/module/editor.js
+5
-3
editor.receiver.js
src/module/editor.receiver.js
+10
-5
editor.selection.js
src/module/editor.selection.js
+8
-0
No files found.
src/module/editor.js
View file @
f95f1796
...
...
@@ -77,6 +77,7 @@ KityMinder.registerModule( "TextEditModule", function () {
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
// && e.kityEvent.targetShape.getType().toLowerCase()== 'text'
sel
.
collapse
();
sel
.
setSelectionShowStatus
(
true
);
node
.
getTextShape
().
setStyle
(
'cursor'
,
'text'
);
km
.
setStatus
(
'textedit'
);
receiver
.
setTextEditStatus
(
true
)
...
...
@@ -112,6 +113,7 @@ KityMinder.registerModule( "TextEditModule", function () {
var
nativeRange
=
range
.
nativeSel
.
getRangeAt
(
0
);
if
(
nativeRange
&&
(
nativeRange
.
startContainer
===
receiver
.
container
||
receiver
.
container
.
contains
(
nativeRange
.
startContainer
))){
km
.
setStatus
(
'textedit'
);
sel
.
setSelectionShowStatus
(
true
);
km
.
fire
(
'saveScene'
);
}
...
...
@@ -127,14 +129,13 @@ KityMinder.registerModule( "TextEditModule", function () {
var
orgEvt
=
e
.
originEvent
,
keyCode
=
orgEvt
.
keyCode
;
if
(
keymap
.
isSelectedNodeKey
[
keyCode
]
&&
km
.
getStatus
()
!=
'textedit'
&&
!
orgEvt
.
ctrlKey
&&
!
orgEvt
.
metaKey
&&
!
orgEvt
.
shiftKey
&&
!
orgEvt
.
altKey
){
//准备输入状态
var
textShape
=
node
.
getTextShape
();
sel
.
setHide
();
sel
.
setStartOffset
(
0
);
sel
.
setEndOffset
(
textShape
.
getContent
().
length
);
sel
.
setSelectionShowStatus
(
true
);
receiver
.
setTextEditStatus
(
true
)
.
setSelection
(
sel
)
.
setKityMinder
(
this
)
...
...
@@ -237,7 +238,7 @@ KityMinder.registerModule( "TextEditModule", function () {
sel
.
setHide
();
sel
.
setStartOffset
(
0
);
sel
.
setEndOffset
(
textShape
.
getContent
().
length
);
sel
.
setSelectionShowStatus
(
false
);
receiver
.
setTextEditStatus
(
true
)
.
setSelection
(
sel
)
.
setKityMinder
(
this
)
...
...
@@ -249,6 +250,7 @@ KityMinder.registerModule( "TextEditModule", function () {
.
setSelectionHeight
()
.
setContainerTxt
(
textShape
.
getContent
())
.
updateRange
(
range
).
setTextEditStatus
(
true
);
km
.
setStatus
(
'normal'
);
sel
.
setData
(
'relatedNode'
,
node
);
}
else
{
...
...
src/module/editor.receiver.js
View file @
f95f1796
...
...
@@ -112,11 +112,15 @@ Minder.Receiver = kity.createClass( 'Receiver', {
me
.
updateTextData
();
me
.
updateIndex
();
me
.
updateSelection
();
me
.
timer
=
setTimeout
(
function
()
{
if
(
me
.
selection
.
getSelectionShowStatus
())
{
me
.
updateSelection
();
me
.
timer
=
setTimeout
(
function
()
{
me
.
selection
.
setShow
()
},
500
);
},
500
)
}
}
var
isTypeText
=
false
;
var
isKeypress
=
false
;
...
...
@@ -379,7 +383,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
var
lastOffset
=
this
.
textData
[
this
.
textData
.
length
-
1
];
width
=
lastOffset
.
x
-
startOffset
.
x
+
lastOffset
.
width
;
}
catch
(
e
)
{
console
.
log
(
'e'
)
console
.
log
(
e
)
}
}
else
{
...
...
@@ -404,4 +408,5 @@ Minder.Receiver = kity.createClass( 'Receiver', {
this
.
container
.
textContent
=
txt
;
return
this
;
}
}
);
\ No newline at end of file
src/module/editor.selection.js
View file @
f95f1796
...
...
@@ -15,6 +15,7 @@ Minder.Selection = kity.createClass( 'Selection', {
this
.
setOpacity
(
0.5
);
this
.
setStyle
(
'cursor'
,
'text'
);
this
.
_show
=
false
;
this
.
selectionShowStatus
=
true
;
},
collapse
:
function
(
toEnd
){
...
...
@@ -103,6 +104,7 @@ Minder.Selection = kity.createClass( 'Selection', {
var
me
=
this
,
state
=
''
;
me
.
setStyle
(
'display'
,
''
);
this
.
setSelectionShowStatus
(
true
);
me
.
_show
=
true
;
if
(
this
.
collapsed
){
me
.
setOpacity
(
1
);
...
...
@@ -133,5 +135,11 @@ Minder.Selection = kity.createClass( 'Selection', {
},
updatePosition
:
function
(
index
)
{
},
setSelectionShowStatus
:
function
(
status
){
this
.
selectionShowStatus
=
status
;
},
getSelectionShowStatus
:
function
(){
return
this
.
selectionShowStatus
}
}
);
\ No newline at end of file
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