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
0df7b916
Commit
0df7b916
authored
Feb 04, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
by zhanyi
parent
533ef8e4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
21 deletions
+12
-21
editor.receiver.js
src/module/editor.receiver.js
+12
-21
No files found.
src/module/editor.receiver.js
View file @
0df7b916
...
...
@@ -83,10 +83,8 @@ Minder.Receiver = kity.createClass('Receiver',{
e
.
stopPropagation
();
return
;
}
var
text
=
(
this
.
container
.
textContent
||
this
.
container
.
innerText
).
replace
(
/
\u
200b/g
,
''
);
this
.
textShape
.
setContent
(
text
);
this
.
setContainerStyle
();
this
.
minderNode
.
setText
(
text
);
...
...
@@ -122,23 +120,9 @@ Minder.Receiver = kity.createClass('Receiver',{
x
:
this
.
textData
[
this
.
index
-
1
].
x
+
this
.
textData
[
this
.
index
-
1
].
width
,
y
:
this
.
textData
[
this
.
index
-
1
].
y
})
}
else
if
(
this
.
index
==
0
){
this
.
cursor
.
setPosition
({
x
:
this
.
textShape
.
getX
(),
y
:
this
.
textShape
.
getY
()
})
}
else
{
if
(
this
.
index
+
1
==
this
.
textData
.
length
){
var
lastChar
=
this
.
textData
[
this
.
index
];
this
.
cursor
.
setPosition
({
x
:
lastChar
.
x
+
lastChar
.
width
,
y
:
lastChar
.
y
})
}
else
{
this
.
cursor
.
setPosition
(
this
.
textData
[
this
.
index
])
}
}
return
this
;
},
setBaseOffset
:
function
(){
...
...
@@ -154,7 +138,6 @@ Minder.Receiver = kity.createClass('Receiver',{
},
setContainerStyle
:
function
(){
var
textShapeBox
=
this
.
textShape
.
getRenderBox
();
var
size
=
this
.
textShape
.
getSize
();
this
.
container
.
style
.
cssText
=
";left:"
+
this
.
offset
.
x
+
'px;top:'
+
(
this
.
offset
.
y
+
textShapeBox
.
height
)
...
...
@@ -175,8 +158,6 @@ Minder.Receiver = kity.createClass('Receiver',{
height
:
box
.
height
})
}
return
this
;
},
setCurrentIndex
:
function
(
offset
){
...
...
@@ -184,6 +165,16 @@ Minder.Receiver = kity.createClass('Receiver',{
this
.
getTextOffsetData
();
var
hadChanged
=
false
;
utils
.
each
(
this
.
textData
,
function
(
i
,
v
){
//点击开始之前
if
(
i
==
0
&&
offset
.
x
<=
v
.
x
){
me
.
index
=
0
;
return
false
;
}
if
(
i
==
me
.
textData
.
length
-
1
&&
offset
.
x
>=
v
.
x
){
me
.
index
=
me
.
textData
.
length
;
return
false
;
}
if
(
offset
.
x
>=
v
.
x
&&
offset
.
x
<=
v
.
x
+
v
.
width
){
if
(
offset
.
x
-
v
.
x
>
v
.
width
/
2
){
me
.
index
=
i
+
1
;
...
...
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