Commit a0e1fc36 authored by techird's avatar techird

dev

parent bc465b0b
...@@ -26,10 +26,10 @@ $dependency = Array( ...@@ -26,10 +26,10 @@ $dependency = Array(
$content = ""; $content = "";
header('Content-Type: text/javascript; charset=utf-8');
foreach ($dependency as $index => $dep) { foreach ($dependency as $index => $dep) {
if( $_GET['join'] != null) { if( $_GET['join'] != null) {
header('Content-Type: text/javascript; charset=utf-8');
echo file_get_contents("../$dep")."\n\n"; echo file_get_contents("../$dep")."\n\n";
} else { } else {
echo "document.write('<script charset=utf-8 src=\"../$dep\"></script>');"; echo "document.write('<script charset=utf-8 src=\"../$dep\"></script>');";
......
...@@ -16,10 +16,6 @@ kity.extendClass( Minder, { ...@@ -16,10 +16,6 @@ kity.extendClass( Minder, {
node.traverse( function ( current ) { node.traverse( function ( current ) {
rc.removeShape( current.getRenderContainer() ); rc.removeShape( current.getRenderContainer() );
} ); } );
},
update: function ( node ) {
return this;
} }
} ); } );
\ No newline at end of file
...@@ -150,14 +150,14 @@ var ConnectModule = KityMinder.registerModule( "ConnectModule", function () { ...@@ -150,14 +150,14 @@ var ConnectModule = KityMinder.registerModule( "ConnectModule", function () {
return false; return false;
} else { } else {
var parent = curnode.getParent(); var parent = curnode.getParent();
var connectExist = curnode.getData( "connect" ); var connectExist = curnode._connect;
if ( connectExist ) { if ( connectExist ) {
connectExist.updateConnection(); connectExist.updateConnection();
} else { } else {
var _connect = new ConnectBezier( parent.getRenderContainer(), curnode.getRenderContainer() ); var _connect = new ConnectBezier( parent.getRenderContainer(), curnode.getRenderContainer() );
var nodeD = curnode.getData( "style" ); var nodeD = curnode.getData( "style" );
_connect.stroke( new kity.Pen( nodeD.stroke, nodeD.strokeWidth ) ); _connect.stroke( new kity.Pen( nodeD.stroke, nodeD.strokeWidth ) );
curnode.setData( "connect", _connect ); curnode._connect = _connect;
minder.getRenderContainer().addShape( _connect ); minder.getRenderContainer().addShape( _connect );
} }
} }
...@@ -172,7 +172,7 @@ var ConnectModule = KityMinder.registerModule( "ConnectModule", function () { ...@@ -172,7 +172,7 @@ var ConnectModule = KityMinder.registerModule( "ConnectModule", function () {
} }
function removeConnect( node ) { function removeConnect( node ) {
var connect = node.getData( "connect" ); var connect = node._connect;
if ( connect && connect.remove ) { if ( connect && connect.remove ) {
connect.remove(); connect.remove();
} }
......
...@@ -38,12 +38,12 @@ KityMinder.registerModule( "KeyboardModule", function () { ...@@ -38,12 +38,12 @@ KityMinder.registerModule( "KeyboardModule", function () {
}; };
} }
} }
find.node.setData( 'nearestNodes', { find.node._nearestNodes = {
right: most[ 1 ] && most[ 1 ].node || null, right: most[ 1 ] && most[ 1 ].node || null,
top: most[ 2 ] && most[ 2 ].node || null, top: most[ 2 ] && most[ 2 ].node || null,
left: most[ 3 ] && most[ 3 ].node || null, left: most[ 3 ] && most[ 3 ].node || null,
down: most[ 4 ] && most[ 4 ].node || null down: most[ 4 ] && most[ 4 ].node || null
} ); };
} }
function findMinDepthNode( nodes ) { function findMinDepthNode( nodes ) {
...@@ -64,9 +64,9 @@ KityMinder.registerModule( "KeyboardModule", function () { ...@@ -64,9 +64,9 @@ KityMinder.registerModule( "KeyboardModule", function () {
base: Command, base: Command,
execute: function ( km, type, referNode ) { execute: function ( km, type, referNode ) {
var node = this.createdNode = km.execCommand( 'create' + type + 'node', referNode ); var node = this.createdNode = km.execCommand( 'create' + type + 'node', referNode );
km.execCommand( 'editText', node );
km.selectSingle( node ); km.selectSingle( node );
km.execCommand( 'rendernode', [ referNode, node ] ); km.execCommand( 'editText', node );
km.execCommand( 'rendernode', referNode );
this.setContentChanged( true ); this.setContentChanged( true );
}, },
...@@ -78,7 +78,7 @@ KityMinder.registerModule( "KeyboardModule", function () { ...@@ -78,7 +78,7 @@ KityMinder.registerModule( "KeyboardModule", function () {
var KBNavigateCommand = kity.createClass( { var KBNavigateCommand = kity.createClass( {
base: Command, base: Command,
execute: function ( km, direction, referNode ) { execute: function ( km, direction, referNode ) {
var nextNode = referNode.getData( 'nearestNodes' )[ direction ]; var nextNode = referNode._nearestNodes[ direction ];
if ( nextNode ) { if ( nextNode ) {
km.toggleSelect( [ referNode, nextNode ] ); km.toggleSelect( [ referNode, nextNode ] );
km.execCommand( 'rendernode', [ referNode, nextNode ] ); km.execCommand( 'rendernode', [ referNode, nextNode ] );
...@@ -127,7 +127,6 @@ KityMinder.registerModule( "KeyboardModule", function () { ...@@ -127,7 +127,6 @@ KityMinder.registerModule( "KeyboardModule", function () {
var sNodes = this.getSelectedNodes(), var sNodes = this.getSelectedNodes(),
isSingleSelected = sNodes.length === 1, isSingleSelected = sNodes.length === 1,
isRootSelected = this.isNodeSelected( this.getRoot() ); isRootSelected = this.isNodeSelected( this.getRoot() );
console.log( e.originEvent.keyCode );
e.originEvent.preventDefault(); e.originEvent.preventDefault();
switch ( e.originEvent.keyCode ) { switch ( e.originEvent.keyCode ) {
......
...@@ -42,7 +42,6 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -42,7 +42,6 @@ KityMinder.registerModule( "LayoutModule", function () {
return { return {
base: Command, base: Command,
execute: function ( km, sibling ) { execute: function ( km, sibling ) {
console.log( sibling );
var parent = sibling.getParent(); var parent = sibling.getParent();
if ( parent ) { if ( parent ) {
return createChildNode( km, parent ); return createChildNode( km, parent );
......
...@@ -20,6 +20,12 @@ KityMinder.registerModule( "MouseModule", function () { ...@@ -20,6 +20,12 @@ KityMinder.registerModule( "MouseModule", function () {
mousedown: function ( e ) { mousedown: function ( e ) {
var clickNode = e.getTargetNode(); var clickNode = e.getTargetNode();
this.execCommand( 'selectsingle', clickNode ); this.execCommand( 'selectsingle', clickNode );
if ( +new Date() - this._lastMousedownTime < 300 ) {
if ( clickNode ) {
this.execCommand( 'edittext', clickNode );
}
}
this._lastMousedownTime = +new Date();
} }
} }
}; };
......
KityMinder.registerModule( "TextEditModule", function () { KityMinder.registerModule( "TextEditModule", function () {
var EditTextCommand = kity.createClass( 'EditTextCommand', {
base: Command,
execute: function ( km, node ) {
node.setData( 'text', prompt( 'input the text:' ) );
km.execCommand( 'rendernode', node );
}
} );
return { return {
"commands": { "commands": {
'edittext': EditTextCommand
}, },
"events": { "events": {
......
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