Commit a69442eb authored by techird's avatar techird

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

parents d7686c1d e2ddc1f1
This diff is collapsed.
...@@ -121,7 +121,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -121,7 +121,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
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().setRadius( 4 ); var highlightshape = Layout.highlightshape = new kity.Rect().setRadius( 4 );
node.getBgRc().clear().addShapes( [ Layout.bgRect = new kity.Rect().setRadius(4), highlightshape, underline ] ); node.getBgRc().clear().addShapes( [ Layout.bgRect = new kity.Rect().setRadius( 4 ), highlightshape, underline ] );
break; break;
default: default:
break; break;
...@@ -170,7 +170,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -170,7 +170,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
Layout.highlightshape Layout.highlightshape
.setWidth( _contWidth + nodeStyle.padding[ 1 ] + nodeStyle.padding[ 3 ] ) .setWidth( _contWidth + nodeStyle.padding[ 1 ] + nodeStyle.padding[ 3 ] )
.setHeight( _contHeight + nodeStyle.padding[ 0 ] + nodeStyle.padding[ 2 ] ); .setHeight( _contHeight + nodeStyle.padding[ 0 ] + nodeStyle.padding[ 2 ] );
Layout.bgRect.setWidth(width).setHeight(height); Layout.bgRect.setWidth( width ).setHeight( height );
break; break;
default: default:
break; break;
...@@ -377,7 +377,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -377,7 +377,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
} }
} }
//更新收放icon //更新收放icon
if ( nodeType !== "root" ) { if ( nodeType !== "root" && node.getChildren().length !== 0 ) {
if ( !Layout.shicon ) { if ( !Layout.shicon ) {
Layout.shicon = new ShIcon( node ); Layout.shicon = new ShIcon( node );
} }
...@@ -475,6 +475,16 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -475,6 +475,16 @@ KityMinder.registerModule( "LayoutDefault", function () {
Layout.align = siblingLayout.align; Layout.align = siblingLayout.align;
parent.insertChild( node, sibling.getIndex() + 1 ); parent.insertChild( node, sibling.getIndex() + 1 );
if ( parent.getType() === "root" ) { if ( parent.getType() === "root" ) {
var len = parent.getChildren().length;
if ( len < 7 ) {
if ( len % 2 ) {
Layout.appendside = "right";
Layout.align = "left";
} else {
Layout.appendside = "left";
Layout.align = "right";
}
}
var sideList = parentLayout[ Layout.appendside + "List" ]; var sideList = parentLayout[ Layout.appendside + "List" ];
var idx = sideList.indexOf( sibling ); var idx = sideList.indexOf( sibling );
sideList.splice( idx + 1, 0, node ); sideList.splice( idx + 1, 0, node );
...@@ -600,7 +610,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -600,7 +610,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
} else { } else {
_buffer[ 0 ].getRenderContainer().remove(); _buffer[ 0 ].getRenderContainer().remove();
Layout.connect.remove(); Layout.connect.remove();
Layout.shicon.remove(); if ( Layout.shicon ) Layout.shicon.remove();
} }
_buffer = _buffer.concat( _buffer[ 0 ].getChildren() ); _buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
_buffer.shift(); _buffer.shift();
......
...@@ -132,7 +132,11 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -132,7 +132,11 @@ KityMinder.registerModule( "LayoutModule", function () {
base: Command, base: Command,
execute: function ( km ) { execute: function ( km ) {
var selectedNodes = km.getSelectedNodes(); var selectedNodes = km.getSelectedNodes();
if ( selectedNodes.length === 0 ) return false; var _root = km.getRoot();
if ( selectedNodes.length === 0 || ( selectedNodes.length === 1 && !selectedNodes[ 0 ].getParent() ) ) {
km.select( _root );
return false;
}
var _buffer = []; var _buffer = [];
for ( var i = 0; i < selectedNodes.length; i++ ) { for ( var i = 0; i < selectedNodes.length; i++ ) {
_buffer.push( selectedNodes[ i ] ); _buffer.push( selectedNodes[ i ] );
......
.kmui-modal-header .kmui-title{
font-size: 14px;
}
.kmui-dialog-markers-body {
padding-bottom: 5px
}
.icon-list{
margin: 0;
padding: 0
}
.icon-list li{
padding: 5px 10px;
margin: 0;
list-style: none;
cursor: pointer;
color: #333
}
.icon-list li:hover,.icon-list li.active{
background: #cfe0f7
}
.icon-list li span.icon{
display: inline-block;
width: 20px;
height: 20px;
vertical-align: middle;
margin-right: 10px;
}
\ No newline at end of file
...@@ -11,3 +11,4 @@ ...@@ -11,3 +11,4 @@
@import "tooltip.css"; @import "tooltip.css";
@import "colorpicker.css"; @import "colorpicker.css";
@import "separator.css"; @import "separator.css";
@import "markers.css";
.kmui-modal-header .kmui-title{
font-size: 14px;
}
.kmui-dialog-markers-body {
padding-bottom: 5px
}
.icon-list{
margin: 0;
padding: 0
}
.icon-list li{
padding: 5px 10px;
margin: 0;
list-style: none;
cursor: pointer;
color: #333
}
.icon-list li:hover,.icon-list li.active{
background: #cfe0f7
}
.icon-list li span.icon{
display: inline-block;
width: 20px;
height: 20px;
vertical-align: middle;
margin-right: 10px;
}
\ No newline at end of file
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