Commit a0e1fc36 authored by techird's avatar techird

dev

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