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, {
...
@@ -13,7 +13,7 @@ kity.extendClass( Minder, {
},
},
// TODO: mousemove lazy bind
// TODO: mousemove lazy bind
_bindPaperEvents
:
function
()
{
_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
)
{
if
(
window
)
{
window
.
addEventListener
(
'resize'
,
this
.
_firePharse
.
bind
(
this
)
);
window
.
addEventListener
(
'resize'
,
this
.
_firePharse
.
bind
(
this
)
);
}
}
...
...
src/module/editor.js
View file @
8cdd0c12
...
@@ -27,7 +27,7 @@ KityMinder.registerModule( "TextEditModule", function () {
...
@@ -27,7 +27,7 @@ KityMinder.registerModule( "TextEditModule", function () {
var
textShape
=
node
.
getTextShape
();
var
textShape
=
node
.
getTextShape
();
textShape
.
setStyle
(
'cursor'
,
'default'
);
textShape
.
setStyle
(
'cursor'
,
'default'
);
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
()
)
{
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
()
&&
e
.
kityEvent
.
targetShape
.
getType
().
toLowerCase
()
==
'text'
)
{
sel
.
collapse
();
sel
.
collapse
();
node
.
getTextShape
().
setStyle
(
'cursor'
,
'text'
);
node
.
getTextShape
().
setStyle
(
'cursor'
,
'text'
);
...
@@ -57,18 +57,26 @@ KityMinder.registerModule( "TextEditModule", function () {
...
@@ -57,18 +57,26 @@ KityMinder.registerModule( "TextEditModule", function () {
'beforemousemove'
:
function
(
e
){
'beforemousemove'
:
function
(
e
){
if
(
mouseDownStatus
){
if
(
mouseDownStatus
){
e
.
stopPropagationImmediately
();
e
.
stopPropagationImmediately
();
setTimeout
(
function
(){
var
offset
=
e
.
getPosition
();
dir
=
offset
.
x
>
lastEvtPosition
.
x
?
1
:
(
offset
.
x
<
lastEvtPosition
.
x
?
-
1
:
dir
);
var
offset
=
e
.
getPosition
();
receiver
.
updateSelectionByMousePosition
(
offset
,
dir
)
dir
=
offset
.
x
>
lastEvtPosition
.
x
?
1
:
(
offset
.
x
<
lastEvtPosition
.
x
?
-
1
:
dir
);
.
updateSelectionShow
(
dir
);
receiver
.
updateSelectionByMousePosition
(
offset
,
dir
)
sel
.
stroke
(
'none'
,
0
);
.
updateSelectionShow
(
dir
);
lastEvtPosition
=
e
.
getPosition
();
sel
.
stroke
(
'none'
,
0
);
lastEvtPosition
=
e
.
getPosition
();
},
100
)
}
}
},
'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
(){
'restoreScene'
:
function
(){
sel
.
setHide
();
sel
.
setHide
();
...
...
src/module/editor.receiver.js
View file @
8cdd0c12
...
@@ -223,6 +223,9 @@ Minder.Receiver = kity.createClass('Receiver',{
...
@@ -223,6 +223,9 @@ Minder.Receiver = kity.createClass('Receiver',{
if
(
offset
.
x
>=
v
.
x
&&
offset
.
x
<=
v
.
x
+
v
.
width
){
if
(
offset
.
x
>=
v
.
x
&&
offset
.
x
<=
v
.
x
+
v
.
width
){
if
(
me
.
index
==
i
){
if
(
me
.
index
==
i
){
if
(
i
==
0
){
me
.
selection
.
setStartOffset
(
i
)
}
me
.
selection
.
setEndOffset
(
i
+
(
dir
==
1
?
1
:
0
))
me
.
selection
.
setEndOffset
(
i
+
(
dir
==
1
?
1
:
0
))
}
else
if
(
i
>
me
.
index
){
}
else
if
(
i
>
me
.
index
){
me
.
selection
.
setEndOffset
(
i
+
(
dir
==
1
?
1
:
0
))
me
.
selection
.
setEndOffset
(
i
+
(
dir
==
1
?
1
:
0
))
...
@@ -236,7 +239,6 @@ Minder.Receiver = kity.createClass('Receiver',{
...
@@ -236,7 +239,6 @@ Minder.Receiver = kity.createClass('Receiver',{
return
this
;
return
this
;
},
},
updateSelectionShow
:
function
(){
updateSelectionShow
:
function
(){
var
startOffset
=
this
.
textData
[
this
.
selection
.
startOffset
],
var
startOffset
=
this
.
textData
[
this
.
selection
.
startOffset
],
endOffset
=
this
.
textData
[
this
.
selection
.
endOffset
],
endOffset
=
this
.
textData
[
this
.
selection
.
endOffset
],
width
=
0
;
width
=
0
;
...
...
src/module/editor.selection.js
View file @
8cdd0c12
...
@@ -86,10 +86,15 @@ Minder.Selection = kity.createClass( 'Selection', {
...
@@ -86,10 +86,15 @@ Minder.Selection = kity.createClass( 'Selection', {
clearInterval
(
this
.
timer
);
clearInterval
(
this
.
timer
);
var
me
=
this
,
var
me
=
this
,
state
=
''
;
state
=
''
;
this
.
timer
=
setInterval
(
function
()
{
if
(
this
.
collapsed
){
me
.
setStyle
(
'display'
,
state
);
this
.
timer
=
setInterval
(
function
()
{
state
=
state
?
''
:
'none'
;
me
.
setStyle
(
'display'
,
state
);
},
300
);
state
=
state
?
''
:
'none'
;
},
300
);
}
else
{
me
.
setStyle
(
'display'
,
''
);
}
return
this
;
return
this
;
},
},
setTextShape
:
function
(
text
)
{
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