Commit 1cb8fe62 authored by campaign's avatar campaign

Merge remote-tracking branch 'origin/dev' into dev

Conflicts:
	import.js
parents 6c6eede3 33e58298
...@@ -10,16 +10,16 @@ KM.registerToolbarUI( 'switchlayout', function ( name ) { ...@@ -10,16 +10,16 @@ KM.registerToolbarUI( 'switchlayout', function ( name ) {
itemStyles: [], itemStyles: [],
value: me.getLayoutStyleItems(), value: me.getLayoutStyleItems(),
autowidthitem: [], autowidthitem: [],
enabledRecord:false enabledRecord: false
}, },
$combox = null; $combox = null;
if ( options.items.length == 0 ) { if ( options.items.length == 0 ) {
return null; return null;
} }
utils.each(options.items,function(i,item){ utils.each( options.items, function ( i, item ) {
options.items[i] = me.getLang('layout')[item]; options.items[ i ] = me.getLang( 'layout' )[ item ];
}); } );
//实例化 //实例化
$combox = $.kmuibuttoncombobox( options ).css( 'zIndex', me.getOptions( 'zIndex' ) + 1 ); $combox = $.kmuibuttoncombobox( options ).css( 'zIndex', me.getOptions( 'zIndex' ) + 1 );
var comboboxWidget = $combox.kmui(); var comboboxWidget = $combox.kmui();
...@@ -49,18 +49,18 @@ KM.registerToolbarUI( 'switchlayout', function ( name ) { ...@@ -49,18 +49,18 @@ KM.registerToolbarUI( 'switchlayout', function ( name ) {
} ); } );
var data = []; var data = [];
utils.each(me.getLayoutStyleItems(),function(i,v){ utils.each( me.getLayoutStyleItems(), function ( i, v ) {
data.push({ data.push( {
label:me.getLang( 'tooltips.' + name ) + ' ' + v, label: me.getLang( 'tooltips.' + name ) + ' ' + v,
cmdName:'switchlayout', cmdName: 'switchlayout',
exec:function(){ exec: function () {
me.execCommand('switchlayout',v); me.execCommand( 'switchlayout', v );
} }
}) } )
}); } );
data.push({ data.push( {
divider:1 divider: 1
}); } );
me.addContextmenu(data); me.addContextmenu( data );
return comboboxWidget.button().addClass( 'kmui-combobox' ); return comboboxWidget.button().addClass( 'kmui-combobox' );
} ); } );
\ No newline at end of file
...@@ -4,6 +4,7 @@ KM.registerToolbarUI( 'hand zoom-in zoom-out expand contract', ...@@ -4,6 +4,7 @@ KM.registerToolbarUI( 'hand zoom-in zoom-out expand contract',
var $btn = $.kmuibutton( { var $btn = $.kmuibutton( {
icon: name, icon: name,
click: function () { click: function () {
console.log( name );
me.execCommand( name ); me.execCommand( name );
}, },
title: this.getLang( 'tooltips.' )[ name ] || '' title: this.getLang( 'tooltips.' )[ name ] || ''
......
KityMinder.registerModule( "Expand", function () {
var ExpandCommand = kity.createClass( "ExpandCommand", ( function () {
return {
base: Command,
execute: function ( km ) {
km.initStyle( true );
},
queryState: function ( km ) {
return 0;
}
};
} )() );
var ContractCommand = kity.createClass( "ContractCommand", ( function () {
return {
base: Command,
execute: function ( km ) {
km.initStyle();
},
queryState: function ( km ) {
return 0;
}
};
} )() );
return {
'commands': {
'expand': ExpandCommand,
'contract': ContractCommand
}
};
} );
\ No newline at end of file
...@@ -423,7 +423,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -423,7 +423,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
if ( nodeType !== "root" && node.getChildren().length !== 0 ) { if ( nodeType !== "root" && node.getChildren().length !== 0 ) {
if ( !Layout.shicon ) { if ( !Layout.shicon ) {
Layout.shicon = new ShIcon( node ); Layout.shicon = new ShIcon( node );
if ( node.getData( 'expand' ) ) { if ( Layout.expand ) {
Layout.shicon.switchState(); Layout.shicon.switchState();
} }
} }
...@@ -506,7 +506,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -506,7 +506,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
this.highlightNode( node ) this.highlightNode( node )
} }
}, },
initStyle: function () { initStyle: function ( expandall ) {
var _root = minder.getRoot(); var _root = minder.getRoot();
var historyPoint = _root.getPoint(); var historyPoint = _root.getPoint();
if ( historyPoint ) historyPoint = JSON.parse( JSON.stringify( historyPoint ) ); if ( historyPoint ) historyPoint = JSON.parse( JSON.stringify( historyPoint ) );
...@@ -553,8 +553,8 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -553,8 +553,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
return items; return items;
} )(); } )();
next = []; next = [];
var layer_nolimit = ( expand_layer < 1 ) || false; var layer_nolimit = expandall || ( expand_layer < 1 ) || false;
var sub_nolimit = ( expandoptions.defaultSubShow < 1 ) || false; var sub_nolimit = expandall || ( expandoptions.defaultSubShow < 1 ) || false;
var loopcontinue = function () { var loopcontinue = function () {
return ( layer_nolimit ? ( _buffer.length !== 0 ) : ( _buffer.length !== 0 && cur_layer < expand_layer ) ); return ( layer_nolimit ? ( _buffer.length !== 0 ) : ( _buffer.length !== 0 && cur_layer < expand_layer ) );
}; };
...@@ -573,17 +573,17 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -573,17 +573,17 @@ KityMinder.registerModule( "LayoutDefault", function () {
_root.setPoint( _root.getLayout().x, _root.getLayout().y ); _root.setPoint( _root.getLayout().x, _root.getLayout().y );
}, },
appendChildNode: function ( parent, node, focus, sibling ) { appendChildNode: function ( parent, node, focus, sibling ) {
if ( parent.getType() !== "root" && parent.getChildren().length !== 0 && parent.getData( "expand" ) === false ) { if ( parent.getType() !== "root" && parent.getChildren().length !== 0 && parent.getLayout().expand === false ) {
minder.expandNode( parent ); minder.expandNode( parent );
} }
minder.handelNodeInsert( node ); minder.handelNodeInsert( node );
node.clearLayout(); node.clearLayout();
node.getContRc().clear(); node.getContRc().clear();
node.setData( 'expand', false ); var Layout = node.getLayout();
Layout.expand = false;
if ( parent.getType() !== 'root' ) { if ( parent.getType() !== 'root' ) {
parent.setData( 'expand', true ); parent.getLayout().expand = true;
} }
var Layout = node.getLayout();
Layout.added = true; Layout.added = true;
var parentLayout = parent.getLayout(); var parentLayout = parent.getLayout();
var children = parent.getChildren(); var children = parent.getChildren();
...@@ -739,7 +739,8 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -739,7 +739,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
isExpand = ico.icon.switchState(); isExpand = ico.icon.switchState();
node = ico.icon._node; node = ico.icon._node;
} }
node.setData( "expand", isExpand ); var Layout = node.getLayout();
Layout.expand = isExpand;
var _buffer = node.getChildren(); var _buffer = node.getChildren();
if ( isExpand ) { if ( isExpand ) {
for ( var j = 0; j < _buffer.length; j++ ) { for ( var j = 0; j < _buffer.length; j++ ) {
......
...@@ -32,7 +32,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -32,7 +32,7 @@ KityMinder.registerModule( "LayoutModule", function () {
var curStyle = this.getCurrentStyle(); var curStyle = this.getCurrentStyle();
this.getLayoutStyle( curStyle ).highlightNode.call( this, node ); this.getLayoutStyle( curStyle ).highlightNode.call( this, node );
}, },
initStyle: function () { initStyle: function ( expandall ) {
var curStyle = this.getCurrentStyle(); var curStyle = this.getCurrentStyle();
this._rc.remove(); this._rc.remove();
this._rc = new kity.Group(); this._rc = new kity.Group();
...@@ -42,7 +42,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -42,7 +42,7 @@ KityMinder.registerModule( "LayoutModule", function () {
_root.preTraverse( function ( n ) { _root.preTraverse( function ( n ) {
n.clearLayout(); n.clearLayout();
} ); } );
this.getLayoutStyle( curStyle ).initStyle.call( this ); this.getLayoutStyle( curStyle ).initStyle.call( this, expandall );
this.fire( 'afterinitstyle' ); this.fire( 'afterinitstyle' );
}, },
appendChildNode: function ( parent, node, focus, index ) { appendChildNode: function ( parent, node, focus, index ) {
...@@ -213,9 +213,9 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -213,9 +213,9 @@ KityMinder.registerModule( "LayoutModule", function () {
return 0; return 0;
} }
}, },
isNeedUndo: function () { isNeedUndo: function () {
return false; return false;
} }
}; };
} )() ); } )() );
...@@ -246,7 +246,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -246,7 +246,7 @@ KityMinder.registerModule( "LayoutModule", function () {
}.bind( this ), 100 ); }.bind( this ), 100 );
}, },
"import": function ( e ) { "import": function ( e ) {
this.initStyle( this.getRoot() ); this.initStyle();
} }
}, },
'contextmenu': [ { 'contextmenu': [ {
......
themes/default/images/contract.png

1.11 KB | W: | H:

themes/default/images/contract.png

2.93 KB | W: | H:

themes/default/images/contract.png
themes/default/images/contract.png
themes/default/images/contract.png
themes/default/images/contract.png
  • 2-up
  • Swipe
  • Onion skin
themes/default/images/expand.png

3.28 KB | W: | H:

themes/default/images/expand.png

2.98 KB | W: | H:

themes/default/images/expand.png
themes/default/images/expand.png
themes/default/images/expand.png
themes/default/images/expand.png
  • 2-up
  • Swipe
  • Onion skin
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