Commit 3cb3e8bc authored by Akikonata's avatar Akikonata

dev

parent 94ba87d1
......@@ -9,8 +9,8 @@
</body>
<script>
minder = new km.KityMinder(null,{
modules:["test","test1","test2"]
minder = new KityMinder.Minder(null,{
modules:["ExampleModule"]
});
minder.importData({
......@@ -40,6 +40,6 @@
}]
}]
});
minder.execCommand( 'rendertree', node );
minder.execCommand( 'renderroot' );
</script>
</html>
\ No newline at end of file
......@@ -3,9 +3,16 @@
$dependency = Array(
'src/core/km.js',
'src/core/command.js',
'src/core/mindernode.js',
'src/core/minderevent.js',
'src/core/kityminder.js',
'src/core/node.js',
'src/core/module.js',
'src/core/event.js',
'src/core/minder.js',
'src/core/minder.data.js',
'src/core/minder.event.js',
'src/core/minder.module.js',
'src/core/minder.command.js',
'src/core/minder.node.js',
'src/core/minder.select.js',
'src/module/connect.js',
'src/module/history.js',
'src/module/icon.js',
......
......@@ -21,8 +21,10 @@ kity.extendClass( Minder, {
},
execCommand: function ( name ) {
var me = this;
var _commands = this._commands;
var _action = new _commands[ name.toLowerCase() ]();
var _action = this._getCommand( name );
if ( !_action ) {
return false;
}
var cmdArgs = Array.prototype.slice.call( arguments, 1 );
......
// 导入导出
kity.extendClass( KityMinder, {
kity.extendClass( Minder, {
exportData: function ( node ) {
var exported = {};
node = node || this.getRoot();
......
// 事件机制
kity.extendClass( KityMinder, {
kity.extendClass( Minder, {
_initEvents: function () {
this._eventCallbacks = {};
this._bindPaperEvents();
......
......@@ -3,7 +3,7 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
// 初始化
this._initMinder( id, option || {} );
this._initEvents();
this._initModules();
this._initModules( option );
},
_initMinder: function ( id, option ) {
......
// 模块声明周期维护
kity.extendClass( Minder, {
_initModules: function () {
_initModules: function ( option ) {
this._commands = {};
this._query = {};
var _modules = Minder.getModules();
var _modules = KityMinder.getModules();
var _modulesList = ( function () {
var _list = [];
for ( var key in _modules ) {
_list.push( key );
}
} )();
var _configModules = this.option.modules || _modulesList;
var _configModules = option.modules || _modulesList;
if ( _modules ) {
var me = this;
for ( var i = 0; i < _configModules.length; i++ ) {
......
// 选区管理
kity.extendClass( KityMinder, {
kity.extendClass( Minder, {
getSelectedNodes: function () {
return this._selectedNodes || ( this._selectedNodes = [] );
},
......
var MinderEvent = kity.createClass( 'MindEvent', {
constructor: function ( type, params, cancelable ) {
params = params || {};
if ( params.getType && params.getType() == 'ShapeEvent' ) {
this.kityEvent = params;
this.getPosition = params.getPosition.bind( params );
} else {
kity.Utils.extend( this, params );
}
this.type = type;
this._cancelable = cancelable || false;
if ( params.targetShape ) {
this.getTargetNode = function () {
var findShape = params.targetShape;
while ( !findShape.minderNode && findShape.container ) {
findShape = findShape.container;
}
return findShape.minderNode || null;
};
}
},
cancel: function () {
this._canceled = true;
},
cancelImmediately: function () {
this._immediatelyCanceld = true;
this._canceled = true;
},
shouldCancel: function () {
return this._cancelable && this._canceled;
},
shouldCancelImmediately: function () {
return this._cancelable && this._immediatelyCanceld;
}
} );
\ No newline at end of file
var MinderNode = km.MinderNode = kity.createClass( "MinderNode", {
var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
constructor: function ( treeNotifyHandler ) {
this.parent = null;
this.children = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment