Commit 7c060bf0 authored by campaign's avatar campaign

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

parents 6475e1bc 1566b267
window.KITYMINDER_CONFIG = {
//定义工具栏
toolbars: [
'hand | undo redo | layoutstyle | bold italic | fontfamily fontsize forecolor | saveto'
'hand | undo redo | bold italic | fontfamily fontsize forecolor | saveto'
]
//设置主题
......
......@@ -16,7 +16,6 @@ $dependency = Array(
,'src/core/keymap.js'
,'src/core/minder.lang.js'
,'src/core/minder.defaultoptions.js'
,'src/module/background.js'
,'src/module/history.js'
,'src/module/icon.js'
,'src/module/layout.js'
......@@ -24,6 +23,7 @@ $dependency = Array(
,'src/module/layout.bottom.js'
,'src/core/minder.select.js'
,'src/module/draggable.js'
,'src/module/dropfile.js'
,'src/module/keyboard.js'
,'src/module/mouse.js'
,'src/module/history.js'
......
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
KityMinder.registerModule( "DropFile", function () {
function init() {
var container = this.getPaper().getContainer();
container.addEventListener( 'dragover', onDragOver );
container.addEventListener( 'drop', onDrop.bind( this ) );
}
function onDragOver( e ) {
e.preventDefault();
e.stopPropagation();
e.dataTransfer.dropEffect = 'copy';
}
function onDrop( e ) {
e.preventDefault();
e.stopPropagation();
var minder = this;
if ( e.dataTransfer.files ) {
var reader = new FileReader();
reader.onload = function () {};
var data = readFile( e.dataTransfer.files[ 0 ] );
minder.importData( data );
}
}
function readFile( e ) {
var reader = new FileReader();
return reader.readAsText();
}
return {
events: {
ready: init
}
};
} );
\ No newline at end of file
......@@ -15,7 +15,7 @@
box-shadow: 3px 3px 8px rgba(0,0,0, .5);
}
.kmui-container .kmui-editor-body{
background-color: #333;
background: rgb(50, 60, 61) url(../images/grid.png) repeat;
line-height: 0;
overflow: hidden;
}
......
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