Commit 60a0ff9e authored by techird's avatar techird

ui

parent 1724ab59
Subproject commit 1140e977283ecc038ea444dd1186eb77c59510fb
Subproject commit 97750df27bf46fbb96d182a25e39768f63f7545c
......@@ -11,7 +11,7 @@
var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
constructor: function ( options ) {
this._options = Utils.extend( window.KITYMINDER_CONFIG || {}, options );
this.setDefaultOptions(KM.defaultOptions);
this.setDefaultOptions( KM.defaultOptions );
this._initEvents();
this._initMinder();
this._initSelection();
......@@ -34,16 +34,37 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
},
_initMinder: function () {
this._rc = new kity.Group();
this._paper = new kity.Paper();
this._paper.addShape( this._rc );
this._paper.getNode().setAttribute( 'contenteditable', true );
this._addBackground();
this._addRenderContainer();
this._root = new MinderNode( "Main Topic" );
this._root.setType( "root" );
if ( this._options.renderTo ) {
this.renderTo( this._options.renderTo );
}
},
_addRenderContainer: function () {
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,11 +2,12 @@ KityMinder.registerModule( "KeyboardModule", function () {
function buildPositionNetwork( root ) {
var pointIndexes = [],
x, y;
p, x, y;
root.traverse( function ( node ) {
p = node.getData( 'point' );
pointIndexes.push( {
x: node.getData( 'x' ),
y: node.getData( 'y' ),
x: p.x,
y: p.y,
node: node
} );
} );
......@@ -50,7 +51,7 @@ KityMinder.registerModule( "KeyboardModule", function () {
function navigateTo( km, direction ) {
var nextNode = km.getSelectedNode()._nearestNodes[ direction ];
if ( nextNode ) {
km.select( nextNode );
km.select( nextNode, true );
}
}
return {
......
......@@ -72,13 +72,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
//样式的配置(包括颜色、字号等)
var nodeStyles = {
"root": {
color: "white",
fill: "cadetblue",
color: kity.Color.createHSL( 200, 50, 30 ),
fill: kity.Color.createHSL( 200, 30, 80 ),
fontSize: 20,
padding: [ 10.5, 10, 10.5, 10 ],
padding: [ 10.5, 10.5, 10.5, 10.5 ],
margin: [ 0, 0, 0, 0 ],
radius: 15,
highlight: "chocolate"
radius: 20,
highlight: "lightgreen"
},
"main": {
stroke: new kity.Pen( "white", 2 ).setLineCap( "round" ).setLineJoin( "round" ),
......@@ -88,7 +88,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
fontSize: 14,
margin: [ 0, 10, 30, 50 ],
radius: 5,
highlight: "chocolate"
highlight: "yellow"
},
"sub": {
stroke: new kity.Pen( "white", 2 ).setLineCap( "round" ).setLineJoin( "round" ),
......@@ -96,7 +96,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
fontSize: 12,
margin: [ 0, 10, 20, 6 ],
padding: [ 5, 10, 5.5, 10 ],
highlight: "chocolate"
highlight: kity.Color.createHSL( 200, 50, 60 )
}
};
//更新背景
......
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