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
ae81c95e
Commit
ae81c95e
authored
Dec 20, 2013
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev
parent
6fbd73c8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
72 deletions
+81
-72
dev.html
demo/dev.html
+1
-1
kityminder.js
src/core/kityminder.js
+2
-2
render.js
src/module/render.js
+78
-69
No files found.
demo/dev.html
View file @
ae81c95e
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<script
src=
"../kity/dist/kitygraph.all.js"
></script>
<script
src=
"../kity/dist/kitygraph.all.js"
></script>
<script
src=
"../dist/dev.php"
></script>
<script
src=
"../dist/dev.php"
></script>
</head>
</head>
<body>
<body
style=
"background:#262626"
>
</body>
</body>
<script>
<script>
...
...
src/core/kityminder.js
View file @
ae81c95e
...
@@ -164,7 +164,7 @@ kity.extendClass( KityMinder, {
...
@@ -164,7 +164,7 @@ kity.extendClass( KityMinder, {
},
},
update
:
function
(
node
)
{
update
:
function
(
node
)
{
this
.
execCommand
(
'render'
,
node
);
this
.
execCommand
(
'render
root
'
,
node
);
return
this
;
return
this
;
}
}
}
);
}
);
...
@@ -186,7 +186,7 @@ kity.extendClass( KityMinder, {
...
@@ -186,7 +186,7 @@ kity.extendClass( KityMinder, {
var
listen
=
function
(
name
,
callback
)
{
var
listen
=
function
(
name
,
callback
)
{
if
(
window
.
addEventListener
)
{
if
(
window
.
addEventListener
)
{
window
.
addEventListener
(
name
,
callback
);
window
.
addEventListener
(
name
,
callback
);
}
else
if
(
window
.
attachEvent
)
{
}
else
if
(
window
.
attachEvent
)
{
window
.
attachEvent
(
name
,
callback
);
window
.
attachEvent
(
name
,
callback
);
}
}
};
};
...
...
src/module/render.js
View file @
ae81c95e
KityMinder
.
registerModule
(
"RenderModule"
,
(
function
()
{
KityMinder
.
registerModule
(
"RenderModule"
,
function
()
{
var
RenderRootCommand
=
kity
.
createClass
(
"RenderRootCommand"
,
(
function
()
{
var
RenderRootCommand
=
kity
.
createClass
(
"RenderRootCommand"
,
(
function
()
{
var
node_default
=
{
var
node_default
=
{
x
:
0
,
x
:
0
,
y
:
0
,
y
:
0
,
radius
:
5
,
radius
:
5
,
text
:
"Root"
,
text
:
"Root"
,
fill
:
"#7ecef4"
,
fill
:
"#7ecef4"
,
stroke
:
"white"
stroke
:
"white"
,
};
padding
:
5
var
drawRectNode
=
function
(
kR
,
node
)
{
};
if
(
!
node
)
{
var
drawRectNode
=
function
(
node
)
{
node
=
node_default
;
if
(
!
node
)
{
}
node
=
node_default
;
var
_rect
=
new
kity
.
Rect
();
}
_rect
.
setRadius
(
node
.
radius
);
var
_node
=
new
kity
.
Group
();
return
_rect
;
var
_rect
=
new
kity
.
Rect
();
};
var
_text
=
new
kity
.
Text
(
node
.
text
);
return
{
_rect
base
:
Command
,
.
setRadius
(
node
.
radius
)
execute
:
function
(
km
,
node
)
{
.
setSize
(
100
,
100
)
var
kR
=
km
.
getRenderContainer
();
.
setPosition
(
20
,
20
)
var
_root
=
km
.
getRoot
()
||
new
MinderNode
();
.
fill
(
node
.
fill
)
var
shape
=
new
kity
.
Group
();
.
stroke
(
node
.
stroke
);
var
_rect
=
drawRectNode
(
node
);
_node
.
addItems
(
[
_rect
,
_text
]
);
shape
.
addShape
(
_rect
,
"background"
);
return
_node
;
}
};
};
return
{
}
)()
);
base
:
Command
,
execute
:
function
(
km
,
node
)
{
var
kR
=
km
.
getRenderContainer
();
var
_root
=
km
.
getRoot
()
||
new
MinderNode
();
var
_node
=
drawRectNode
(
node
);
console
.
log
(
_node
);
kR
.
addShape
(
_node
,
"background"
);
}
};
}
)()
);
// var DrawShapeCommand = kity.createClass( "DrawShapeCommand", {
// var DrawShapeCommand = kity.createClass( "DrawShapeCommand", {
// base: Command,
// base: Command,
// execute: function ( km, node ) {
// execute: function ( km, node ) {
// var dR = km.getRenderContainer();
// var dR = km.getRenderContainer();
// node = node || km.getRoot();
// node = node || km.getRoot();
// km.traverse( node, function ( current ) {
// km.traverse( node, function ( current ) {
// var rc = current.getRenderContainer();
// var rc = current.getRenderContainer();
// var x = current.getData( 'x' ) || 0,
// var x = current.getData( 'x' ) || 0,
// y = current.getData( 'y' ) || 0;
// y = current.getData( 'y' ) || 0;
// rc.setTransform( new kity.Matrix().translate( x, y ) );
// rc.setTransform( new kity.Matrix().translate( x, y ) );
// if ( !rc.rect ) {
// if ( !rc.rect ) {
// rc.rect = new kity.Rect();
// rc.rect = new kity.Rect();
// rc.addShape( rc.rect );
// rc.addShape( rc.rect );
// rc.rect.fill( '#eee' );
// rc.rect.fill( '#eee' );
// rc.rect.setRadius( 5 );
// rc.rect.setRadius( 5 );
// }
// }
// if ( !rc.text ) {
// if ( !rc.text ) {
// rc.text = new kity.Text();
// rc.text = new kity.Text();
// rc.addShape( rc.text );
// rc.addShape( rc.text );
// }
// }
// rc.text.setContent( current.getData( 'text' ) || '' );
// rc.text.setContent( current.getData( 'text' ) || '' );
// var box = rc.text.getRenderBox();
// var box = rc.text.getRenderBox();
// rc.rect.setPosition( box.x - 5, box.y - 5 );
// rc.rect.setPosition( box.x - 5, box.y - 5 );
// rc.rect.setSize( box.width + 10, box.height + 10 );
// rc.rect.setSize( box.width + 10, box.height + 10 );
// } );
// } );
// }
// }
// } );
// } );
return
{
return
{
"commands"
:
{
"commands"
:
{
//todo:command字典,name-action 键值对模式编写
//todo:command字典,name-action 键值对模式编写
"renderroot"
:
RenderRootCommand
"renderroot"
:
RenderRootCommand
},
},
"events"
:
{
"events"
:
{
//todo:事件响应函数绑定列表,事件名-响应函数 键值对模式编写
//todo:事件响应函数绑定列表,事件名-响应函数 键值对模式编写
"click"
:
function
(
e
)
{
"click"
:
function
(
e
)
{
},
},
"keydown keyup"
:
function
(
e
)
{
"keydown keyup"
:
function
(
e
)
{
}
}
}
};
}
}
);
};
\ No newline at end of file
}
);
\ 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