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
8cf56d08
Commit
8cf56d08
authored
Feb 07, 2014
by
campaign
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/kitygraph/kityminder
into dev
parents
970939ec
0537e3e0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
20 deletions
+22
-20
minder.js
src/core/minder.js
+1
-2
layout.default.js
src/module/layout.default.js
+21
-18
No files found.
src/core/minder.js
View file @
8cf56d08
/**
/* @require <kityminder.js>
* @require <kityminder.js>
* @require <module.js>
* @require <module.js>
* @require <event.js>
* @require <event.js>
* @require <node.js>
* @require <node.js>
...
...
src/module/layout.default.js
View file @
8cf56d08
...
@@ -64,18 +64,18 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -64,18 +64,18 @@ KityMinder.registerModule( "LayoutDefault", function () {
return
{
return
{
constructor
:
function
(
node
)
{
constructor
:
function
(
node
)
{
this
.
_node
=
node
;
this
.
_node
=
node
;
var
container
=
node
.
getRenderContainer
();
var
bgRC
=
node
.
getBgRc
();
var
txt
=
this
.
_txt
=
new
kity
.
Text
();
var
contRC
=
node
.
getContRc
();
var
rect
=
this
.
_rect
=
new
kity
.
Rect
();
var
rect
=
this
.
_rect
=
new
kity
.
Rect
();
var
shicon
=
this
.
_shicon
=
new
ShIcon
(
node
);
var
shicon
=
this
.
_shicon
=
new
ShIcon
(
node
);
container
.
addShapes
(
[
rect
,
txt
]
);
bgRC
.
addShape
(
rect
);
var
connect
=
this
.
_connect
=
new
kity
.
Group
();
var
connect
=
this
.
_connect
=
new
kity
.
Group
();
var
bezier
=
connect
.
bezier
=
new
kity
.
Bezier
();
var
bezier
=
connect
.
bezier
=
new
kity
.
Bezier
();
var
circle
=
connect
.
circle
=
new
kity
.
Circle
();
var
circle
=
connect
.
circle
=
new
kity
.
Circle
();
connect
.
addShapes
(
[
bezier
,
circle
]
);
connect
.
addShapes
(
[
bezier
,
circle
]
);
minder
.
getRenderContainer
().
addShape
(
connect
).
bringTop
(
minder
.
getRoot
().
getRenderContainer
()
);
minder
.
getRenderContainer
().
addShape
(
connect
).
bringTop
(
minder
.
getRoot
().
getRenderContainer
()
);
var
Layout
=
{
var
Layout
=
{
radius
:
0
,
radius
:
5
,
fill
:
"white"
,
fill
:
"white"
,
color
:
"black"
,
color
:
"black"
,
padding
:
[
5.5
,
20
,
5.5
,
20
],
padding
:
[
5.5
,
20
,
5.5
,
20
],
...
@@ -86,19 +86,20 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -86,19 +86,20 @@ KityMinder.registerModule( "LayoutDefault", function () {
appendside
:
node
.
getData
(
"layout"
).
appendside
appendside
:
node
.
getData
(
"layout"
).
appendside
};
};
node
.
setData
(
"layout"
,
Layout
);
node
.
setData
(
"layout"
,
Layout
);
txt
.
translate
(
Layout
.
padding
[
3
],
Layout
.
padding
[
0
]
+
15
);
contRC
.
translate
(
Layout
.
padding
[
3
],
Layout
.
padding
[
0
]
+
15
);
this
.
update
();
this
.
update
();
},
},
update
:
function
()
{
update
:
function
()
{
var
txt
=
this
.
_txt
;
var
rect
=
this
.
_rect
;
var
rect
=
this
.
_rect
;
var
node
=
this
.
_node
;
var
node
=
this
.
_node
;
var
txt
=
node
.
getTextShape
();
var
contRC
=
node
.
getContRc
();
var
Layout
=
node
.
getData
(
"layout"
);
var
Layout
=
node
.
getData
(
"layout"
);
txt
.
setContent
(
node
.
getData
(
"text"
)
).
fill
(
Layout
.
color
);
txt
.
setContent
(
node
.
getData
(
"text"
)
).
fill
(
Layout
.
color
);
var
_
txtWidth
=
txt
.
getWidth
();
var
_
contRCWidth
=
contRC
.
getWidth
();
var
_
txtHeight
=
txt
.
getHeight
();
var
_
contRCHeight
=
contRC
.
getHeight
();
var
_rectWidth
=
_
txt
Width
+
Layout
.
padding
[
1
]
+
Layout
.
padding
[
3
];
var
_rectWidth
=
_
contRC
Width
+
Layout
.
padding
[
1
]
+
Layout
.
padding
[
3
];
var
_rectHeight
=
_
txt
Height
+
Layout
.
padding
[
0
]
+
Layout
.
padding
[
2
];
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
);
rect
.
setWidth
(
_rectWidth
).
setHeight
(
_rectHeight
).
fill
(
node
.
getData
(
"highlight"
)
?
"chocolate"
:
Layout
.
fill
).
setRadius
(
Layout
.
radius
);
this
.
updateConnect
();
this
.
updateConnect
();
this
.
updateShIcon
();
this
.
updateShIcon
();
...
@@ -131,7 +132,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -131,7 +132,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
this
.
_shicon
.
update
();
this
.
_shicon
.
update
();
},
},
clear
:
function
()
{
clear
:
function
()
{
this
.
_node
.
get
RenderContainer
().
clear
();
this
.
_node
.
get
BgRc
().
clear
();
this
.
_connect
.
remove
();
this
.
_connect
.
remove
();
this
.
_shicon
.
remove
();
this
.
_shicon
.
remove
();
}
}
...
@@ -142,12 +143,12 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -142,12 +143,12 @@ KityMinder.registerModule( "LayoutDefault", function () {
return
{
return
{
constructor
:
function
(
node
)
{
constructor
:
function
(
node
)
{
this
.
_node
=
node
;
this
.
_node
=
node
;
var
container
=
node
.
getRenderContainer
();
var
bgRC
=
node
.
getBgRc
();
var
txt
=
this
.
_txt
=
new
kity
.
Text
();
var
contRC
=
node
.
getContRc
();
var
underline
=
this
.
_underline
=
new
kity
.
Path
();
var
underline
=
this
.
_underline
=
new
kity
.
Path
();
var
shicon
=
this
.
_shicon
=
new
ShIcon
(
node
);
var
shicon
=
this
.
_shicon
=
new
ShIcon
(
node
);
var
highlightshape
=
this
.
_highlightshape
=
new
kity
.
Rect
();
var
highlightshape
=
this
.
_highlightshape
=
new
kity
.
Rect
();
container
.
addShapes
(
[
highlightshape
,
underline
,
txt
]
);
bgRC
.
addShapes
(
[
highlightshape
,
underline
]
);
var
connect
=
this
.
_connect
=
new
kity
.
Path
();
var
connect
=
this
.
_connect
=
new
kity
.
Path
();
minder
.
getRenderContainer
().
addShape
(
connect
).
bringTop
(
minder
.
getRoot
().
getRenderContainer
()
);
minder
.
getRenderContainer
().
addShape
(
connect
).
bringTop
(
minder
.
getRoot
().
getRenderContainer
()
);
var
Layout
=
{
var
Layout
=
{
...
@@ -161,7 +162,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -161,7 +162,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
appendside
:
node
.
getData
(
"layout"
).
appendside
appendside
:
node
.
getData
(
"layout"
).
appendside
};
};
node
.
setData
(
"layout"
,
Layout
);
node
.
setData
(
"layout"
,
Layout
);
txt
.
translate
(
Layout
.
padding
[
3
],
Layout
.
padding
[
0
]
+
10
);
contRC
.
translate
(
Layout
.
padding
[
3
],
Layout
.
padding
[
0
]
+
10
);
highlightshape
.
fill
(
"chocolate"
).
translate
(
-
1
,
0
);
highlightshape
.
fill
(
"chocolate"
).
translate
(
-
1
,
0
);
this
.
update
();
this
.
update
();
},
},
...
@@ -170,7 +171,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -170,7 +171,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
Layout
=
node
.
getData
(
"layout"
);
var
Layout
=
node
.
getData
(
"layout"
);
var
underline
=
this
.
_underline
;
var
underline
=
this
.
_underline
;
var
highlightshape
=
this
.
_highlightshape
;
var
highlightshape
=
this
.
_highlightshape
;
var
txt
=
this
.
_txt
;
var
txt
=
node
.
getTextShape
()
;
txt
.
setContent
(
node
.
getData
(
"text"
)
).
fill
(
Layout
.
color
).
setSize
(
Layout
.
fontSize
);
txt
.
setContent
(
node
.
getData
(
"text"
)
).
fill
(
Layout
.
color
).
setSize
(
Layout
.
fontSize
);
var
_txtWidth
=
txt
.
getWidth
();
var
_txtWidth
=
txt
.
getWidth
();
var
_txtHeight
=
txt
.
getHeight
();
var
_txtHeight
=
txt
.
getHeight
();
...
@@ -223,7 +224,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -223,7 +224,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
this
.
_shicon
.
update
();
this
.
_shicon
.
update
();
},
},
clear
:
function
()
{
clear
:
function
()
{
this
.
_node
.
get
RenderContainer
().
clear
();
this
.
_node
.
get
BgRc
().
clear
();
this
.
_connect
.
remove
();
this
.
_connect
.
remove
();
this
.
_shicon
.
remove
();
this
.
_shicon
.
remove
();
}
}
...
@@ -274,7 +275,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -274,7 +275,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
rect
.
setWidth
(
_rectWidth
).
setHeight
(
_rectHeight
).
fill
(
node
.
getData
(
"highlight"
)
?
"chocolate"
:
Layout
.
fill
).
setRadius
(
Layout
.
radius
);
rect
.
setWidth
(
_rectWidth
).
setHeight
(
_rectHeight
).
fill
(
node
.
getData
(
"highlight"
)
?
"chocolate"
:
Layout
.
fill
).
setRadius
(
Layout
.
radius
);
},
},
clear
:
function
()
{
clear
:
function
()
{
this
.
_node
.
get
RenderContainer
().
clear
();
this
.
_node
.
get
BgRc
().
clear
();
}
}
};
};
}
)()
);
}
)()
);
...
@@ -549,6 +550,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -549,6 +550,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
while
(
_buffer
.
length
!==
0
)
{
while
(
_buffer
.
length
!==
0
)
{
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
[
0
].
getData
(
"layout"
).
shape
.
clear
();
_buffer
[
0
].
getData
(
"layout"
).
shape
.
clear
();
_buffer
[
0
].
getRenderContainer
().
remove
();
var
prt
=
_buffer
[
0
].
getParent
();
var
prt
=
_buffer
[
0
].
getParent
();
prt
.
removeChild
(
_buffer
[
0
]
);
prt
.
removeChild
(
_buffer
[
0
]
);
_buffer
.
shift
();
_buffer
.
shift
();
...
@@ -594,6 +596,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -594,6 +596,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
while
(
_buffer
.
length
!==
0
)
{
while
(
_buffer
.
length
!==
0
)
{
try
{
try
{
_buffer
[
0
].
getData
(
"layout"
).
shape
.
clear
();
_buffer
[
0
].
getData
(
"layout"
).
shape
.
clear
();
_buffer
[
0
].
getRenderContainer
().
remove
();
}
catch
(
error
)
{}
}
catch
(
error
)
{}
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
.
shift
();
_buffer
.
shift
();
...
...
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