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
0718e9b6
Commit
0718e9b6
authored
Dec 20, 2013
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deleted extra files
parent
901b665d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
56 deletions
+26
-56
kityminder.js
src/core/kityminder.js
+2
-22
render.js
src/module/render.js
+24
-2
index.html
testcase/index.html
+0
-32
No files found.
src/core/kityminder.js
View file @
0718e9b6
...
...
@@ -167,28 +167,8 @@ kity.extendClass( KityMinder, {
},
update
:
function
(
node
)
{
node
=
node
||
this
.
_root
;
this
.
traverse
(
node
,
function
(
current
)
{
var
rc
=
current
.
getRenderContainer
();
var
x
=
current
.
getData
(
'x'
)
||
0
,
y
=
current
.
getData
(
'y'
)
||
0
;
rc
.
setTransform
(
new
kity
.
Matrix
().
translate
(
x
,
y
)
);
if
(
!
rc
.
rect
)
{
rc
.
rect
=
new
kity
.
Rect
();
rc
.
addShape
(
rc
.
rect
);
rc
.
rect
.
fill
(
'#eee'
);
rc
.
rect
.
setRadius
(
5
);
}
if
(
!
rc
.
text
)
{
rc
.
text
=
new
kity
.
Text
();
rc
.
addShape
(
rc
.
text
);
}
rc
.
text
.
setContent
(
current
.
getData
(
'text'
)
||
''
);
var
box
=
rc
.
text
.
getRenderBox
();
rc
.
rect
.
setPosition
(
box
.
x
-
5
,
box
.
y
-
5
);
rc
.
rect
.
setSize
(
box
.
width
+
10
,
box
.
height
+
10
);
}
);
this
.
execCommand
(
'render'
,
node
);
return
this
;
}
}
);
...
...
src/module/render.js
View file @
0718e9b6
...
...
@@ -2,15 +2,37 @@ KityMinder.registerModule( "RenderModule", function () {
var
DrawShapeCommand
=
kity
.
createClass
(
"DrawShapeCommand"
,
{
base
:
Command
,
execute
:
function
(
km
,
config
)
{
execute
:
function
(
km
,
node
)
{
var
dR
=
km
.
getRenderContainer
();
node
=
node
||
km
.
getRoot
();
km
.
traverse
(
node
,
function
(
current
)
{
var
rc
=
current
.
getRenderContainer
();
var
x
=
current
.
getData
(
'x'
)
||
0
,
y
=
current
.
getData
(
'y'
)
||
0
;
rc
.
setTransform
(
new
kity
.
Matrix
().
translate
(
x
,
y
)
);
if
(
!
rc
.
rect
)
{
rc
.
rect
=
new
kity
.
Rect
();
rc
.
addShape
(
rc
.
rect
);
rc
.
rect
.
fill
(
'#eee'
);
rc
.
rect
.
setRadius
(
5
);
}
if
(
!
rc
.
text
)
{
rc
.
text
=
new
kity
.
Text
();
rc
.
addShape
(
rc
.
text
);
}
rc
.
text
.
setContent
(
current
.
getData
(
'text'
)
||
''
);
var
box
=
rc
.
text
.
getRenderBox
();
rc
.
rect
.
setPosition
(
box
.
x
-
5
,
box
.
y
-
5
);
rc
.
rect
.
setSize
(
box
.
width
+
10
,
box
.
height
+
10
);
}
);
}
}
);
return
{
"commands"
:
{
//todo:command字典,name-action 键值对模式编写
"
drawrect
"
:
DrawShapeCommand
"
render
"
:
DrawShapeCommand
},
"events"
:
{
...
...
testcase/index.html
deleted
100644 → 0
View file @
901b665d
<!DOCTYPE html>
<html>
<head>
<title>
KM Loader
</title>
<style>
body
,
div
,
html
{
margin
:
0
;
padding
:
0
;
overflow
:
hidden
;
}
</style>
</head>
<body>
</body>
<script
src=
"../kity/dist/kitygraph.all.js"
></script>
<script
src=
"../src/core/command.js"
></script>
<script
src=
"../minder_module/module.test.js"
></script>
<script
src=
"../minder_module/module.default.test.js"
></script>
<script
src=
"../src/core/km.js"
></script>
<script
src=
"../src/core/minderevent.js"
></script>
<script
src=
"../src/core/mindernode.js"
></script>
<script
src=
"../src/core/kityminder.js"
></script>
<script>
KityMinder
.
registerModule
(
"test"
,
mindermoduleTest
);
KityMinder
.
registerModule
(
"defaulttest"
,
mindermoduleDefaultTest
);
var
myMinder
=
new
KityMinder
();
myMinder
.
execCommand
(
"testCommand"
,
"test1"
,
function
(){
alert
(
a
)},{
a
:
1
,
b
:
2
});
myMinder
.
execCommand
(
"testCommand1"
);
console
.
log
(
myMinder
.
queryCommandState
(
"testCommand"
));
console
.
log
(
myMinder
.
queryCommandValue
(
"testCommand"
));
</script>
</html>
\ 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