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
e24ff46d
Commit
e24ff46d
authored
Jun 19, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev
parent
c08d830a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
50 deletions
+42
-50
layout.js
src/core/layout.js
+6
-3
minder.data.js
src/core/minder.data.js
+21
-24
editor.js
src/module/editor.js
+9
-21
expand.js
src/module/expand.js
+5
-1
font.js
src/module/font.js
+1
-1
No files found.
src/core/layout.js
View file @
e24ff46d
...
...
@@ -149,9 +149,12 @@ kity.extendClass(Minder, {
function
layoutNode
(
node
)
{
// layout all children first
node
.
children
.
forEach
(
function
(
child
)
{
layoutNode
(
child
);
});
// 剪枝:收起的节点无需计算
if
(
node
.
isExpanded
())
{
node
.
children
.
forEach
(
function
(
child
)
{
layoutNode
(
child
);
});
}
var
layout
=
node
.
getLayoutInstance
();
layout
.
doLayout
(
node
);
...
...
src/core/minder.data.js
View file @
e24ff46d
...
...
@@ -38,6 +38,7 @@ var DEFAULT_TEXT = {
function
importNode
(
node
,
json
,
km
)
{
var
data
=
json
.
data
;
node
.
data
=
{};
for
(
var
field
in
data
)
{
node
.
setData
(
field
,
data
[
field
]);
}
...
...
@@ -105,9 +106,10 @@ kity.extendClass(Minder, {
json
=
params
.
json
||
(
params
.
json
=
protocal
.
decode
(
local
));
if
(
typeof
json
===
'object'
&&
'then'
in
json
){
if
(
typeof
json
===
'object'
&&
'then'
in
json
)
{
var
self
=
this
;
json
.
then
(
local
,
function
(
data
)
{
params
.
json
=
data
;
self
.
_doImport
(
data
,
params
);
});
}
else
{
...
...
@@ -117,32 +119,27 @@ kity.extendClass(Minder, {
},
_doImport
:
function
(
json
,
params
)
{
try
{
this
.
_fire
(
new
MinderEvent
(
'preimport'
,
params
,
false
));
this
.
_fire
(
new
MinderEvent
(
'preimport'
,
params
,
false
));
// 删除当前所有节点
while
(
this
.
_root
.
getChildren
().
length
)
{
this
.
removeNode
(
this
.
_root
.
getChildren
()[
0
]);
}
// 删除当前所有节点
while
(
this
.
_root
.
getChildren
().
length
)
{
this
.
removeNode
(
this
.
_root
.
getChildren
()[
0
]);
}
importNode
(
this
.
_root
,
json
,
this
);
this
.
_root
.
preTraverse
(
function
(
node
)
{
node
.
render
();
});
this
.
_root
.
layout
();
importNode
(
this
.
_root
,
json
,
this
);
this
.
fire
(
'beforeimport'
,
params
);
this
.
fire
(
'import'
,
params
);
this
.
_root
.
preTraverse
(
function
(
node
)
{
node
.
render
();
});
this
.
_root
.
layout
();
this
.
_firePharse
({
type
:
'contentchange'
});
this
.
_firePharse
({
type
:
'interactchange'
});
}
catch
(
e
){
this
.
fire
(
'rendererror'
);
}
}
this
.
fire
(
'import'
,
params
);
this
.
_firePharse
({
type
:
'contentchange'
});
this
.
_firePharse
({
type
:
'interactchange'
});
}
});
\ No newline at end of file
src/module/editor.js
View file @
e24ff46d
...
...
@@ -75,7 +75,7 @@ KityMinder.registerModule('TextEditModule', function() {
if
(
node
)
{
var
textShape
=
node
.
getRenderer
(
'TextRenderer'
).
getRenderShape
();
textShape
.
setStyle
(
'cursor'
,
'default'
);
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
// && e.kityEvent.targetShape.getType().toLowerCase()== 'text'
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
sel
.
collapse
();
sel
.
setSelectionShowStatus
(
true
);
...
...
@@ -111,10 +111,14 @@ KityMinder.registerModule('TextEditModule', function() {
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
var
orgEvt
=
e
.
originEvent
,
keyCode
=
orgEvt
.
keyCode
;
if
(
!
keymap
.
notContentInput
[
keyCode
]
&&
range
.
nativeSel
.
rangeCount
!==
0
&&
!
orgEvt
.
ctrlKey
&&
!
orgEvt
.
metaKey
&&
!
orgEvt
.
shiftKey
&&
!
orgEvt
.
altKey
)
{
if
(
!
keymap
.
notContentInput
[
keyCode
]
&&
range
.
nativeSel
.
rangeCount
!==
0
&&
!
orgEvt
.
ctrlKey
&&
!
orgEvt
.
metaKey
&&
!
orgEvt
.
shiftKey
&&
!
orgEvt
.
altKey
)
{
var
nativeRange
=
range
.
nativeSel
.
getRangeAt
(
0
);
if
(
nativeRange
&&
(
nativeRange
.
startContainer
===
receiver
.
container
||
receiver
.
container
.
contains
(
nativeRange
.
startContainer
)))
{
if
(
nativeRange
&&
(
nativeRange
.
startContainer
===
receiver
.
container
||
receiver
.
container
.
contains
(
nativeRange
.
startContainer
)))
{
km
.
setStatus
(
'textedit'
);
sel
.
setSelectionShowStatus
(
true
);
km
.
fire
(
'saveScene'
);
...
...
@@ -326,29 +330,13 @@ KityMinder.registerModule('TextEditModule', function() {
}
// if ((e.commandName == 'priority' || e.commandName == 'progress') && this.getStatus() == 'textedit') {
//
// sel.setHide();
// receiver.setBaseOffset()
// .getTextOffsetData();
////
//// if (sel.collapsed) {
//// receiver.updateSelection();
//// } else {
//// receiver.updateSelectionShow(1);
//// }
//
// return;
//
//
// }
receiver
.
clear
().
setTextEditStatus
(
false
);
if
(
this
.
getStatus
()
==
'textedit'
)
{
this
.
setStatus
(
'normal'
);
}
},
'layoutfinish'
:
function
(
e
){
if
(
e
.
node
===
receiver
.
minderNode
&&
this
.
getStatus
()
==
'textedit'
)
{
'layoutfinish'
:
function
(
e
)
{
if
(
e
.
node
===
receiver
.
minderNode
&&
this
.
getStatus
()
==
'textedit'
)
{
receiver
.
setBaseOffset
()
.
setContainerStyle
()
...
...
src/module/expand.js
View file @
e24ff46d
...
...
@@ -149,10 +149,11 @@ KityMinder.registerModule('Expand', function() {
this
.
addShapes
([
this
.
outline
,
this
.
sign
]);
this
.
initEvent
(
node
);
this
.
setId
(
KityMinder
.
uuid
(
'node_expander'
));
this
.
setStyle
(
'cursor'
,
'pointer'
);
},
initEvent
:
function
(
node
)
{
this
.
on
(
'
click
'
,
function
(
e
)
{
this
.
on
(
'
mousedown
'
,
function
(
e
)
{
if
(
node
.
isExpanded
())
{
node
.
collapse
();
}
else
{
...
...
@@ -225,6 +226,9 @@ KityMinder.registerModule('Expand', function() {
'layoutapply'
:
function
(
e
)
{
var
r
=
e
.
node
.
getRenderer
(
'ExpanderRenderer'
);
r
.
update
(
r
.
getRenderShape
(),
e
.
node
);
},
'preimport'
:
function
(
e
)
{
var
json
=
e
.
json
;
}
},
renderers
:
{
...
...
src/module/font.js
View file @
e24ff46d
...
...
@@ -7,7 +7,7 @@ KityMinder.registerModule("fontmodule", function() {
var
dataColor
=
node
.
getData
(
'color'
);
var
selectedColor
=
node
.
getStyle
(
'selected-color'
);
var
styleColor
=
node
.
getStyle
(
'color'
);
text
.
fill
(
dataColor
||
(
node
.
isSelected
()
?
selectedColor
:
styleColor
));
text
.
fill
(
dataColor
||
(
node
.
isSelected
()
&&
selectedColor
?
selectedColor
:
styleColor
));
text
.
setFont
({
family
:
getNodeDataOrStyle
(
node
,
'font-family'
),
size
:
getNodeDataOrStyle
(
node
,
'font-size'
)
...
...
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