Commit 22de9999 authored by campaign's avatar campaign

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

parents 02bf7378 bd296802
...@@ -55,7 +55,7 @@ utils.extend( KityMinder, function () { ...@@ -55,7 +55,7 @@ utils.extend( KityMinder, function () {
this._createToolbar( containers.$toolbar, km ); this._createToolbar( containers.$toolbar, km );
this._createStatusbar( containers.$statusbar, km ); this._createStatusbar( containers.$statusbar, km );
km.$container = containers.$container; km.$container = containers.$container;
return km; return km.fire( 'interactchange' );
}, },
registerWidget: function ( name, pro, cb ) { registerWidget: function ( name, pro, cb ) {
_widgetData[ name ] = $.extend2( pro, { _widgetData[ name ] = $.extend2( pro, {
...@@ -116,4 +116,4 @@ utils.extend( KityMinder, function () { ...@@ -116,4 +116,4 @@ utils.extend( KityMinder, function () {
_activeWidget = $widget; _activeWidget = $widget;
} }
} }
}() ); }() );
\ No newline at end of file
...@@ -10,7 +10,7 @@ Utils.extend( KityMinder, { ...@@ -10,7 +10,7 @@ Utils.extend( KityMinder, {
return Utils.keys( KityMinder._protocals ); return Utils.keys( KityMinder._protocals );
}, },
getAllRegisteredProtocals: function () { getAllRegisteredProtocals: function () {
return KityMinder._protocals return KityMinder._protocals;
} }
} ); } );
......
var Grid = kity.createClass( 'Grid', {
base: kity.Rect,
constructor: function ( x, y, width, height, gridSize, color1, color2 ) {
this.color1 = color1 || 'white';
this.color2 = color2 || 'lightgray';
this.gridSize = gridSize;
this.callBase( width, height, x, y );
this.draw();
},
draw: function () {
var me = this;
function lazyDraw() {
var paper = me.getPaper();
if ( !paper ) {
return setTimeout( lazyDraw, 100 );
}
var size = me.gridSize;
me.fill( new kity.PatternBrush().pipe( function () {
this.setX( 0 ).setY( 0 );
this.setWidth( size * 2 ).setHeight( size * 2 );
this.addShape( new kity.Rect( size, size ).fill( me.color1 ) );
this.addShape( new kity.Rect( size, size, size, size ).fill( me.color1 ) );
paper.addResource( this );
} ) ).setOpacity( 0 ).fadeIn( 500, 'ease' );
}
lazyDraw();
}
} );
KityMinder.registerModule( 'Background', function () {
function initBackground() {
var start = kity.Color.createHSL( 200, 8, 30 );
var end = start.dec( 'l', 5 );
var paper = this.getPaper();
var grid = new Grid( -50000, -50000, 100000, 100000, 2, start, end );
paper.addShape( grid );
grid.bringBack();
paper.setStyle( 'background', end.toString() );
}
function resetBackground() {
}
return {
events: {
'ready': initBackground,
'resize': resetBackground
}
};
} );
\ 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