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
3f1a7e78
Commit
3f1a7e78
authored
Jun 20, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
改变光标策略适应拖拽策略
parent
486dccd6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
9 deletions
+63
-9
dragtree.js
src/module/dragtree.js
+2
-1
editor.js
src/module/editor.js
+61
-8
No files found.
src/module/dragtree.js
View file @
3f1a7e78
...
...
@@ -153,6 +153,7 @@ var TreeDragger = kity.createClass('TreeDragger', {
this
.
_renderOrderHint
(
null
);
}
this
.
_leaveDragMode
();
this
.
_minder
.
fire
(
'treedragend'
);
},
// 进入拖放模式:
...
...
@@ -326,7 +327,7 @@ KityMinder.registerModule('DragTree', function() {
dragger
=
new
TreeDragger
(
this
);
},
events
:
{
mousedown
:
function
(
e
)
{
'mousedown'
:
function
(
e
)
{
// 单选中根节点也不触发拖拽
if
(
e
.
getTargetNode
()
&&
e
.
getTargetNode
()
!=
this
.
getRoot
())
{
dragger
.
dragStart
(
e
.
getPosition
(
this
.
getRenderContainer
()));
...
...
src/module/editor.js
View file @
3f1a7e78
...
...
@@ -45,6 +45,9 @@ KityMinder.registerModule('TextEditModule', function() {
};
var
selectionByClick
=
false
;
var
hasCursor
=
false
;
var
isSelected
=
false
;
return
{
'events'
:
{
...
...
@@ -58,6 +61,7 @@ KityMinder.registerModule('TextEditModule', function() {
e
.
stopPropagationImmediately
();
return
;
}
hasCursor
=
sel
.
isShow
();
sel
.
setHide
();
var
node
=
e
.
getTargetNode
();
...
...
@@ -75,12 +79,12 @@ KityMinder.registerModule('TextEditModule', function() {
if
(
node
)
{
var
textShape
=
node
.
getRenderer
(
'TextRenderer'
).
getRenderShape
();
textShape
.
setStyle
(
'cursor'
,
'default'
);
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
()
&&
hasCursor
)
{
sel
.
collapse
();
sel
.
setSelectionShowStatus
(
true
);
node
.
getRenderer
(
'TextRenderer'
).
getRenderShape
().
setStyle
(
'cursor'
,
'text'
);
km
.
setStatus
(
'textedit'
);
receiver
.
setTextEditStatus
(
true
)
.
setSelection
(
sel
)
.
setKityMinder
(
this
)
...
...
@@ -90,17 +94,23 @@ KityMinder.registerModule('TextEditModule', function() {
.
setContainerStyle
()
.
setSelectionHeight
()
.
setCurrentIndex
(
e
.
getPosition
(
this
.
getRenderContainer
()))
.
updateSelection
()
.
setRange
(
range
);
sel
.
setData
(
'relatedNode'
,
node
);
mouseDownStatus
=
true
;
lastEvtPosition
=
e
.
getPosition
(
this
.
getRenderContainer
());
if
(
selectionByClick
)
{
receiver
.
updateSelection
();
sel
.
setShow
();
selectionByClick
=
false
;
}
km
.
setStatus
(
'textedit'
);
}
}
isSelected
=
node
.
isSelected
();
}
},
...
...
@@ -168,6 +178,41 @@ KityMinder.registerModule('TextEditModule', function() {
}
},
'normal.mouseup textedit.mouseup'
:
function
(
e
)
{
var
node
=
e
.
getTargetNode
();
if
(
node
)
{
var
textShape
=
node
.
getRenderer
(
'TextRenderer'
).
getRenderShape
();
if
(
isSelected
&&
!
hasCursor
)
{
console
.
log
(
'sd'
)
sel
.
collapse
();
sel
.
setSelectionShowStatus
(
true
);
node
.
getRenderer
(
'TextRenderer'
).
getRenderShape
().
setStyle
(
'cursor'
,
'text'
);
receiver
.
setTextEditStatus
(
true
)
.
setSelection
(
sel
)
.
setKityMinder
(
this
)
.
setMinderNode
(
node
)
.
setTextShape
(
textShape
)
.
setBaseOffset
()
.
setContainerStyle
()
.
setSelectionHeight
()
.
setCurrentIndex
(
e
.
getPosition
(
this
.
getRenderContainer
()))
.
updateSelection
()
.
setRange
(
range
);
sel
.
setData
(
'relatedNode'
,
node
);
lastEvtPosition
=
e
.
getPosition
(
this
.
getRenderContainer
());
if
(
selectionByClick
)
{
sel
.
setShow
();
selectionByClick
=
false
;
}
km
.
setStatus
(
'textedit'
);
return
;
}
}
if
(
mouseDownStatus
)
{
if
(
!
sel
.
collapsed
)
{
...
...
@@ -177,12 +222,16 @@ KityMinder.registerModule('TextEditModule', function() {
console
.
log
(
error
);
}
}
else
{
sel
.
setShow
();
receiver
.
updateSelection
();
}
if
(
browser
.
ipad
)
{
receiver
.
container
.
focus
();
}
hasCursor
=
true
;
km
.
setStatus
(
'textedit'
);
}
else
{
//当选中节点后,输入状态准备
var
node
=
e
.
getTargetNode
();
...
...
@@ -208,9 +257,11 @@ KityMinder.registerModule('TextEditModule', function() {
.
updateRange
(
range
).
setTextEditStatus
(
true
);
sel
.
setData
(
'relatedNode'
,
node
);
km
.
setStatus
(
'textedit'
);
}
}
}
...
...
@@ -219,7 +270,7 @@ KityMinder.registerModule('TextEditModule', function() {
},
'textedit.beforemousemove'
:
function
(
e
)
{
//ipad下不做框选
if
(
mouseDownStatus
&&
!
browser
.
ipad
)
{
if
(
mouseDownStatus
&&
(
sel
.
isShow
()
||
hasCursor
)
&&
!
browser
.
ipad
)
{
e
.
stopPropagationImmediately
();
var
offset
=
e
.
getPosition
(
this
.
getRenderContainer
());
...
...
@@ -240,7 +291,6 @@ KityMinder.registerModule('TextEditModule', function() {
var
text
=
e
.
kityEvent
.
targetShape
;
if
(
text
.
getType
().
toLowerCase
()
==
'text'
)
{
sel
.
setStartOffset
(
0
);
sel
.
setEndOffset
(
text
.
getContent
().
length
);
sel
.
setShow
();
...
...
@@ -336,7 +386,7 @@ KityMinder.registerModule('TextEditModule', function() {
}
},
'layoutfinish'
:
function
(
e
)
{
if
(
e
.
node
===
receiver
.
minderNode
&&
this
.
getStatus
()
==
'textedit'
)
{
if
(
e
.
node
===
receiver
.
minderNode
&&
this
.
getStatus
()
==
'textedit'
&&
hasCursor
)
{
receiver
.
setBaseOffset
()
.
setContainerStyle
()
...
...
@@ -364,6 +414,9 @@ KityMinder.registerModule('TextEditModule', function() {
},
'textedit.mousewheel'
:
function
()
{
receiver
.
setContainerStyle
();
},
'treedragend'
:
function
(){
isSelected
=
false
;
}
}
};
...
...
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