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