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
6e17b170
Commit
6e17b170
authored
Jun 26, 2014
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
ddafa735
1fbea29d
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
41 additions
and
43 deletions
+41
-43
minder.js
src/core/minder.js
+4
-0
bottom.js
src/layout/bottom.js
+1
-2
filetree.js
src/layout/filetree.js
+1
-1
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
bottom.js
src/theme/bottom.js
+1
-1
filetree.js
src/theme/filetree.js
+2
-2
No files found.
src/core/minder.js
View file @
6e17b170
...
@@ -176,6 +176,10 @@ var Minder = KityMinder.Minder = kity.createClass('KityMinder', {
...
@@ -176,6 +176,10 @@ var Minder = KityMinder.Minder = kity.createClass('KityMinder', {
},
},
setStatus
:
function
(
status
)
{
setStatus
:
function
(
status
)
{
if
(
status
)
{
if
(
status
)
{
this
.
fire
(
'statuschange'
,{
lastStatus
:
this
.
_status
,
currentStatus
:
status
});
this
.
_rollbackStatus
=
this
.
_status
;
this
.
_rollbackStatus
=
this
.
_status
;
this
.
_status
=
status
;
this
.
_status
=
status
;
}
else
{
}
else
{
...
...
src/layout/bottom.js
View file @
6e17b170
...
@@ -33,6 +33,7 @@ KityMinder.registerLayout('bottom', kity.createClass({
...
@@ -33,6 +33,7 @@ KityMinder.registerLayout('bottom', kity.createClass({
return
box
;
return
box
;
});
});
var
nodeContentBox
=
node
.
getContentBox
();
var
nodeContentBox
=
node
.
getContentBox
();
node
.
setLayoutVector
(
new
kity
.
Vector
(
nodeContentBox
.
cx
-
5
,
nodeContentBox
.
bottom
));
var
i
,
x
,
y
,
child
,
childTreeBox
,
childContentBox
;
var
i
,
x
,
y
,
child
,
childTreeBox
,
childContentBox
;
var
transform
=
new
kity
.
Matrix
();
var
transform
=
new
kity
.
Matrix
();
x
=
-
totalTreeWidth
/
2
;
x
=
-
totalTreeWidth
/
2
;
...
@@ -50,7 +51,6 @@ KityMinder.registerLayout('bottom', kity.createClass({
...
@@ -50,7 +51,6 @@ KityMinder.registerLayout('bottom', kity.createClass({
y
=
nodeContentBox
.
height
+
node
.
getStyle
(
'margin-bottom'
)
+
children
[
i
].
getStyle
(
'margin-top'
);
y
=
nodeContentBox
.
height
+
node
.
getStyle
(
'margin-bottom'
)
+
children
[
i
].
getStyle
(
'margin-top'
);
children
[
i
].
setLayoutTransform
(
new
kity
.
Matrix
().
translate
(
x
,
y
));
children
[
i
].
setLayoutTransform
(
new
kity
.
Matrix
().
translate
(
x
,
y
));
x
+=
childTreeBox
.
width
/
2
+
children
[
i
].
getStyle
(
'margin-right'
);
x
+=
childTreeBox
.
width
/
2
+
children
[
i
].
getStyle
(
'margin-right'
);
child
.
setLayoutVector
(
new
kity
.
Vector
(
childContentBox
.
cx
-
5
,
childContentBox
.
bottom
));
}
}
}
}
}
}
...
@@ -64,6 +64,5 @@ KityMinder.registerConnectProvider('bottom', function(node, parent, connection)
...
@@ -64,6 +64,5 @@ KityMinder.registerConnectProvider('bottom', function(node, parent, connection)
pathData
.
push
(
'L'
,
new
kity
.
Point
(
pBox
.
cx
,
pBox
.
bottom
+
parent
.
getStyle
(
'margin-bottom'
)));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
pBox
.
cx
,
pBox
.
bottom
+
parent
.
getStyle
(
'margin-bottom'
)));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
box
.
cx
,
pBox
.
bottom
+
parent
.
getStyle
(
'margin-bottom'
)));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
box
.
cx
,
pBox
.
bottom
+
parent
.
getStyle
(
'margin-bottom'
)));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
box
.
cx
,
box
.
top
));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
box
.
cx
,
box
.
top
));
console
.
log
(
pathData
);
connection
.
setPathData
(
pathData
);
connection
.
setPathData
(
pathData
);
});
});
\ No newline at end of file
src/layout/filetree.js
View file @
6e17b170
...
@@ -28,6 +28,7 @@ KityMinder.registerLayout('filetree', kity.createClass({
...
@@ -28,6 +28,7 @@ KityMinder.registerLayout('filetree', kity.createClass({
return
box
;
return
box
;
});
});
var
nodeContentBox
=
node
.
getContentBox
();
var
nodeContentBox
=
node
.
getContentBox
();
node
.
setLayoutVector
(
new
kity
.
Vector
(
nodeContentBox
.
left
+
6
,
nodeContentBox
.
bottom
));
var
i
,
x
,
y
,
child
,
childTreeBox
,
childContentBox
;
var
i
,
x
,
y
,
child
,
childTreeBox
,
childContentBox
;
var
transform
=
new
kity
.
Matrix
();
var
transform
=
new
kity
.
Matrix
();
y
=
nodeContentBox
.
bottom
+
node
.
getStyle
(
'margin-bottom'
);
y
=
nodeContentBox
.
bottom
+
node
.
getStyle
(
'margin-bottom'
);
...
@@ -41,7 +42,6 @@ KityMinder.registerLayout('filetree', kity.createClass({
...
@@ -41,7 +42,6 @@ KityMinder.registerLayout('filetree', kity.createClass({
y
+=
child
.
getStyle
(
'margin-top'
);
y
+=
child
.
getStyle
(
'margin-top'
);
child
.
setLayoutTransform
(
new
kity
.
Matrix
().
translate
(
x
,
y
));
child
.
setLayoutTransform
(
new
kity
.
Matrix
().
translate
(
x
,
y
));
y
+=
childTreeBox
.
height
+
children
[
i
].
getStyle
(
'margin-bottom'
);
y
+=
childTreeBox
.
height
+
children
[
i
].
getStyle
(
'margin-bottom'
);
child
.
setLayoutVector
(
new
kity
.
Vector
(
childContentBox
.
left
+
6
,
childContentBox
.
bottom
));
}
}
}
}
},
},
...
...
src/module/dragtree.js
View file @
6e17b170
...
@@ -316,6 +316,9 @@ var TreeDragger = kity.createClass('TreeDragger', {
...
@@ -316,6 +316,9 @@ var TreeDragger = kity.createClass('TreeDragger', {
_renderOrderHint
:
function
(
hint
)
{
_renderOrderHint
:
function
(
hint
)
{
this
.
_orderHinter
.
render
(
hint
);
this
.
_orderHinter
.
render
(
hint
);
},
preventDragMove
:
function
(){
this
.
_startPosition
=
null
;
}
}
});
});
...
@@ -340,6 +343,11 @@ KityMinder.registerModule('DragTree', function() {
...
@@ -340,6 +343,11 @@ KityMinder.registerModule('DragTree', function() {
dragger
.
dragEnd
(
e
.
getPosition
(
this
.
getRenderContainer
()));
dragger
.
dragEnd
(
e
.
getPosition
(
this
.
getRenderContainer
()));
e
.
stopPropagation
();
e
.
stopPropagation
();
this
.
fire
(
'contentchange'
);
this
.
fire
(
'contentchange'
);
},
'statuschange'
:
function
(
e
){
if
(
e
.
lastStatus
==
'textedit'
&&
e
.
currentStatus
==
'normal'
){
dragger
.
preventDragMove
();
}
}
}
},
},
commands
:
{
commands
:
{
...
...
src/module/editor.js
View file @
6e17b170
...
@@ -40,7 +40,6 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -40,7 +40,6 @@ KityMinder.registerModule('TextEditModule', function() {
'events'
:
{
'events'
:
{
'ready'
:
function
()
{
'ready'
:
function
()
{
this
.
_renderTarget
.
appendChild
(
receiver
.
container
);
this
.
_renderTarget
.
appendChild
(
receiver
.
container
);
this
.
getRenderContainer
().
addShape
(
sel
);
},
},
'normal.beforemousedown textedit.beforemousedown inputready.beforemousedown'
:
function
(
e
)
{
'normal.beforemousedown textedit.beforemousedown inputready.beforemousedown'
:
function
(
e
)
{
...
@@ -73,7 +72,6 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -73,7 +72,6 @@ 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
())
{
sel
.
collapse
();
sel
.
collapse
();
...
@@ -182,6 +180,8 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -182,6 +180,8 @@ KityMinder.registerModule('TextEditModule', function() {
inputStatusReady
(
e
.
getTargetNode
());
inputStatusReady
(
e
.
getTargetNode
());
km
.
setStatus
(
'textedit'
);
receiver
.
updateSelectionShow
();
receiver
.
updateSelectionShow
();
},
},
// 'restoreScene': function() {
// 'restoreScene': function() {
...
@@ -226,7 +226,7 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -226,7 +226,7 @@ KityMinder.registerModule('TextEditModule', function() {
};
};
if
(
cmds
[
e
.
commandName
])
{
if
(
cmds
[
e
.
commandName
])
{
inputStatusReady
(
km
.
getSelectedNode
());
inputStatusReady
(
km
.
getSelectedNode
());
selectionReadyShow
=
true
;
receiver
.
updateSelectionShow
()
;
return
;
return
;
}
}
...
@@ -236,18 +236,11 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -236,18 +236,11 @@ KityMinder.registerModule('TextEditModule', function() {
this
.
setStatus
(
'normal'
);
this
.
setStatus
(
'normal'
);
}
}
},
},
'layout
apply
'
:
function
(
e
){
'layout
finish
'
:
function
(
e
){
if
(
e
.
node
===
receiver
.
minderNode
&&
(
this
.
getStatus
()
==
'textedit'
||
this
.
getStatus
()
==
'inputready'
)
)
{
//&& selectionReadyShow
if
(
e
.
node
===
receiver
.
minderNode
&&
(
this
.
getStatus
()
==
'textedit'
||
this
.
getStatus
()
==
'inputready'
)
)
{
//&& selectionReadyShow
receiver
receiver
.
setBaseOffset
()
.
setBaseOffset
()
.
setContainerStyle
()
.
setContainerStyle
();
.
updateTextOffsetData
();
if
(
sel
.
collapsed
)
{
receiver
.
updateSelection
();
}
else
{
receiver
.
updateSelectionShow
();
}
}
}
},
},
...
...
src/module/editor.receiver.js
View file @
6e17b170
...
@@ -61,16 +61,14 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -61,16 +61,14 @@ Minder.Receiver = kity.createClass('Receiver', {
getTextShapeHeight
:
function
()
{
getTextShapeHeight
:
function
()
{
return
this
.
textShape
.
getRenderBox
().
height
;
return
this
.
textShape
.
getRenderBox
().
height
;
},
},
appendTextShapeToPaper
:
function
(
paper
)
{
paper
.
addShape
(
this
.
textShape
);
return
this
;
},
setKityMinder
:
function
(
km
)
{
setKityMinder
:
function
(
km
)
{
this
.
km
=
km
;
this
.
km
=
km
;
return
this
;
return
this
;
},
},
setMinderNode
:
function
(
node
)
{
setMinderNode
:
function
(
node
)
{
this
.
minderNode
=
node
;
this
.
minderNode
=
node
;
//追加selection到节点
this
.
_addSelection
();
//更新minderNode下的textshape
//更新minderNode下的textshape
this
.
setTextShape
(
node
.
getTextShape
());
this
.
setTextShape
(
node
.
getTextShape
());
//更新textshape的baseOffset
//更新textshape的baseOffset
...
@@ -86,6 +84,10 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -86,6 +84,10 @@ Minder.Receiver = kity.createClass('Receiver', {
return
this
;
return
this
;
},
},
_addSelection
:
function
(){
if
(
this
.
selection
.
container
)
this
.
selection
.
remove
();
this
.
minderNode
.
getRenderContainer
().
addShape
(
this
.
selection
);
},
getMinderNode
:
function
(){
getMinderNode
:
function
(){
return
this
.
minderNode
;
return
this
.
minderNode
;
},
},
...
@@ -119,7 +121,7 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -119,7 +121,7 @@ Minder.Receiver = kity.createClass('Receiver', {
me
.
minderNode
.
render
();
me
.
minderNode
.
render
();
clearTimeout
(
me
.
inputTextTimer
);
clearTimeout
(
me
.
inputTextTimer
);
me
.
inputTextTimer
=
setTimeout
(
function
(){
me
.
inputTextTimer
=
setTimeout
(
function
(){
me
.
km
.
layout
();
me
.
km
.
layout
(
300
);
},
250
);
},
250
);
me
.
textShape
=
me
.
minderNode
.
getRenderer
(
'TextRenderer'
).
getRenderShape
();
me
.
textShape
=
me
.
minderNode
.
getRenderer
(
'TextRenderer'
).
getRenderShape
();
...
@@ -314,8 +316,8 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -314,8 +316,8 @@ Minder.Receiver = kity.createClass('Receiver', {
}
}
this
.
textData
.
push
({
this
.
textData
.
push
({
x
:
box
.
x
+
this
.
offset
.
x
,
x
:
box
.
x
,
y
:
this
.
offset
.
y
,
y
:
box
.
y
,
width
:
box
.
width
,
width
:
box
.
width
,
height
:
box
.
height
height
:
box
.
height
});
});
...
@@ -326,6 +328,8 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -326,6 +328,8 @@ Minder.Receiver = kity.createClass('Receiver', {
var
me
=
this
;
var
me
=
this
;
this
.
getTextOffsetData
();
this
.
getTextOffsetData
();
var
hadChanged
=
false
;
var
hadChanged
=
false
;
//要剪掉基数
this
.
_getRelativeValue
(
offset
);
utils
.
each
(
this
.
textData
,
function
(
i
,
v
)
{
utils
.
each
(
this
.
textData
,
function
(
i
,
v
)
{
//点击开始之前
//点击开始之前
if
(
i
===
0
&&
offset
.
x
<=
v
.
x
)
{
if
(
i
===
0
&&
offset
.
x
<=
v
.
x
)
{
...
@@ -356,9 +360,13 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -356,9 +360,13 @@ Minder.Receiver = kity.createClass('Receiver', {
this
.
selection
.
setHeight
(
this
.
getTextShapeHeight
());
this
.
selection
.
setHeight
(
this
.
getTextShapeHeight
());
return
this
;
return
this
;
},
},
_getRelativeValue
:
function
(
offset
){
offset
.
x
=
offset
.
x
-
this
.
offset
.
x
;
offset
.
y
=
offset
.
y
-
this
.
offset
.
y
;
},
updateSelectionByMousePosition
:
function
(
offset
,
dir
)
{
updateSelectionByMousePosition
:
function
(
offset
,
dir
)
{
//要剪掉基数
this
.
_getRelativeValue
(
offset
);
var
me
=
this
;
var
me
=
this
;
utils
.
each
(
this
.
textData
,
function
(
i
,
v
)
{
utils
.
each
(
this
.
textData
,
function
(
i
,
v
)
{
//点击开始之前
//点击开始之前
...
@@ -435,7 +443,7 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -435,7 +443,7 @@ Minder.Receiver = kity.createClass('Receiver', {
return
this
;
return
this
;
},
},
updateContainerRangeBySel
:
function
(){
updateContainerRangeBySel
:
function
(){
this
.
updateRange
(
this
.
range
)
this
.
updateRange
(
this
.
range
)
;
},
},
setIndex
:
function
(
index
)
{
setIndex
:
function
(
index
)
{
this
.
index
=
index
;
this
.
index
=
index
;
...
...
src/module/editor.selection.js
View file @
6e17b170
...
@@ -15,7 +15,7 @@ Minder.Selection = kity.createClass( 'Selection', {
...
@@ -15,7 +15,7 @@ Minder.Selection = kity.createClass( 'Selection', {
this
.
setOpacity
(
0.5
);
this
.
setOpacity
(
0.5
);
this
.
setStyle
(
'cursor'
,
'text'
);
this
.
setStyle
(
'cursor'
,
'text'
);
this
.
_show
=
false
;
this
.
_show
=
false
;
this
.
selectionShowStatus
=
true
;
},
},
collapse
:
function
(
toEnd
){
collapse
:
function
(
toEnd
){
...
@@ -121,19 +121,5 @@ Minder.Selection = kity.createClass( 'Selection', {
...
@@ -121,19 +121,5 @@ Minder.Selection = kity.createClass( 'Selection', {
},
},
isHide
:
function
(){
isHide
:
function
(){
return
!
this
.
_show
;
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
src/theme/bottom.js
View file @
6e17b170
...
@@ -14,7 +14,7 @@ KityMinder.registerTheme('bottom', {
...
@@ -14,7 +14,7 @@ KityMinder.registerTheme('bottom', {
'main-font-size'
:
16
,
'main-font-size'
:
16
,
'main-padding'
:
[
6
,
20
],
'main-padding'
:
[
6
,
20
],
'main-margin'
:
[
30
,
0
,
10
,
0
],
'main-margin'
:
[
30
,
0
,
10
,
0
],
'main-radius'
:
10
,
'main-radius'
:
5
,
'main-space'
:
5
,
'main-space'
:
5
,
'sub-color'
:
'white'
,
'sub-color'
:
'white'
,
...
...
src/theme/filetree.js
View file @
6e17b170
...
@@ -14,7 +14,7 @@ KityMinder.registerTheme('filetree', {
...
@@ -14,7 +14,7 @@ KityMinder.registerTheme('filetree', {
'main-font-size'
:
16
,
'main-font-size'
:
16
,
'main-padding'
:
[
6
,
20
],
'main-padding'
:
[
6
,
20
],
'main-margin'
:
[
15
,
15
,
15
,
10
],
'main-margin'
:
[
15
,
15
,
15
,
10
],
'main-radius'
:
1
0
,
'main-radius'
:
0
,
'main-space'
:
5
,
'main-space'
:
5
,
'sub-color'
:
'black'
,
'sub-color'
:
'black'
,
...
@@ -23,7 +23,7 @@ KityMinder.registerTheme('filetree', {
...
@@ -23,7 +23,7 @@ KityMinder.registerTheme('filetree', {
'sub-font-size'
:
12
,
'sub-font-size'
:
12
,
'sub-padding'
:
[
5
,
10
],
'sub-padding'
:
[
5
,
10
],
'sub-margin'
:
[
15
,
15
,
15
,
10
],
'sub-margin'
:
[
15
,
15
,
15
,
10
],
'sub-radius'
:
5
,
'sub-radius'
:
0
,
'sub-space'
:
5
,
'sub-space'
:
5
,
'connect-color'
:
'white'
,
'connect-color'
:
'white'
,
...
...
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