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
dd8bb74c
Commit
dd8bb74c
authored
Jun 26, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模拟光标这个整体调整
parent
38a32e73
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
37 deletions
+36
-37
minder.js
src/core/minder.js
+4
-0
dragtree.js
src/module/dragtree.js
+8
-0
editor.js
src/module/editor.js
+5
-12
editor.receiver.js
src/module/editor.receiver.js
+18
-10
editor.selection.js
src/module/editor.selection.js
+1
-15
No files found.
src/core/minder.js
View file @
dd8bb74c
...
...
@@ -176,6 +176,10 @@ var Minder = KityMinder.Minder = kity.createClass('KityMinder', {
},
setStatus
:
function
(
status
)
{
if
(
status
)
{
this
.
fire
(
'statuschange'
,{
lastStatus
:
this
.
_status
,
currentStatus
:
status
});
this
.
_rollbackStatus
=
this
.
_status
;
this
.
_status
=
status
;
}
else
{
...
...
src/module/dragtree.js
View file @
dd8bb74c
...
...
@@ -316,6 +316,9 @@ var TreeDragger = kity.createClass('TreeDragger', {
_renderOrderHint
:
function
(
hint
)
{
this
.
_orderHinter
.
render
(
hint
);
},
preventDragMove
:
function
(){
this
.
_startPosition
=
null
;
}
});
...
...
@@ -340,6 +343,11 @@ KityMinder.registerModule('DragTree', function() {
dragger
.
dragEnd
(
e
.
getPosition
(
this
.
getRenderContainer
()));
e
.
stopPropagation
();
this
.
fire
(
'contentchange'
);
},
'statuschange'
:
function
(
e
){
if
(
e
.
lastStatus
==
'textedit'
&&
e
.
currentStatus
==
'normal'
){
dragger
.
preventDragMove
();
}
}
},
commands
:
{
...
...
src/module/editor.js
View file @
dd8bb74c
...
...
@@ -40,7 +40,6 @@ KityMinder.registerModule('TextEditModule', function() {
'events'
:
{
'ready'
:
function
()
{
this
.
_renderTarget
.
appendChild
(
receiver
.
container
);
this
.
getRenderContainer
().
addShape
(
sel
);
},
'normal.beforemousedown textedit.beforemousedown inputready.beforemousedown'
:
function
(
e
)
{
...
...
@@ -73,7 +72,6 @@ KityMinder.registerModule('TextEditModule', function() {
var
textShape
=
node
.
getTextShape
();
textShape
.
setStyle
(
'cursor'
,
'default'
);
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
sel
.
collapse
();
...
...
@@ -182,6 +180,8 @@ KityMinder.registerModule('TextEditModule', function() {
inputStatusReady
(
e
.
getTargetNode
());
km
.
setStatus
(
'textedit'
);
receiver
.
updateSelectionShow
();
},
// 'restoreScene': function() {
...
...
@@ -226,7 +226,7 @@ KityMinder.registerModule('TextEditModule', function() {
};
if
(
cmds
[
e
.
commandName
])
{
inputStatusReady
(
km
.
getSelectedNode
());
selectionReadyShow
=
true
;
receiver
.
updateSelectionShow
()
;
return
;
}
...
...
@@ -236,18 +236,11 @@ KityMinder.registerModule('TextEditModule', function() {
this
.
setStatus
(
'normal'
);
}
},
'layout
apply
'
:
function
(
e
){
'layout
finish
'
:
function
(
e
){
if
(
e
.
node
===
receiver
.
minderNode
&&
(
this
.
getStatus
()
==
'textedit'
||
this
.
getStatus
()
==
'inputready'
)
)
{
//&& selectionReadyShow
receiver
.
setBaseOffset
()
.
setContainerStyle
()
.
updateTextOffsetData
();
if
(
sel
.
collapsed
)
{
receiver
.
updateSelection
();
}
else
{
receiver
.
updateSelectionShow
();
}
.
setContainerStyle
();
}
},
...
...
src/module/editor.receiver.js
View file @
dd8bb74c
...
...
@@ -61,16 +61,14 @@ Minder.Receiver = kity.createClass('Receiver', {
getTextShapeHeight
:
function
()
{
return
this
.
textShape
.
getRenderBox
().
height
;
},
appendTextShapeToPaper
:
function
(
paper
)
{
paper
.
addShape
(
this
.
textShape
);
return
this
;
},
setKityMinder
:
function
(
km
)
{
this
.
km
=
km
;
return
this
;
},
setMinderNode
:
function
(
node
)
{
this
.
minderNode
=
node
;
//追加selection到节点
this
.
_addSelection
();
//更新minderNode下的textshape
this
.
setTextShape
(
node
.
getTextShape
());
//更新textshape的baseOffset
...
...
@@ -86,6 +84,10 @@ Minder.Receiver = kity.createClass('Receiver', {
return
this
;
},
_addSelection
:
function
(){
if
(
this
.
selection
.
container
)
this
.
selection
.
remove
();
this
.
minderNode
.
getRenderContainer
().
addShape
(
this
.
selection
);
},
getMinderNode
:
function
(){
return
this
.
minderNode
;
},
...
...
@@ -119,7 +121,7 @@ Minder.Receiver = kity.createClass('Receiver', {
me
.
minderNode
.
render
();
clearTimeout
(
me
.
inputTextTimer
);
me
.
inputTextTimer
=
setTimeout
(
function
(){
me
.
km
.
layout
();
me
.
km
.
layout
(
300
);
},
250
);
me
.
textShape
=
me
.
minderNode
.
getRenderer
(
'TextRenderer'
).
getRenderShape
();
...
...
@@ -314,8 +316,8 @@ Minder.Receiver = kity.createClass('Receiver', {
}
this
.
textData
.
push
({
x
:
box
.
x
+
this
.
offset
.
x
,
y
:
this
.
offset
.
y
,
x
:
box
.
x
,
y
:
box
.
y
,
width
:
box
.
width
,
height
:
box
.
height
});
...
...
@@ -326,6 +328,8 @@ Minder.Receiver = kity.createClass('Receiver', {
var
me
=
this
;
this
.
getTextOffsetData
();
var
hadChanged
=
false
;
//要剪掉基数
this
.
_getRelativeValue
(
offset
);
utils
.
each
(
this
.
textData
,
function
(
i
,
v
)
{
//点击开始之前
if
(
i
===
0
&&
offset
.
x
<=
v
.
x
)
{
...
...
@@ -356,9 +360,13 @@ Minder.Receiver = kity.createClass('Receiver', {
this
.
selection
.
setHeight
(
this
.
getTextShapeHeight
());
return
this
;
},
_getRelativeValue
:
function
(
offset
){
offset
.
x
=
offset
.
x
-
this
.
offset
.
x
;
offset
.
y
=
offset
.
y
-
this
.
offset
.
y
;
},
updateSelectionByMousePosition
:
function
(
offset
,
dir
)
{
//要剪掉基数
this
.
_getRelativeValue
(
offset
);
var
me
=
this
;
utils
.
each
(
this
.
textData
,
function
(
i
,
v
)
{
//点击开始之前
...
...
@@ -435,7 +443,7 @@ Minder.Receiver = kity.createClass('Receiver', {
return
this
;
},
updateContainerRangeBySel
:
function
(){
this
.
updateRange
(
this
.
range
)
this
.
updateRange
(
this
.
range
)
;
},
setIndex
:
function
(
index
)
{
this
.
index
=
index
;
...
...
src/module/editor.selection.js
View file @
dd8bb74c
...
...
@@ -15,7 +15,7 @@ Minder.Selection = kity.createClass( 'Selection', {
this
.
setOpacity
(
0.5
);
this
.
setStyle
(
'cursor'
,
'text'
);
this
.
_show
=
false
;
this
.
selectionShowStatus
=
true
;
},
collapse
:
function
(
toEnd
){
...
...
@@ -121,19 +121,5 @@ Minder.Selection = kity.createClass( 'Selection', {
},
isHide
:
function
(){
return
!
this
.
_show
;
},
setTextShape
:
function
(
text
)
{
if
(
!
text
)
{
this
.
text
=
new
kity
.
Text
();
}
else
{
this
.
text
=
text
;
}
return
this
;
},
getTextShape
:
function
()
{
return
this
.
text
;
},
setTxtContent
:
function
(
text
)
{
this
.
text
.
setContent
(
text
);
}
}
);
\ No newline at end of file
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