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
bbb1ea4e
Commit
bbb1ea4e
authored
Sep 30, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化鼠标在节点外部时,选区依旧生效
parent
f90cd952
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
editor.js
src/module/editor.js
+9
-2
editor.receiver.js
src/module/editor.receiver.js
+8
-2
No files found.
src/module/editor.js
View file @
bbb1ea4e
...
...
@@ -16,6 +16,8 @@ KityMinder.registerModule('TextEditModule', function() {
//当前是否有选区存在
var
selectionReadyShow
=
false
;
var
mousedownNode
;
function
inputStatusReady
(
node
){
if
(
node
&&
km
.
isSingleSelect
()
&&
node
.
isSelected
())
{
...
...
@@ -91,6 +93,8 @@ KityMinder.registerModule('TextEditModule', function() {
if
(
node
){
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
mousedownNode
=
node
;
var
textGroup
=
node
.
getTextGroup
();
textGroup
.
setStyle
(
'cursor'
,
'default'
);
...
...
@@ -158,6 +162,7 @@ KityMinder.registerModule('TextEditModule', function() {
var
node
=
e
.
getTargetNode
();
mousedownNode
=
null
;
if
(
node
&&
!
selectionReadyShow
&&
receiver
.
isReady
())
{
...
...
@@ -208,11 +213,13 @@ KityMinder.registerModule('TextEditModule', function() {
}
//ipad下不做框选
if
(
mouseDownStatus
&&
receiver
.
isReady
()
&&
selectionReadyShow
)
{
var
node
=
e
.
getTargetNode
();
e
.
stopPropagationImmediately
();
if
(
node
){
var
offset
=
e
.
getPosition
(
node
.
getRenderContainer
());
if
(
node
||
mousedownNode
){
var
offset
=
e
.
getPosition
(
node
?
node
.
getRenderContainer
()
:
mousedownNode
.
getRenderContainer
());
receiver
.
updateSelectionByMousePosition
(
offset
)
...
...
src/module/editor.receiver.js
View file @
bbb1ea4e
...
...
@@ -220,7 +220,7 @@ Minder.Receiver = kity.createClass('Receiver', {
this
.
selection
.
setHeight
((
this
.
minderNode
.
getData
(
'font-size'
)
||
this
.
minderNode
.
getStyle
(
'font-size'
))
*
1
);
return
this
;
},
updateSelectionByMousePosition
:
function
(
offset
,
dir
)
{
updateSelectionByMousePosition
:
function
(
offset
)
{
var
me
=
this
;
var
result
=
0
;
...
...
@@ -240,7 +240,6 @@ Minder.Receiver = kity.createClass('Receiver', {
result
+=
i
;
if
(
offset
.
x
-
v
.
x
>
v
.
width
/
2
)
{
result
+=
1
;
}
...
...
@@ -257,6 +256,13 @@ Minder.Receiver = kity.createClass('Receiver', {
return
false
;
}
else
{
if
(
first
.
y
>
offset
.
y
&&
l
===
0
){
result
=
0
;
return
false
;
}
else
if
(
l
==
me
.
textData
.
length
-
1
&&
first
.
y
+
lineHeight
<
offset
.
y
){
result
+=
arr
.
length
+
1
;
return
false
;
}
result
+=
arr
.
length
+
(
arr
.
length
==
1
&&
arr
[
0
].
width
===
0
?
0
:
1
);
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