Commit 02bf7378 authored by campaign's avatar campaign

Merge branch 'dev' of https://github.com/kitygraph/kityminder into dev

parents 1854c29d 677aeef7
......@@ -16,6 +16,7 @@ $dependency = Array(
,'src/core/keymap.js'
,'src/core/minder.lang.js'
,'src/core/minder.defaultoptions.js'
,'src/module/background.js'
,'src/module/history.js'
,'src/module/icon.js'
,'src/module/layout.js'
......
......@@ -9,7 +9,7 @@ Utils.extend( KityMinder, {
getSupportedProtocals: function () {
return Utils.keys( KityMinder._protocals );
},
getAllRegisteredProtocals:function(){
getAllRegisteredProtocals: function () {
return KityMinder._protocals
}
} );
......@@ -33,6 +33,7 @@ function importNode( node, json ) {
for ( var field in data ) {
node.setData( field, data[ field ] );
}
node.setText( data.text );
var childrenTreeData = json.children;
if ( !childrenTreeData ) return;
......
......@@ -37,7 +37,6 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this._paper = new kity.Paper();
this._paper.getNode().setAttribute( 'contenteditable', true );
this._addBackground();
this._addRenderContainer();
this._root = new MinderNode( "Main Topic" );
......@@ -50,21 +49,7 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this._rc = new kity.Group();
this._paper.addShape( this._rc );
},
_addBackground: function () {
var start = kity.Color.createHSL( 200, 8, 40 );
var end = start.dec( 'l', 5 );
var _paper = this._paper;
var _bg = this._background = new kity.Ellipse( 400, 300 ).fill( new kity.RadialGradientBrush().pipe( function () {
this.addStop( 0, start );
this.addStop( 1, end );
_paper.addResource( this );
} ) );
_paper.setStyle( 'background', end.toString() );
setTimeout( function () {
_bg.translate( _paper.getNode().clientWidth / 2, _paper.getNode().clientHeight / 2 );
}, 100 );
_paper.addShape( this._background );
},
renderTo: function ( target ) {
this._paper.renderTo( this._renderTarget = target );
this._bindEvents();
......
......@@ -2,7 +2,7 @@ KityMinder.registerModule( "KeyboardModule", function () {
function buildPositionNetwork( root ) {
var pointIndexes = [],
p, x, y;
p;
root.traverse( function ( node ) {
p = node.getData( 'point' );
pointIndexes.push( {
......
......@@ -112,12 +112,15 @@ KityMinder.registerModule( "LayoutDefault", function () {
switch ( node.getType() ) {
case "root":
case "main":
node.getBgRc().clear().addShape( Layout.bgRect = new kity.Rect() );
var bg = node.getBgRc().clear();
bg.addShape( Layout.bgShadow = new kity.Rect() );
bg.addShape( Layout.bgRect = new kity.Rect() );
Layout.bgRect.fill( nodeStyle.fill ).setRadius( nodeStyle.radius );
Layout.bgShadow.fill( 'black' ).setOpacity( 0.2 ).setRadius( nodeStyle.radius ).translate( 3, 5 );
break;
case "sub":
var underline = Layout.underline = new kity.Path();
var highlightshape = Layout.highlightshape = new kity.Rect();
var highlightshape = Layout.highlightshape = new kity.Rect().setRadius( 4 );
node.getBgRc().clear().addShapes( [ highlightshape, underline ] );
break;
default:
......@@ -149,8 +152,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
switch ( nodeType ) {
case "root":
case "main":
Layout.bgRect.setWidth( _contRCWidth + nodeStyle.padding[ 1 ] + nodeStyle.padding[ 3 ] );
Layout.bgRect.setHeight( _contRCHeight + nodeStyle.padding[ 0 ] + nodeStyle.padding[ 2 ] );
var width = _contRCWidth + nodeStyle.padding[ 1 ] + nodeStyle.padding[ 3 ],
height = _contRCHeight + nodeStyle.padding[ 0 ] + nodeStyle.padding[ 2 ];
Layout.bgRect.setWidth( width ).setHeight( height );
Layout.bgShadow.setWidth( width ).setHeight( height );
break;
case "sub":
var _contWidth = contRc.getWidth();
......
......@@ -170,6 +170,9 @@ KityMinder.registerModule( "LayoutModule", function () {
this._lastStyleResetTimeout = setTimeout( function () {
this.updateLayout( this.getRoot() );
}.bind( this ), 100 );
},
"import": function ( e ) {
this.initStyle( this.getRoot() );
}
},
"defaultOptions": {
......
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