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
8cdd0c12
Commit
8cdd0c12
authored
Feb 17, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
by zhanyi
parent
d44dd094
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
16 deletions
+31
-16
minder.event.js
src/core/minder.event.js
+1
-1
editor.js
src/module/editor.js
+18
-10
editor.receiver.js
src/module/editor.receiver.js
+3
-1
editor.selection.js
src/module/editor.selection.js
+9
-4
No files found.
src/core/minder.event.js
View file @
8cdd0c12
...
...
@@ -13,7 +13,7 @@ kity.extendClass( Minder, {
},
// TODO: mousemove lazy bind
_bindPaperEvents
:
function
()
{
this
.
_paper
.
on
(
'click mousedown mouseup mousemove mousewheel touchstart touchmove touchend'
,
this
.
_firePharse
.
bind
(
this
)
);
this
.
_paper
.
on
(
'click
dblclick
mousedown mouseup mousemove mousewheel touchstart touchmove touchend'
,
this
.
_firePharse
.
bind
(
this
)
);
if
(
window
)
{
window
.
addEventListener
(
'resize'
,
this
.
_firePharse
.
bind
(
this
)
);
}
...
...
src/module/editor.js
View file @
8cdd0c12
...
...
@@ -27,7 +27,7 @@ KityMinder.registerModule( "TextEditModule", function () {
var
textShape
=
node
.
getTextShape
();
textShape
.
setStyle
(
'cursor'
,
'default'
);
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
()
)
{
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
()
&&
e
.
kityEvent
.
targetShape
.
getType
().
toLowerCase
()
==
'text'
)
{
sel
.
collapse
();
node
.
getTextShape
().
setStyle
(
'cursor'
,
'text'
);
...
...
@@ -57,18 +57,26 @@ KityMinder.registerModule( "TextEditModule", function () {
'beforemousemove'
:
function
(
e
){
if
(
mouseDownStatus
){
e
.
stopPropagationImmediately
();
setTimeout
(
function
(){
var
offset
=
e
.
getPosition
();
dir
=
offset
.
x
>
lastEvtPosition
.
x
?
1
:
(
offset
.
x
<
lastEvtPosition
.
x
?
-
1
:
dir
);
receiver
.
updateSelectionByMousePosition
(
offset
,
dir
)
.
updateSelectionShow
(
dir
);
sel
.
stroke
(
'none'
,
0
);
lastEvtPosition
=
e
.
getPosition
();
},
100
)
var
offset
=
e
.
getPosition
();
dir
=
offset
.
x
>
lastEvtPosition
.
x
?
1
:
(
offset
.
x
<
lastEvtPosition
.
x
?
-
1
:
dir
);
receiver
.
updateSelectionByMousePosition
(
offset
,
dir
)
.
updateSelectionShow
(
dir
);
sel
.
stroke
(
'none'
,
0
);
lastEvtPosition
=
e
.
getPosition
();
}
},
'dblclick'
:
function
(
e
){
var
text
=
e
.
kityEvent
.
targetShape
;
if
(
text
.
getType
().
toLowerCase
()
==
'text'
)
{
sel
.
setStartOffset
(
0
);
sel
.
setEndOffset
(
text
.
getContent
().
length
);
sel
.
setShow
();
receiver
.
updateSelectionShow
(
1
)
.
updateRange
(
range
);
}
},
'restoreScene'
:
function
(){
sel
.
setHide
();
...
...
src/module/editor.receiver.js
View file @
8cdd0c12
...
...
@@ -223,6 +223,9 @@ Minder.Receiver = kity.createClass('Receiver',{
if
(
offset
.
x
>=
v
.
x
&&
offset
.
x
<=
v
.
x
+
v
.
width
){
if
(
me
.
index
==
i
){
if
(
i
==
0
){
me
.
selection
.
setStartOffset
(
i
)
}
me
.
selection
.
setEndOffset
(
i
+
(
dir
==
1
?
1
:
0
))
}
else
if
(
i
>
me
.
index
){
me
.
selection
.
setEndOffset
(
i
+
(
dir
==
1
?
1
:
0
))
...
...
@@ -236,7 +239,6 @@ Minder.Receiver = kity.createClass('Receiver',{
return
this
;
},
updateSelectionShow
:
function
(){
var
startOffset
=
this
.
textData
[
this
.
selection
.
startOffset
],
endOffset
=
this
.
textData
[
this
.
selection
.
endOffset
],
width
=
0
;
...
...
src/module/editor.selection.js
View file @
8cdd0c12
...
...
@@ -86,10 +86,15 @@ Minder.Selection = kity.createClass( 'Selection', {
clearInterval
(
this
.
timer
);
var
me
=
this
,
state
=
''
;
this
.
timer
=
setInterval
(
function
()
{
me
.
setStyle
(
'display'
,
state
);
state
=
state
?
''
:
'none'
;
},
300
);
if
(
this
.
collapsed
){
this
.
timer
=
setInterval
(
function
()
{
me
.
setStyle
(
'display'
,
state
);
state
=
state
?
''
:
'none'
;
},
300
);
}
else
{
me
.
setStyle
(
'display'
,
''
);
}
return
this
;
},
setTextShape
:
function
(
text
)
{
...
...
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