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
ea78ac1d
Commit
ea78ac1d
authored
Feb 07, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added event
parent
7ee02295
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
37 deletions
+39
-37
node.js
src/core/node.js
+26
-24
layout.default.js
src/module/layout.default.js
+11
-11
layout.js
src/module/layout.js
+2
-2
No files found.
src/core/node.js
View file @
ea78ac1d
...
...
@@ -11,47 +11,49 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
this
.
_createShapeDom
()
},
_createShapeDom
:
function
()
{
_createShapeDom
:
function
()
{
this
.
rc
=
new
kity
.
Group
();
this
.
rc
.
addClass
(
'km-minderNode'
);
this
.
rc
.
addClass
(
'km-minderNode'
);
this
.
rc
.
minderNode
=
this
;
this
.
_createBgGroup
();
this
.
_createContGroup
();
this
.
_createTextShape
();
},
_createGroup
:
function
(
type
)
{
_createGroup
:
function
(
type
)
{
var
g
=
new
kity
.
Group
();
g
.
setData
(
'rctype'
,
type
);
this
.
rc
.
appendShape
(
g
);
g
.
setData
(
'rctype'
,
type
);
this
.
rc
.
appendShape
(
g
);
},
_createBgGroup
:
function
()
{
this
.
_createGroup
(
'bgrc'
)
_createBgGroup
:
function
()
{
this
.
_createGroup
(
'bgrc'
)
},
_createContGroup
:
function
()
{
this
.
_createGroup
(
'contrc'
)
_createContGroup
:
function
()
{
this
.
_createGroup
(
'contrc'
)
},
_createTextShape
:
function
()
{
this
.
getContRc
().
appendShape
(
new
kity
.
Text
(
this
.
getData
(
'text'
)
||
''
)
);
_createTextShape
:
function
()
{
this
.
getContRc
().
appendShape
(
new
kity
.
Text
(
this
.
getData
(
'text'
)
||
''
)
);
},
getContRc
:
function
(){
var
groups
=
this
.
rc
.
getShapesByType
(
'group'
),
result
;
utils
.
each
(
groups
,
function
(
i
,
p
){
if
(
p
.
getData
(
'rctype'
)
==
'contrc'
){
getContRc
:
function
()
{
var
groups
=
this
.
rc
.
getShapesByType
(
'group'
),
result
;
utils
.
each
(
groups
,
function
(
i
,
p
)
{
if
(
p
.
getData
(
'rctype'
)
==
'contrc'
)
{
result
=
p
;
return
false
;
}
});
}
);
return
result
},
getBgRc
:
function
(){
var
groups
=
this
.
rc
.
getShapesByType
(
'group'
),
result
;
utils
.
each
(
groups
,
function
(
i
,
p
){
if
(
p
.
getData
(
'rctype'
)
==
'bgrc'
){
getBgRc
:
function
()
{
var
groups
=
this
.
rc
.
getShapesByType
(
'group'
),
result
;
utils
.
each
(
groups
,
function
(
i
,
p
)
{
if
(
p
.
getData
(
'rctype'
)
==
'bgrc'
)
{
result
=
p
;
return
false
;
}
});
}
);
return
result
},
setPoint
:
function
(
x
,
y
)
{
...
...
@@ -258,10 +260,10 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
return
true
;
},
getTextShape
:
function
()
{
return
this
.
getContRc
().
getShapesByType
(
'text'
)[
0
]
getTextShape
:
function
()
{
return
this
.
getContRc
().
getShapesByType
(
'text'
)[
0
]
},
isSelected
:
function
()
{
isSelected
:
function
()
{
return
this
.
getData
(
'highlight'
)
===
true
}
}
);
\ No newline at end of file
src/module/layout.default.js
View file @
ea78ac1d
...
...
@@ -233,10 +233,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
RootShape
=
kity
.
createClass
(
"DefaultRootShape"
,
(
function
()
{
return
{
constructor
:
function
(
node
)
{
var
container
=
node
.
getRenderContainer
();
var
txt
=
this
.
_txt
=
new
kity
.
Text
();
var
bgRC
=
node
.
getBgRc
();
var
contRC
=
node
.
getContRc
();
var
rect
=
this
.
_rect
=
new
kity
.
Rect
();
container
.
addShapes
(
[
rect
,
txt
]
);
bgRC
.
addShape
(
rect
);
this
.
_node
=
node
;
var
Layout
=
{
shape
:
this
,
...
...
@@ -256,20 +256,21 @@ KityMinder.registerModule( "LayoutDefault", function () {
};
node
.
setData
(
"layout"
,
Layout
);
node
.
setData
(
"text"
,
"Minder Root"
);
txt
.
translate
(
Layout
.
padding
[
3
],
Layout
.
padding
[
0
]
+
15
);
contRC
.
translate
(
Layout
.
padding
[
3
],
Layout
.
padding
[
0
]
+
15
);
this
.
update
();
},
update
:
function
()
{
var
txt
=
this
.
_txt
;
var
node
=
this
.
_node
;
var
txt
=
node
.
getTextShape
();
var
contRC
=
node
.
getContRc
();
var
rect
=
this
.
_rect
;
var
connect
=
this
.
_connect
;
var
node
=
this
.
_node
;
var
Layout
=
node
.
getData
(
"layout"
);
txt
.
setContent
(
node
.
getData
(
"text"
)
).
fill
(
Layout
.
color
);
var
_
txtWidth
=
txt
.
getWidth
();
var
_
txtHeight
=
txt
.
getHeight
();
var
_rectWidth
=
_
txt
Width
+
Layout
.
padding
[
1
]
+
Layout
.
padding
[
3
];
var
_rectHeight
=
_
txt
Height
+
Layout
.
padding
[
0
]
+
Layout
.
padding
[
2
];
var
_
contRCWidth
=
contRC
.
getWidth
();
var
_
contRCHeight
=
contRC
.
getHeight
();
var
_rectWidth
=
_
contRC
Width
+
Layout
.
padding
[
1
]
+
Layout
.
padding
[
3
];
var
_rectHeight
=
_
contRC
Height
+
Layout
.
padding
[
0
]
+
Layout
.
padding
[
2
];
rect
.
setWidth
(
_rectWidth
).
setHeight
(
_rectHeight
).
fill
(
node
.
getData
(
"highlight"
)
?
"chocolate"
:
Layout
.
fill
).
setRadius
(
Layout
.
radius
);
},
clear
:
function
()
{
...
...
@@ -548,7 +549,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
while
(
_buffer
.
length
!==
0
)
{
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
[
0
].
getData
(
"layout"
).
shape
.
clear
();
_buffer
[
0
].
handelNodeRemove
();
var
prt
=
_buffer
[
0
].
getParent
();
prt
.
removeChild
(
_buffer
[
0
]
);
_buffer
.
shift
();
...
...
src/module/layout.js
View file @
ea78ac1d
...
...
@@ -73,7 +73,7 @@ KityMinder.registerModule( "LayoutModule", function () {
_root
.
preTraverse
(
function
(
n
)
{
n
.
clearLayout
();
n
.
setPoint
();
n
.
get
RenderContainer
().
clear
();
n
.
get
BgRc
().
clear
();
}
);
km
.
setCurrentStyle
(
style
);
km
.
initStyle
();
...
...
@@ -152,7 +152,7 @@ KityMinder.registerModule( "LayoutModule", function () {
}
},
"defaultOptions"
:
{
"layoutstyle"
:
"
green
"
"layoutstyle"
:
"
default
"
}
};
}
);
\ 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