Commit c5603e4c authored by techird's avatar techird

Merge branch 'dev' into gh-pages

parents d0599807 3de023b6
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
"KITYMINDER_CONFIG", "KITYMINDER_CONFIG",
"keymap", "keymap",
"Utils", "Utils",
"utils" "utils",
"$",
"KM",
"keymap"
] ]
} }
\ No newline at end of file
window.KITYMINDER_CONFIG = { (function(){
//定义工具栏 function getKMBasePath ( docUrl, confUrl ) {
toolbars: [
'hand | undo redo | bold italic | fontfamily fontsize forecolor | saveto'
]
//设置主题 return getBasePath( docUrl || self.document.URL || self.location.href, confUrl || getConfigFilePath() );
//,defaultlayoutstyle : 'default' //设置默认的主题
//,layoutstyle : [] //添加有那些主图
//回退相关选项 }
//,maxUndoCount:20 //最大可回退的次数,默认20
//语言默认是zh-cn function getConfigFilePath () {
//,lang:'zh-cn'
//设置km整体的z-index大小 var configPath = document.getElementsByTagName('script');
//,zIndex : 1000
return configPath[ configPath.length -1 ].src;
}; }
\ No newline at end of file
function getBasePath ( docUrl, confUrl ) {
var basePath = confUrl;
if(/^(\/|\\\\)/.test(confUrl)){
basePath = /^.+?\w(\/|\\\\)/.exec(docUrl)[0] + confUrl.replace(/^(\/|\\\\)/,'');
}else if ( !/^[a-z]+:/i.test( confUrl ) ) {
docUrl = docUrl.split( "#" )[0].split( "?" )[0].replace( /[^\\\/]+$/, '' );
basePath = docUrl + "" + confUrl;
}
return optimizationPath( basePath );
}
function optimizationPath ( path ) {
var protocol = /^[a-z]+:\/\//.exec( path )[ 0 ],
tmp = null,
res = [];
path = path.replace( protocol, "" ).split( "?" )[0].split( "#" )[0];
path = path.replace( /\\/g, '/').split( /\// );
path[ path.length - 1 ] = "";
while ( path.length ) {
if ( ( tmp = path.shift() ) === ".." ) {
res.pop();
} else if ( tmp !== "." ) {
res.push( tmp );
}
}
return protocol + res.join( "/" );
}
window.KITYMINDER_CONFIG = {
'KITYMINDER_HOME_URL': getKMBasePath(),
//定义工具栏
toolbars: [
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers'
]
//设置主题
//,defaultlayoutstyle : 'default' //设置默认的主题
//,layoutstyle : [] //添加有那些主图
//回退相关选项
//,maxUndoCount:20 //最大可回退的次数,默认20
//语言默认是zh-cn
//,lang:'zh-cn'
//设置km整体的z-index大小
//,zIndex : 1000
};
})()
( function () {
var utils = KM.utils;
KM.registerWidget( 'markers', {
tpl: "<ul class='icon-list'>" +
"<li value='1' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) 0 0'></span><span><%= priority %>1</span></li>" +
"<li value='2' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) -20px 0'></span><span><%= priority %>2</span></li>" +
"<li value='3' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) -40px 0'></span><span><%= priority %>3</span></li>" +
"<li value='4' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) -60px 0'></span><span><%= priority %>4</span></li>" +
"<li value='5' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) -80px 0'></span><span><%= priority %>5</span></li>" +
"</ul>" +
"<ul class='icon-list'>" +
"<li value='1' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) 0 0'></span><span><%= progress.notdone %></span></li>" +
"<li value='2' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) -20px 0'></span><span><%= progress.quarterdone %></span></li>" +
"<li value='3' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) -40px 0'></span><span><%= progress.halfdone %></span></li>" +
"<li value='4' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) -60px 0'></span><span><%= progress.threequartersdone %></span></li>" +
"<li value='5' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) -80px 0'></span><span><%= progress.done %></span></li>" +
"</ul>",
initContent: function ( km ) {
var lang = km.getLang( 'dialogs.markers' );
if ( lang ) {
var html = $.parseTmpl( this.tpl, lang );
}
this.root().html( html );
},
initEvent: function ( km, $w ) {
$w.on( "click", "li", function () {
var $this = $( this );
$this.siblings().removeClass( "active" );
$this.toggleClass( "active" );
var val = $this.val();
if ( !$this.hasClass( "active" ) ) {
val = null;
}
var type = $this.attr( "type" );
km.execCommand( type, val );
} );
km.on( 'interactchange', function ( e ) {
var valPri = this.queryCommandValue( "priority" );
var valPro = this.queryCommandValue( "progress" );
$w.find( "li[type='priority']" ).removeClass( "active" );
$w.find( "li[type='priority'][value='" + valPri + "']" ).addClass( "active" );
$w.find( "li[type='progress']" ).removeClass( "active" );
$w.find( "li[type='progress'][value='" + valPro + "']" ).addClass( "active" );
} );
},
buttons: {
'ok': {
exec: function ( km, $w ) {
var href = $( '#kmui-link-Jhref' ).val().replace( /^\s+|\s+$/g, '' );
if ( href ) {
km.execCommand( 'link', {
'href': href,
'target': $( "#kmui-link-Jtarget:checked" ).length ? "_blank" : '_self',
'title': $( "#kmui-link-Jtitle" ).val().replace( /^\s+|\s+$/g, '' ),
'_href': href
} );
}
}
},
'cancel': {}
},
width: 200,
} )
} )();
\ No newline at end of file
...@@ -23,7 +23,7 @@ $dependency = Array( ...@@ -23,7 +23,7 @@ $dependency = Array(
,'src/module/layout.default.js' ,'src/module/layout.default.js'
,'src/module/layout.bottom.js' ,'src/module/layout.bottom.js'
,'src/core/minder.select.js' ,'src/core/minder.select.js'
,'src/module/dragview.js' ,'src/module/hand.js'
,'src/module/dragtree.js' ,'src/module/dragtree.js'
,'src/module/dropfile.js' ,'src/module/dropfile.js'
,'src/module/keyboard.js' ,'src/module/keyboard.js'
...@@ -36,6 +36,7 @@ $dependency = Array( ...@@ -36,6 +36,7 @@ $dependency = Array(
,'src/module/basestyle.js' ,'src/module/basestyle.js'
,'src/module/font.js' ,'src/module/font.js'
,'src/module/zoom.js' ,'src/module/zoom.js'
,'src/ui/jquery-ui-1.10.4.custom.min.js'
,'src/ui/widget.js' ,'src/ui/widget.js'
,'src/ui/button.js' ,'src/ui/button.js'
,'src/ui/toolbar.js' ,'src/ui/toolbar.js'
...@@ -58,7 +59,9 @@ $dependency = Array( ...@@ -58,7 +59,9 @@ $dependency = Array(
,'src/adapter/button.js' ,'src/adapter/button.js'
,'src/adapter/combobox.js' ,'src/adapter/combobox.js'
,'src/adapter/saveto.js' ,'src/adapter/saveto.js'
,'src/adapter/hand.js' ,'src/adapter/view.js'
,'src/adapter/dialog.js'
,'src/adapter/tooltips.js'
,'src/protocal/plain.js' ,'src/protocal/plain.js'
,'src/protocal/json.js' ,'src/protocal/json.js'
); );
......
Subproject commit dd0e68ce6b5467c07d1e92ba7af16d4569232365 Subproject commit df7b361ae5098710eca0fec1080dce4bc822bf24
KityMinder.LANG[ 'zh-cn' ] = { KityMinder.LANG[ 'zh-cn' ] = {
'maintopic': '中心主题',
'topic': '分支主题',
'tooltips': { 'tooltips': {
'undo': '撤销', 'undo': '撤销',
'redo': '重做', 'redo': '重做',
...@@ -8,13 +10,34 @@ KityMinder.LANG[ 'zh-cn' ] = { ...@@ -8,13 +10,34 @@ KityMinder.LANG[ 'zh-cn' ] = {
'fontfamily': '字体', 'fontfamily': '字体',
'fontsize': '字号', 'fontsize': '字号',
'layoutstyle': '主题', 'layoutstyle': '主题',
'saveto': '导出' 'saveto': '导出',
'hand': '允许拖拽',
'zoom-in': '放大',
'zoom-out': '缩小',
'markers': '添加标签'
}, },
'popupcolor': { 'popupcolor': {
'clearColor': '清空颜色', 'clearColor': '清空颜色',
'standardColor': '标准颜色', 'standardColor': '标准颜色',
'themeColor': '主题颜色' 'themeColor': '主题颜色'
}, },
'hand': '允许拖拽' 'dialogs': {
'markers': {
'static': {
'lang_input_text': '文本内容:',
'lang_input_url': '链接地址:',
'lang_input_title': '标题:',
'lang_input_target': '是否在新窗口打开:'
},
'priority': '优先级',
'progress': {
'notdone': "未完成",
'quarterdone': '完成1/4',
'halfdone': '完成1/2',
'threequartersdone': '完成3/4',
'done': '已完成',
}
}
}
}; };
\ No newline at end of file
utils.extend( KityMinder, function () { utils.extend( KityMinder, function () {
var _kityminderUI = {}, var _kityminderUI = {},
_kityminderToolbarUI ={},
_activeWidget = null, _activeWidget = null,
_widgetData = {}, _widgetData = {},
_widgetCallBack = {}; _widgetCallBack = {};
...@@ -9,6 +10,16 @@ utils.extend( KityMinder, function () { ...@@ -9,6 +10,16 @@ utils.extend( KityMinder, function () {
_kityminderUI[ name ] = fn; _kityminderUI[ name ] = fn;
} ) } )
}, },
registerToolbarUI: function ( uiname, fn ) {
utils.each( uiname.split( /\s+/ ), function ( i, name ) {
_kityminderToolbarUI[ name ] = fn;
} )
},
loadUI:function(km){
utils.each( _kityminderUI, function ( i, fn ) {
fn.call(km)
} )
},
_createUI: function ( id ) { _createUI: function ( id ) {
var $cont = $( '<div class="kmui-container"></div>' ), var $cont = $( '<div class="kmui-container"></div>' ),
$toolbar = $.kmuitoolbar(), $toolbar = $.kmuitoolbar(),
...@@ -17,6 +28,7 @@ utils.extend( KityMinder, function () { ...@@ -17,6 +28,7 @@ utils.extend( KityMinder, function () {
$cont.append( $toolbar ).append( $kmbody ).append( $statusbar ); $cont.append( $toolbar ).append( $kmbody ).append( $statusbar );
$( utils.isString( id ) ? '#' + id : id ).append( $cont ); $( utils.isString( id ) ? '#' + id : id ).append( $cont );
return { return {
'$container': $cont, '$container': $cont,
'$toolbar': $toolbar, '$toolbar': $toolbar,
...@@ -33,8 +45,8 @@ utils.extend( KityMinder, function () { ...@@ -33,8 +45,8 @@ utils.extend( KityMinder, function () {
if ( name == '|' ) { if ( name == '|' ) {
$.kmuiseparator && btns.push( $.kmuiseparator() ); $.kmuiseparator && btns.push( $.kmuiseparator() );
} else { } else {
if ( _kityminderUI[ name ] ) { if ( _kityminderToolbarUI[ name ] ) {
var ui = _kityminderUI[ name ].call( km, name ); var ui = _kityminderToolbarUI[ name ].call( km, name );
ui && btns.push( ui ); ui && btns.push( ui );
} }
...@@ -55,6 +67,8 @@ utils.extend( KityMinder, function () { ...@@ -55,6 +67,8 @@ 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;
this.loadUI(km);
return km.fire( 'interactchange' ); return km.fire( 'interactchange' );
}, },
registerWidget: function ( name, pro, cb ) { registerWidget: function ( name, pro, cb ) {
......
KM.registerUI('bold italic redo undo', KM.registerToolbarUI( 'bold italic redo undo',
function(name) { function ( name ) {
var me = this; var me = this;
var $btn = $.kmuibutton({ var $btn = $.kmuibutton( {
icon : name, icon: name,
click : function(){ click: function () {
me.execCommand(name); me.execCommand( name );
}, },
title: this.getLang('tooltips')[name] || '' title: this.getLang( 'tooltips' )[ name ] || ''
}); } );
this.on('interactchange',function(){ this.on( 'interactchange', function () {
var state = this.queryCommandState(name); var state = this.queryCommandState( name );
$btn.kmui().disabled(state == -1).active(state == 1) $btn.kmui().disabled( state == -1 ).active( state == 1 );
}); } );
return $btn; return $btn;
} }
); );
\ No newline at end of file
KM.registerUI( 'layoutstyle fontfamily fontsize', function ( name ) { KM.registerToolbarUI( 'layoutstyle fontfamily fontsize', function ( name ) {
var me = this, var me = this,
label = me.getLang( 'tooltips.' + name ), label = me.getLang( 'tooltips.' + name ),
...@@ -130,7 +130,7 @@ KM.registerUI( 'layoutstyle fontfamily fontsize', function ( name ) { ...@@ -130,7 +130,7 @@ KM.registerUI( 'layoutstyle fontfamily fontsize', function ( name ) {
} ); } );
KM.registerUI( 'forecolor', function ( name ) { KM.registerToolbarUI( 'forecolor', function ( name ) {
function getCurrentColor() { function getCurrentColor() {
return $colorLabel.css( 'background-color' ); return $colorLabel.css( 'background-color' );
} }
......
KM.registerToolbarUI( 'markers', function ( name ) {
var me = this,
currentRange, $dialog,
opt = {
width: 200,
title: this.getLang( 'tooltips' )[ name ] || '',
url: me.getOptions( 'KITYMINDER_HOME_URL' ) + 'dialogs/' + name + '/' + name + '.js',
};
var $btn = $.kmuibutton( {
icon: name,
title: this.getLang( 'tooltips' )[ name ] || ''
} );
//加载模版数据
utils.loadFile( document, {
src: opt.url,
tag: "script",
type: "text/javascript",
defer: "defer"
}, function () {
$dialog = $.kmuimodal( opt );
$dialog.attr( 'id', 'kmui-dialog-' + name ).addClass( 'kmui-dialog-' + name )
.find( '.kmui-modal-body' ).addClass( 'kmui-dialog-' + name + '-body' );
$dialog.kmui().on( 'beforeshow', function () {
var $root = this.root(),
win = null,
offset = null;
if ( !$root.parent()[ 0 ] ) {
me.$container.find( '.kmui-dialog-container' ).append( $root );
}
KM.setWidgetBody( name, $dialog, me );
} ).attachTo( $btn )
} );
me.on( 'interactchange', function () {
var state = this.queryCommandState( name );
$btn.kmui().disabled( state == -1 ).active( state == 1 )
} );
return $btn;
} );
\ No newline at end of file
KM.registerUI( 'hand',
function ( name ) {
var me = this;
var $btn = $.kmuibutton( {
icon: name,
click: function ( e ) {
var drag = me._onDragMode = !me._onDragMode;
me._paper.setStyle( 'cursor', drag ? 'pointer' : 'default' );
me._paper.setStyle( 'cursor', drag ? '-webkit-grab' : 'default' );
$btn.kmui().active( drag );
if ( drag ) {
me._paper.drag();
} else {
me._paper.undrag();
}
},
title: this.getLang( 'hand' )[ name ] || ''
} );
me.on( 'beforemousemove', function ( e ) {
if ( this._onDragMode ) {
e.stopPropagation();
}
} );
kity.extendClass( kity.Paper, kity.Draggable );
return $btn;
}
);
\ No newline at end of file
KM.registerUI( 'saveto', function ( name ) { KM.registerToolbarUI( 'saveto', function ( name ) {
var me = this, var me = this,
label = me.getLang( 'tooltips.' + name ), label = me.getLang( 'tooltips.' + name ),
......
KM.registerUI( 'tooltips',
function ( name ) {
var km = this;
//添加tooltip;
if($.kmuitooltip){
$("[data-original-title]",km.$container).each(function(i,n){
var tooltips = km.getLang('tooltips');
var tooltip = $(n).data('original-title');
utils.each(tooltips,function(v,k){
if(k == tooltip && km.getShortcutKey(v)){
$(n).attr('data-original-title',tooltip + ' (' + km.getShortcutKey(v).toUpperCase() + ')');
}
})
});
$.kmuitooltip('attachTo', $("[data-original-title]",km.$container)).css('z-index',km.getOptions('zIndex')+1);
}
km.$container.find('a').click(function(evt){
evt.preventDefault()
});
}
);
\ No newline at end of file
KM.registerToolbarUI( 'hand zoom-in zoom-out',
function ( name ) {
var me = this;
var $btn = $.kmuibutton( {
icon: name,
click: function () {
me.execCommand( name );
},
title: this.getLang( 'tooltips.' )[ name ] || ''
} );
me.on('interactchange', function() {
var state = me.queryCommandState( name );
$btn.kmui().disabled( state == -1 ).active( state == 1 );
});
return $btn;
}
);
\ No newline at end of file
var KityMinder = var KityMinder =
window.KM = window.KM =
window.KityMinder = function(){ window.KityMinder = function () {
var instanceMap = {}, instanceId = 0; var instanceMap = {}, instanceId = 0;
return { return {
version : '1.0.0', version: '1.0.0',
createMinder : function ( renderTarget, options ) { createMinder: function ( renderTarget, options ) {
options = options || {}; options = options || {};
options.renderTo = Utils.isString( renderTarget ) ? document.getElementById( renderTarget ) : renderTarget; options.renderTo = Utils.isString( renderTarget ) ? document.getElementById( renderTarget ) : renderTarget;
var minder = new Minder( options ); var minder = new Minder( options );
this.addMinder(options.renderTo,minder); this.addMinder( options.renderTo, minder );
return minder; return minder;
}, },
addMinder : function ( target, minder ) { addMinder: function ( target, minder ) {
var id; var id;
if ( typeof ( target ) === 'string' ) { if ( typeof ( target ) === 'string' ) {
id = target; id = target;
...@@ -20,17 +20,16 @@ var KityMinder = ...@@ -20,17 +20,16 @@ var KityMinder =
} }
instanceMap[ id ] = minder; instanceMap[ id ] = minder;
}, },
getMinder : function(target,options){ getMinder: function ( target, options ) {
var id; var id;
if ( typeof ( target ) === 'string' ) { if ( typeof ( target ) === 'string' ) {
id = target; id = target;
} else { } else {
id = target.id || ( "KM_INSTANCE_" + instanceId++ ); id = target.id || ( "KM_INSTANCE_" + instanceId++ );
} }
return instanceMap[ id ] || this.createMinder(target,options); return instanceMap[ id ] || this.createMinder( target, options );
}, },
//挂接多语言 //挂接多语言
LANG:{} LANG: {}
} }
}(); }();
\ No newline at end of file
...@@ -72,7 +72,7 @@ kity.extendClass( Minder, { ...@@ -72,7 +72,7 @@ kity.extendClass( Minder, {
if ( test.recognize && test.recognize( local ) ) { if ( test.recognize && test.recognize( local ) ) {
protocal = test; protocal = test;
} }
return !test; return !protocal;
} ); } );
} }
......
...@@ -13,7 +13,7 @@ kity.extendClass( Minder, { ...@@ -13,7 +13,7 @@ kity.extendClass( Minder, {
}, },
// TODO: mousemove lazy bind // TODO: mousemove lazy bind
_bindPaperEvents: function () { _bindPaperEvents: function () {
this._paper.on( 'click mousedown mouseup mousemove mousewheel touchstart touchmove touchend', this._firePharse.bind( this ) ); this._paper.on( 'click dblclick mousedown mouseup mousemove mousewheel touchstart touchmove touchend', this._firePharse.bind( this ) );
if ( window ) { if ( window ) {
window.addEventListener( 'resize', this._firePharse.bind( this ) ); window.addEventListener( 'resize', this._firePharse.bind( this ) );
} }
......
...@@ -39,7 +39,7 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", { ...@@ -39,7 +39,7 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this._addRenderContainer(); this._addRenderContainer();
this._root = new MinderNode( "Main Topic" ); this._root = new MinderNode( this.getLang().maintopic );
this._root.setType( "root" ); this._root.setType( "root" );
if ( this._options.renderTo ) { if ( this._options.renderTo ) {
this.renderTo( this._options.renderTo ); this.renderTo( this._options.renderTo );
...@@ -70,13 +70,19 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", { ...@@ -70,13 +70,19 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this._bindshortcutKeys(); this._bindshortcutKeys();
}, },
addShortcutKeys: function ( cmd, keys ) { addShortcutKeys: function ( cmd, keys ) {
var obj = {}; var obj = {},km = this;
if ( keys ) { if ( keys ) {
obj[ cmd ] = keys obj[ cmd ] = keys
} else { } else {
obj = cmd; obj = cmd;
} }
utils.extend( this._shortcutkeys, obj ) utils.each(obj,function(k,v){
km._shortcutkeys[k.toLowerCase()] = v;
});
},
getShortcutKey : function(cmdName){
return this._shortcutkeys[cmdName]
}, },
_bindshortcutKeys: function () { _bindshortcutKeys: function () {
var me = this, var me = this,
......
//添加多语言模块 //添加多语言模块
kity.extendClass( Minder, { kity.extendClass( Minder, {
getLang:function(path){ getLang: function ( path ) {
var lang = KM.LANG[this.getOptions('lang')]; var lang = KM.LANG[ this.getOptions( 'lang' ) ];
if (!lang) { if ( !lang ) {
throw Error("not import language file"); throw Error( "not import language file" );
} }
path = (path || "").split("."); path = ( path || "" ).split( "." );
for (var i = 0, ci; ci = path[i++];) { for ( var i = 0, ci; ci = path[ i++ ]; ) {
lang = lang[ci]; lang = lang[ ci ];
if (!lang)break; if ( !lang ) break;
} }
return lang; return lang;
} }
......
...@@ -38,12 +38,12 @@ kity.extendClass( Minder, { ...@@ -38,12 +38,12 @@ kity.extendClass( Minder, {
} }
} }
if(moduleDeals.defaultOptions){ if ( moduleDeals.defaultOptions ) {
this.setDefaultOptions(moduleDeals.defaultOptions); this.setDefaultOptions( moduleDeals.defaultOptions );
} }
//添加模块的快捷键 //添加模块的快捷键
if(moduleDeals.addShortcutKeys){ if ( moduleDeals.addShortcutKeys ) {
this.addShortcutKeys(moduleDeals.addShortcutKeys) this.addShortcutKeys( moduleDeals.addShortcutKeys )
} }
} }
......
...@@ -26,6 +26,7 @@ kity.extendClass( Minder, function () { ...@@ -26,6 +26,7 @@ kity.extendClass( Minder, function () {
unhighlightNode( me, n ); unhighlightNode( me, n );
} ); } );
this._selectedNodes = []; this._selectedNodes = [];
return this.fire( 'selectionclear' );
}, },
removeSelectedNodes: function ( nodes ) { removeSelectedNodes: function ( nodes ) {
var me = this; var me = this;
......
...@@ -185,7 +185,89 @@ var utils = Utils = KityMinder.Utils = { ...@@ -185,7 +185,89 @@ var utils = Utils = KityMinder.Utils = {
parent = parent.parent; parent = parent.parent;
} }
return parent; return parent;
} },
loadFile:function () {
var tmpList = [];
function getItem(doc, obj) {
try {
for (var i = 0, ci; ci = tmpList[i++];) {
if (ci.doc === doc && ci.url == (obj.src || obj.href)) {
return ci;
}
}
} catch (e) {
return null;
}
}
return function (doc, obj, fn) {
var item = getItem(doc, obj);
if (item) {
if (item.ready) {
fn && fn();
} else {
item.funs.push(fn)
}
return;
}
tmpList.push({
doc:doc,
url:obj.src || obj.href,
funs:[fn]
});
if (!doc.body) {
var html = [];
for (var p in obj) {
if (p == 'tag')continue;
html.push(p + '="' + obj[p] + '"')
}
doc.write('<' + obj.tag + ' ' + html.join(' ') + ' ></' + obj.tag + '>');
return;
}
if (obj.id && doc.getElementById(obj.id)) {
return;
}
var element = doc.createElement(obj.tag);
delete obj.tag;
for (var p in obj) {
element.setAttribute(p, obj[p]);
}
element.onload = element.onreadystatechange = function () {
if (!this.readyState || /loaded|complete/.test(this.readyState)) {
item = getItem(doc, obj);
if (item.funs.length > 0) {
item.ready = 1;
for (var fi; fi = item.funs.pop();) {
fi();
}
}
element.onload = element.onreadystatechange = null;
}
};
element.onerror = function () {
throw Error('The load ' + (obj.href || obj.src) + ' fails,check the url settings of file umeditor.config.js ')
};
doc.getElementsByTagName("head")[0].appendChild(element);
}
}(),
clone:function (source, target) {
var tmp;
target = target || {};
for (var i in source) {
if (source.hasOwnProperty(i)) {
tmp = source[i];
if (typeof tmp == 'object') {
target[i] = utils.isArray(tmp) ? [] : {};
utils.clone(source[i], target[i])
} else {
target[i] = tmp;
}
}
}
return target;
},
}; };
......
This diff is collapsed.
...@@ -27,7 +27,7 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -27,7 +27,7 @@ KityMinder.registerModule( "TextEditModule", function () {
var textShape = node.getTextShape(); var textShape = node.getTextShape();
textShape.setStyle('cursor','default'); textShape.setStyle('cursor','default');
if ( this.isSingleSelect() && node.isSelected() ) { if ( this.isSingleSelect() && node.isSelected() && e.kityEvent.targetShape.getType().toLowerCase()== 'text') {
sel.collapse(); sel.collapse();
node.getTextShape().setStyle('cursor','text'); node.getTextShape().setStyle('cursor','text');
...@@ -48,7 +48,7 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -48,7 +48,7 @@ KityMinder.registerModule( "TextEditModule", function () {
} }
}, },
'mouseup':function(e){ 'mouseup':function(e){
if(!sel.collapsed){ if(!sel.collapsed && mouseDownStatus){
receiver.updateRange(range) receiver.updateRange(range)
} }
mouseDownStatus = false; mouseDownStatus = false;
...@@ -57,25 +57,86 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -57,25 +57,86 @@ KityMinder.registerModule( "TextEditModule", function () {
'beforemousemove':function(e){ 'beforemousemove':function(e){
if(mouseDownStatus){ if(mouseDownStatus){
e.stopPropagationImmediately(); e.stopPropagationImmediately();
setTimeout(function(){ var offset = e.getPosition();
dir = offset.x > lastEvtPosition.x ? 1 : (offset.x < lastEvtPosition.x ? -1 : dir);
var offset = e.getPosition(); receiver.updateSelectionByMousePosition(offset,dir)
dir = offset.x > lastEvtPosition.x ? 1 : (offset.x < lastEvtPosition.x ? -1 : dir); .updateSelectionShow(dir);
receiver.updateSelectionByMousePosition(offset,dir) sel.stroke('none',0);
.updateSelectionShow(dir); lastEvtPosition = e.getPosition();
sel.stroke('none',0);
lastEvtPosition = e.getPosition();
},100)
} }
},
'dblclick':function(e){
var text = e.kityEvent.targetShape;
if ( text.getType().toLowerCase()== 'text') {
sel.setStartOffset(0);
sel.setEndOffset(text.getContent().length);
sel.setShow();
receiver.updateSelectionShow(1)
.updateRange(range);
}
}, },
'restoreScene':function(){ 'restoreScene':function(){
sel.setHide(); sel.setHide();
}, },
'stopTextEdit':function(){ 'stopTextEdit':function(){
sel.setHide(); sel.setHide();
receiver.clear().setTextEditStatus(false);
},
'execCommand':function(e){
var cmds = {
'appendchildnode':1,
'appendsiblingnode':1
};
if(cmds[e.commandName]){
var node = km.getSelectedNode();
var textShape = node.getTextShape();
textShape.setStyle('cursor','default');
node.getTextShape().setStyle('cursor','text');
receiver.setTextEditStatus(true)
.setSelection(sel)
.setKityMinder(this)
.setMinderNode(node)
.setTextShape(textShape)
.setBaseOffset()
.setContainerStyle()
.setSelectionHeight()
.getTextOffsetData()
.setIndex(0)
.updateSelection()
.setRange(range);
sel.setStartOffset(0);
sel.setEndOffset(textShape.getContent().length);
sel.setShow();
receiver.updateSelectionShow(1)
.updateRange(range);
}
if(e.commandName == 'priority' || e.commandName == 'progress'){
receiver.setBaseOffset()
.getTextOffsetData();
if(sel.collapsed){
receiver.updateSelection();
}else{
receiver.updateSelectionShow(1)
}
}
},
'selectionclear':function(){
receiver.setTextEditStatus(false).clear()
} }
} }
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Minder.Receiver = kity.createClass('Receiver',{ Minder.Receiver = kity.createClass('Receiver',{
clear : function(){ clear : function(){
this.container.innerHTML = ''; this.container.innerHTML = '';
this.selection.setHide(); this.selection && this.selection.setHide();
this.index = 0; this.index = 0;
return this; return this;
}, },
...@@ -77,8 +77,10 @@ Minder.Receiver = kity.createClass('Receiver',{ ...@@ -77,8 +77,10 @@ Minder.Receiver = kity.createClass('Receiver',{
switch(keyCode){ switch(keyCode){
case keymap.Enter: case keymap.Enter:
case keymap.Tab: case keymap.Tab:
this.setTextEditStatus(false); if(this.keydownNode === this.minderNode){
this.clear(); this.setTextEditStatus(false);
this.clear();
}
e.preventDefault(); e.preventDefault();
return; return;
case keymap.Shift: case keymap.Shift:
...@@ -125,26 +127,26 @@ Minder.Receiver = kity.createClass('Receiver',{ ...@@ -125,26 +127,26 @@ Minder.Receiver = kity.createClass('Receiver',{
//更新模拟选区的范围 //更新模拟选区的范围
this.selection.setStartOffset(this.index).collapse(true); this.selection.setStartOffset(this.index).collapse(true);
if(this.index == this.textData.length){ if(this.index == this.textData.length){
if(this.index == 0){
this.selection.setPosition(this.getBaseOffset())
}else{
this.selection.setPosition({
x : this.textData[this.index-1].x + this.textData[this.index-1].width,
y : this.textData[this.index-1].y
})
}
this.selection.setPosition({
x : this.textData[this.index-1].x + this.textData[this.index-1].width,
y : this.textData[this.index-1].y
})
}else{ }else{
this.selection.setPosition(this.textData[this.index]) this.selection.setPosition(this.textData[this.index])
} }
return this; return this;
}, },
getBaseOffset:function(){
return this.textShape.getRenderBox('top');
},
setBaseOffset :function(){ setBaseOffset :function(){
this.offset = this.textShape.getRenderBox('top');
var nodeOffset = this.minderNode.getRenderContainer().getRenderBox();
// var textOffset = this.textShape.getRenderBox();
var contRcOffset = this.minderNode.getContRc().getRenderBox();
this.offset = {
x : nodeOffset.x + contRcOffset.x,
y : nodeOffset.y + contRcOffset.y
};
return this; return this;
}, },
setContainerStyle : function(){ setContainerStyle : function(){
...@@ -223,6 +225,9 @@ Minder.Receiver = kity.createClass('Receiver',{ ...@@ -223,6 +225,9 @@ Minder.Receiver = kity.createClass('Receiver',{
if(offset.x >= v.x && offset.x <= v.x + v.width){ if(offset.x >= v.x && offset.x <= v.x + v.width){
if(me.index == i){ if(me.index == i){
if(i == 0){
me.selection.setStartOffset(i)
}
me.selection.setEndOffset(i + (dir == 1 ? 1 : 0)) me.selection.setEndOffset(i + (dir == 1 ? 1 : 0))
}else if(i > me.index){ }else if(i > me.index){
me.selection.setEndOffset(i + (dir == 1 ? 1 : 0)) me.selection.setEndOffset(i + (dir == 1 ? 1 : 0))
...@@ -236,7 +241,6 @@ Minder.Receiver = kity.createClass('Receiver',{ ...@@ -236,7 +241,6 @@ Minder.Receiver = kity.createClass('Receiver',{
return this; return this;
}, },
updateSelectionShow:function(){ updateSelectionShow:function(){
var startOffset = this.textData[this.selection.startOffset], var startOffset = this.textData[this.selection.startOffset],
endOffset = this.textData[this.selection.endOffset], endOffset = this.textData[this.selection.endOffset],
width = 0 ; width = 0 ;
...@@ -261,5 +265,9 @@ Minder.Receiver = kity.createClass('Receiver',{ ...@@ -261,5 +265,9 @@ Minder.Receiver = kity.createClass('Receiver',{
range.setEnd(node,this.selection.endOffset); range.setEnd(node,this.selection.endOffset);
range.select(); range.select();
return this; return this;
},
setIndex:function(index){
this.index = index;
return this
} }
}); });
\ No newline at end of file
...@@ -86,10 +86,15 @@ Minder.Selection = kity.createClass( 'Selection', { ...@@ -86,10 +86,15 @@ Minder.Selection = kity.createClass( 'Selection', {
clearInterval( this.timer ); clearInterval( this.timer );
var me = this, var me = this,
state = ''; state = '';
this.timer = setInterval( function () { if(this.collapsed){
me.setStyle( 'display', state ); this.timer = setInterval( function () {
state = state ? '' : 'none'; me.setStyle( 'display', state );
}, 300 ); state = state ? '' : 'none';
}, 300 );
}else{
me.setStyle( 'display', '' );
}
return this; return this;
}, },
setTextShape: function ( text ) { setTextShape: function ( text ) {
......
...@@ -101,8 +101,10 @@ kity.Draggable = ( function () { ...@@ -101,8 +101,10 @@ kity.Draggable = ( function () {
paper.off( DRAG_MOVE_EVENT, dragFn ); paper.off( DRAG_MOVE_EVENT, dragFn );
dragTarget.trigger( 'dragend' ); dragTarget.trigger( 'dragend' );
e.stopPropagation(); if ( e ) {
e.preventDefault(); e.stopPropagation();
e.preventDefault();
}
} }
} ); } );
} }
...@@ -128,6 +130,7 @@ kity.Draggable = ( function () { ...@@ -128,6 +130,7 @@ kity.Draggable = ( function () {
undrag: function () { undrag: function () {
var target = this.dragTarget; var target = this.dragTarget;
target.off( DRAG_START_EVENT, target._dragStartHandler ); target.off( DRAG_START_EVENT, target._dragStartHandler );
target._dragEndHandler();
target.getPaper().off( DRAG_END_EVENT, target._dragEndHandler ); target.getPaper().off( DRAG_END_EVENT, target._dragEndHandler );
delete target._dragStartHandler; delete target._dragStartHandler;
delete target._dragEndHandler; delete target._dragEndHandler;
...@@ -135,4 +138,46 @@ kity.Draggable = ( function () { ...@@ -135,4 +138,46 @@ kity.Draggable = ( function () {
return this; return this;
} }
} ); } );
} )(); } )();
\ No newline at end of file
KityMinder.registerModule( 'Hand', function () {
var ToggleHandCommand = kity.createClass( "ToggleHandCommand", {
base: Command,
execute: function ( minder ) {
var drag = minder._onDragMode = !minder._onDragMode;
minder.getPaper().setStyle( 'cursor', drag ? 'pointer' : 'default' );
minder.getPaper().setStyle( 'cursor', drag ? '-webkit-grab' : 'default' );
if ( drag ) {
minder.getPaper().drag();
} else {
minder.getPaper().undrag();
}
},
queryState: function ( minder ) {
return minder._onDragMode ? 1 : 0;
}
} );
return {
init: function () {
this._onDragMode = false;
kity.extendClass( kity.Paper, kity.Draggable );
},
commands: {
'hand': ToggleHandCommand
},
events: {
keyup: function ( e ) {
if ( e.originEvent.keyCode == keymap.Spacebar && this.getSelectedNodes().length === 0 ) {
this.execCommand( 'hand' );
e.preventDefault();
}
},
beforemousemove: function ( e ) {
if ( this._onDragMode ) {
e.stopPropagation();
}
}
}
};
} );
\ No newline at end of file
KityMinder.registerModule( "IconModule", function () { KityMinder.registerModule( "IconModule", function () {
var renderPriorityIcon = function ( node, val ) { var renderPriorityIcon = function ( node, val ) {
var colors = [ "", "red", "blue", "green", "orange", "purple" ]; var colors = [ "", "#A92E24", "#29A6BD", "#1E8D54", "#eb6100", "#876DDA" ];
var _bg = new kity.Rect().fill( colors[ val ] ).setRadius( 3 ).setWidth( 20 ).setHeight( 20 ); var _bg = new kity.Rect().fill( colors[ val ] ).setRadius( 3 ).setWidth( 20 ).setHeight( 20 );
var _number = new kity.Text().setContent( val ).fill( "white" ).setSize( 12 ); var _number = new kity.Text().setContent( val ).fill( "white" ).setSize( 12 );
var _rc = new kity.Group(); var _rc = new kity.Group();
...@@ -10,7 +10,7 @@ KityMinder.registerModule( "IconModule", function () { ...@@ -10,7 +10,7 @@ KityMinder.registerModule( "IconModule", function () {
}; };
var renderProgressIcon = function ( node, val, left ) { var renderProgressIcon = function ( node, val, left ) {
var _rc = new kity.Group(); var _rc = new kity.Group();
var _bg = new kity.Circle().setRadius( 8 ).fill( "white" ).stroke( new kity.Pen( "blue", 2 ) ); var _bg = new kity.Circle().setRadius( 8 ).fill( "white" ).stroke( new kity.Pen( "#29A6BD", 2 ) );
var _percent, d; var _percent, d;
if ( val < 5 ) { if ( val < 5 ) {
_percent = new kity.Path(); _percent = new kity.Path();
...@@ -34,49 +34,70 @@ KityMinder.registerModule( "IconModule", function () { ...@@ -34,49 +34,70 @@ KityMinder.registerModule( "IconModule", function () {
d.carcTo( 6, 0, 6, 1, 0 ); d.carcTo( 6, 0, 6, 1, 0 );
break; break;
case 5: case 5:
_percent.addShape( new kity.Circle().setRadius( 6 ).fill( "blue" ) ); var check = new kity.Path();
_percent.addShapes( [ new kity.Circle().setRadius( 6 ).fill( "#29A6BD" ), check ] );
check.getDrawer().moveTo( -3, 0 ).lineTo( -1, 3 ).lineTo( 3, -2 );
check.stroke( new kity.Pen( "white", 2 ).setLineCap( "round" ) );
break; break;
} }
if ( val < 5 ) d.close(); if ( val < 5 ) d.close();
_percent.fill( "blue" ); _percent.fill( "#29A6BD" );
}; };
var ChangeIconCommand = kity.createClass( "AddIconCommand", ( function () { var setPriorityCommand = kity.createClass( "SetPriorityCommand", ( function () {
return { return {
base: Command, base: Command,
execute: function ( km, iconType, value ) { execute: function ( km, value ) {
var nodes = km.getSelectedNodes(); var nodes = km.getSelectedNodes();
for ( var i = 0; i < nodes.length; i++ ) { for ( var i = 0; i < nodes.length; i++ ) {
nodes[ i ].setData( iconType, value ); nodes[ i ].setData( "PriorityIcon", value );
km.updateLayout( nodes[ i ] ); km.updateLayout( nodes[ i ] );
} }
},
queryValue: function ( km ) {
var nodes = km.getSelectedNodes();
var val;
for ( var i = 0; i < nodes.length; i++ ) {
val = nodes[ i ].getData( "PriorityIcon" );
if ( val ) break;
}
return val;
} }
}; };
} )() ); } )() );
var RemoveIconCommand = kity.createClass( "RemoveIconCommand", ( function () { var setProgressCommand = kity.createClass( "SetProgressCommand", ( function () {
return { return {
base: Command, base: Command,
execute: function ( km, iconType ) { execute: function ( km, value ) {
var nodes = km.getSelectedNodes(); var nodes = km.getSelectedNodes();
for ( var i = 0; i < nodes.length; i++ ) { for ( var i = 0; i < nodes.length; i++ ) {
nodes[ i ].setData( iconType, null ); nodes[ i ].setData( "ProgressIcon", value );
km.updateLayout( nodes[ i ] ); km.updateLayout( nodes[ i ] );
} }
},
queryValue: function ( km ) {
var nodes = km.getSelectedNodes();
var val;
for ( var i = 0; i < nodes.length; i++ ) {
val = nodes[ i ].getData( "ProgressIcon" );
if ( val ) break;
}
return val;
} }
}; };
} )() ); } )() );
return { return {
"commands": { "commands": {
"changeicon": ChangeIconCommand, "priority": setPriorityCommand,
"removeicon": RemoveIconCommand "progress": setProgressCommand
}, },
"events": { "events": {
"RenderNode": function ( e ) { "RenderNode": function ( e ) {
var node = e.node; var node = e.node;
var iconRc = node.getIconRc(); var iconRc = node.getIconRc();
var contRc = node.getContRc();
var PriorityIconVal = node.getData( "PriorityIcon" ); var PriorityIconVal = node.getData( "PriorityIcon" );
var ProgressIconVal = node.getData( "ProgressIcon" ); var ProgressIconVal = node.getData( "ProgressIcon" );
//依次排布图标、文字 //依次排布图标、文字
iconRc.setTransform( new kity.Matrix().translate( 0, -20 ) );
iconRc.clear(); iconRc.clear();
var PriorityIconWidth = 0; var PriorityIconWidth = 0;
if ( PriorityIconVal ) { if ( PriorityIconVal ) {
...@@ -89,6 +110,8 @@ KityMinder.registerModule( "IconModule", function () { ...@@ -89,6 +110,8 @@ KityMinder.registerModule( "IconModule", function () {
var iconWidth = iconRc.getWidth(); var iconWidth = iconRc.getWidth();
var textShape = node.getTextShape(); var textShape = node.getTextShape();
if ( iconWidth ) textShape.setTransform( new kity.Matrix().translate( iconWidth + 5, 0 ) ); if ( iconWidth ) textShape.setTransform( new kity.Matrix().translate( iconWidth + 5, 0 ) );
else textShape.setTransform( new kity.Matrix().translate( 0, 0 ) );
iconRc.setTransform( new kity.Matrix().translate( 0, -( iconRc.getHeight() + textShape.getHeight() ) / 2 ) );
} }
} }
}; };
......
...@@ -67,6 +67,7 @@ KityMinder.registerModule( "KeyboardModule", function () { ...@@ -67,6 +67,7 @@ KityMinder.registerModule( "KeyboardModule", function () {
buildPositionNetwork( this.getRoot() ); buildPositionNetwork( this.getRoot() );
}, },
keydown: function ( e ) { keydown: function ( e ) {
var keys = KityMinder.keymap; var keys = KityMinder.keymap;
if ( this.receiver.isTextEditStatus() ) { if ( this.receiver.isTextEditStatus() ) {
switch ( e.originEvent.keyCode ) { switch ( e.originEvent.keyCode ) {
...@@ -85,13 +86,15 @@ KityMinder.registerModule( "KeyboardModule", function () { ...@@ -85,13 +86,15 @@ KityMinder.registerModule( "KeyboardModule", function () {
} }
return; return;
} }
var node = e.getTargetNode();
this.receiver.keydownNode = node;
switch ( e.originEvent.keyCode ) { switch ( e.originEvent.keyCode ) {
case keys.Enter: case keys.Enter:
this.execCommand( 'appendSiblingNode', new MinderNode( 'Topic' ) ); this.execCommand( 'appendSiblingNode', new MinderNode( this.getLang().topic ) );
e.preventDefault(); e.preventDefault();
break; break;
case keys.Tab: case keys.Tab:
this.execCommand( 'appendChildNode', new MinderNode( 'Topic' ) ); this.execCommand( 'appendChildNode', new MinderNode( this.getLang().topic ) );
e.preventDefault(); e.preventDefault();
break; break;
case keys.Backspace: case keys.Backspace:
......
This diff is collapsed.
...@@ -53,9 +53,10 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -53,9 +53,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
var nodeShape = node.getRenderContainer(); var nodeShape = node.getRenderContainer();
var nodeX, nodeY = ( node.getType() === "main" ? Layout.y : ( Layout.y + nodeShape.getHeight() / 2 - 5 ) ); var nodeX, nodeY = ( node.getType() === "main" ? Layout.y : ( Layout.y + nodeShape.getHeight() / 2 - 5 ) );
if ( Layout.appendside === "left" ) { if ( Layout.appendside === "left" ) {
nodeX = nodeShape.getRenderBox().closurePoints[ 1 ].x - 6; nodeX = nodeShape.getRenderBox().closurePoints[ 1 ].x - 5;
} else { } else {
nodeX = nodeShape.getRenderBox().closurePoints[ 0 ].x + 6; nodeX = nodeShape.getRenderBox().closurePoints[ 0 ].x + 6;
if ( node.getType() === "main" ) nodeX -= 3;
} }
this.shape.setTransform( new kity.Matrix().translate( nodeX, nodeY ) ); this.shape.setTransform( new kity.Matrix().translate( nodeX, nodeY ) );
}, },
...@@ -121,7 +122,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -121,7 +122,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( [ highlightshape, underline ] ); node.getBgRc().clear().addShapes( [ Layout.bgRect = new kity.Rect().setRadius( 4 ), highlightshape, underline ] );
break; break;
default: default:
break; break;
...@@ -160,6 +161,8 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -160,6 +161,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
case "sub": case "sub":
var _contWidth = contRc.getWidth(); var _contWidth = contRc.getWidth();
var _contHeight = contRc.getHeight(); var _contHeight = contRc.getHeight();
width = _contWidth + nodeStyle.padding[ 1 ] + nodeStyle.padding[ 3 ];
height = _contHeight + nodeStyle.padding[ 0 ] + nodeStyle.padding[ 2 ];
Layout.underline.getDrawer() Layout.underline.getDrawer()
.clear() .clear()
.moveTo( 0, _contHeight + nodeStyle.padding[ 2 ] + nodeStyle.padding[ 0 ] ) .moveTo( 0, _contHeight + nodeStyle.padding[ 2 ] + nodeStyle.padding[ 0 ] )
...@@ -168,6 +171,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -168,6 +171,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 );
break; break;
default: default:
break; break;
...@@ -216,7 +220,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -216,7 +220,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
} else { } else {
if ( action === "append" || action === "contract" ) { if ( action === "append" || action === "contract" ) {
Layout.branchheight = node.getRenderContainer().getHeight() + nodeStyle.margin[ 0 ] + nodeStyle.margin[ 2 ]; Layout.branchheight = node.getRenderContainer().getHeight() + nodeStyle.margin[ 0 ] + nodeStyle.margin[ 2 ];
} else if ( action === "change" ) { //展开 } else if ( action === "change" ) {
Layout.branchheight = countBranchHeight( node ); Layout.branchheight = countBranchHeight( node );
} }
var parentLayout = parent.getLayout(); var parentLayout = parent.getLayout();
...@@ -328,16 +332,16 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -328,16 +332,16 @@ KityMinder.registerModule( "LayoutDefault", function () {
var endPos; var endPos;
if ( Layout.appendside === "left" ) { if ( Layout.appendside === "left" ) {
sPos = new kity.BezierPoint( rootX - 30, nodeClosurePoints[ 2 ].y + nodeShape.getHeight() / 2 ); sPos = new kity.BezierPoint( rootX - 30, nodeClosurePoints[ 2 ].y + nodeShape.getHeight() / 2 );
endPos = new kity.BezierPoint( nodeClosurePoints[ 2 ].x, nodeClosurePoints[ 2 ].y + nodeShape.getHeight() / 2 ); endPos = new kity.BezierPoint( nodeClosurePoints[ 2 ].x + 3, nodeClosurePoints[ 2 ].y + nodeShape.getHeight() / 2 );
} else { } else {
sPos = new kity.BezierPoint( rootX + 30, nodeClosurePoints[ 3 ].y + nodeShape.getHeight() / 2 ); sPos = new kity.BezierPoint( rootX + 30, nodeClosurePoints[ 3 ].y + nodeShape.getHeight() / 2 );
endPos = new kity.BezierPoint( nodeClosurePoints[ 3 ].x, nodeClosurePoints[ 3 ].y + nodeShape.getHeight() / 2 ); endPos = new kity.BezierPoint( nodeClosurePoints[ 3 ].x - 3, nodeClosurePoints[ 3 ].y + nodeShape.getHeight() / 2 );
} }
var sPosV = sPos.getVertex(); var sPosV = sPos.getVertex();
var endPosV = endPos.getVertex(); var endPosV = endPos.getVertex();
sPos.setVertex( rootX, rootY ); sPos.setVertex( rootX, rootY );
connect.bezier.setPoints( [ sPos, endPos ] ).stroke( nodeStyle.stroke ); connect.bezier.setPoints( [ sPos, endPos ] ).stroke( nodeStyle.stroke );
connect.circle.setCenter( endPosV.x + ( Layout.appendside === "left" ? 3 : -3 ), endPosV.y ).fill( "white" ).stroke( "gray" ).setRadius( 3 ); connect.circle.setCenter( endPosV.x + ( Layout.appendside === "left" ? -0.5 : -1.5 ), endPosV.y ).fill( "white" ).setRadius( 4 );
} else if ( nodeType === "sub" ) { } else if ( nodeType === "sub" ) {
if ( !Layout.connect ) { if ( !Layout.connect ) {
connect = Layout.connect = new kity.Path(); connect = Layout.connect = new kity.Path();
...@@ -374,7 +378,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -374,7 +378,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 );
} }
...@@ -472,6 +476,16 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -472,6 +476,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 );
...@@ -543,6 +557,10 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -543,6 +557,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
removeNode: function ( nodes ) { removeNode: function ( nodes ) {
while ( nodes.length !== 0 ) { while ( nodes.length !== 0 ) {
var parent = nodes[ 0 ].getParent(); var parent = nodes[ 0 ].getParent();
if ( !parent ) {
nodes.splice( 0, 1 );
return false;
}
var nodeLayout = nodes[ 0 ].getLayout(); var nodeLayout = nodes[ 0 ].getLayout();
if ( parent.getType() === "root" ) { if ( parent.getType() === "root" ) {
var sideList = parent.getLayout()[ nodeLayout.appendside + "List" ]; var sideList = parent.getLayout()[ nodeLayout.appendside + "List" ];
...@@ -593,7 +611,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -593,7 +611,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,6 +132,11 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -132,6 +132,11 @@ KityMinder.registerModule( "LayoutModule", function () {
base: Command, base: Command,
execute: function ( km ) { execute: function ( km ) {
var selectedNodes = km.getSelectedNodes(); var selectedNodes = km.getSelectedNodes();
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 ] );
...@@ -140,7 +145,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -140,7 +145,7 @@ KityMinder.registerModule( "LayoutModule", function () {
var parent = _buffer[ 0 ].getParent(); var parent = _buffer[ 0 ].getParent();
if ( parent && _buffer.indexOf( parent ) === -1 ) _buffer.push( parent ); if ( parent && _buffer.indexOf( parent ) === -1 ) _buffer.push( parent );
_buffer.shift(); _buffer.shift();
} while ( _buffer.length !== 1 ); } while ( _buffer.length > 1 );
km.removeNode( selectedNodes ); km.removeNode( selectedNodes );
km.select( _buffer[ 0 ] ); km.select( _buffer[ 0 ] );
} }
......
...@@ -2,11 +2,19 @@ KityMinder.registerModule( "Select", function () { ...@@ -2,11 +2,19 @@ KityMinder.registerModule( "Select", function () {
var minder = this; var minder = this;
var g = KityMinder.Geometry; var g = KityMinder.Geometry;
// 框选控制 // 在实例上渲染框选矩形、计算框选范围的对象
var marqueeActivator = ( function () { var marqueeActivator = ( function () {
// 记录选区的开始位置(mousedown的位置)
var startPosition = null; var startPosition = null;
// 选区的图形
var marqueeShape = new kity.Path().fill( 'rgba(255,255,255,.3)' ).stroke( 'white' ); var marqueeShape = new kity.Path().fill( 'rgba(255,255,255,.3)' ).stroke( 'white' );
// 标记是否已经启动框选状态
// 并不是 mousedown 发生之后就启动框选状态,而是检测到移动了一定的距离(MARQUEE_MODE_THRESHOLD)之后
var marqueeMode = false; var marqueeMode = false;
var MARQUEE_MODE_THRESHOLD = 10;
return { return {
selectStart: function ( e ) { selectStart: function ( e ) {
...@@ -17,20 +25,26 @@ KityMinder.registerModule( "Select", function () { ...@@ -17,20 +25,26 @@ KityMinder.registerModule( "Select", function () {
if ( startPosition ) { if ( startPosition ) {
return this.selectEnd(); return this.selectEnd();
} }
startPosition = g.snapToSharp( e.getPosition() ); startPosition = g.snapToSharp( e.getPosition() );
minder.getPaper().addShape( marqueeShape );
marqueeShape.setOpacity( 0.8 ).getDrawer().clear();
}, },
selectMove: function ( e ) { selectMove: function ( e ) {
if ( !startPosition ) return; if ( !startPosition ) return;
var p1 = startPosition, var p1 = startPosition,
p2 = e.getPosition(); p2 = e.getPosition();
// 检测是否要进入选区模式
if ( !marqueeMode ) { if ( !marqueeMode ) {
if ( g.getDistance( p1, p2 ) < 10 ) { // 距离没达到阈值,退出
if ( g.getDistance( p1, p2 ) < MARQUEE_MODE_THRESHOLD ) {
return; return;
} }
// 已经达到阈值,记录下来并且重置选区形状
marqueeMode = true; marqueeMode = true;
minder.getPaper().addShape( marqueeShape );
marqueeShape.setOpacity( 0.8 ).getDrawer().clear();
} }
var marquee = g.getBox( p1, p2 ), var marquee = g.getBox( p1, p2 ),
...@@ -49,7 +63,7 @@ KityMinder.registerModule( "Select", function () { ...@@ -49,7 +63,7 @@ KityMinder.registerModule( "Select", function () {
this.close(); this.close();
} ); } );
// 选中节点数据更新 // 计算选中范围
minder.getRoot().traverse( function ( node ) { minder.getRoot().traverse( function ( node ) {
var renderBox = node.getRenderContainer().getRenderBox(); var renderBox = node.getRenderContainer().getRenderBox();
if ( g.isBoxIntersect( renderBox, marquee ) ) { if ( g.isBoxIntersect( renderBox, marquee ) ) {
...@@ -57,6 +71,7 @@ KityMinder.registerModule( "Select", function () { ...@@ -57,6 +71,7 @@ KityMinder.registerModule( "Select", function () {
} }
} ); } );
// 应用选中范围
minder.select( selectedNodes, true ); minder.select( selectedNodes, true );
}, },
selectEnd: function ( e ) { selectEnd: function ( e ) {
...@@ -65,7 +80,7 @@ KityMinder.registerModule( "Select", function () { ...@@ -65,7 +80,7 @@ KityMinder.registerModule( "Select", function () {
} }
if ( marqueeMode ) { if ( marqueeMode ) {
marqueeShape.fadeOut( 200, 'ease', 0, function () { marqueeShape.fadeOut( 200, 'ease', 0, function () {
marqueeShape.remove(); if(marqueeShape.remove) marqueeShape.remove();
} ); } );
marqueeMode = false; marqueeMode = false;
} }
...@@ -73,25 +88,49 @@ KityMinder.registerModule( "Select", function () { ...@@ -73,25 +88,49 @@ KityMinder.registerModule( "Select", function () {
}; };
} )(); } )();
var lastDownNode = null;
return { return {
"events": { "events": {
mousedown: function ( e ) { mousedown: function ( e ) {
var clickNode = e.getTargetNode(); var downNode = e.getTargetNode();
if ( !clickNode ) {
// 没有点中节点:
// 清除选中状态,并且标记选区开始位置
if ( !downNode ) {
this.removeAllSelectedNodes(); this.removeAllSelectedNodes();
marqueeActivator.selectStart( e ); marqueeActivator.selectStart( e );
} else if ( e.originEvent.shiftKey ) { }
this.toggleSelect( clickNode );
} else if ( !clickNode.isSelected() ) { // 点中了节点,并且按了 shift 键:
this.select( clickNode, true ); // 被点中的节点切换选中状态
else if ( e.originEvent.shiftKey ) {
this.toggleSelect( downNode );
}
// 点中的节点没有被选择:
// 单选点中的节点
else if ( !downNode.isSelected() ) {
this.select( downNode, true );
}
// 点中的节点被选中了,并且不是单选:
// 完成整个点击之后需要使其变为单选。
// 不能马上变为单选,因为可能是需要拖动选中的多个节点
else if ( !this.isSingleSelect() ) {
lastDownNode = downNode;
} }
}, },
mousemove: marqueeActivator.selectMove, mousemove: marqueeActivator.selectMove,
mouseup: function ( e ) { mouseup: function ( e ) {
var clickNode = e.getTargetNode(); var upNode = e.getTargetNode();
if ( clickNode && clickNode.isSelected() && !this.isSingleSelect() ) {
this.select( clickNode, true ); // 如果 mouseup 发生在 lastDownNode 外,是无需理会的
if ( upNode && upNode == lastDownNode ) {
this.select( lastDownNode, true );
lastDownNode = null;
} }
// 清理一下选择状态
marqueeActivator.selectEnd( e ); marqueeActivator.selectEnd( e );
} }
} }
......
KityMinder.registerModule( 'Zoom', function () { KityMinder.registerModule( 'Zoom', function () {
/* var MAX_ZOOM = 2,
MIN_ZOOM = 0.5,
ZOOM_STEP = Math.sqrt( 2 );
function zoom( minder, rate ) {
var paper = minder.getPaper();
var viewbox = paper.getViewBox();
var zoomValue = minder._zoomValue;
var w = viewbox.width,
h = viewbox.height,
x = viewbox.x,
y = viewbox.y;
var ww = w * rate,
hh = h * rate,
xx = x + ( w - ww ) / 2,
yy = y + ( h - hh ) / 2;
var animator = new kity.Animator( {
beginValue: viewbox,
finishValue: {
width: ww,
height: hh,
x: xx,
y: yy
},
setter: function ( target, value ) {
target.setViewBox( value.x, value.y, value.width, value.height );
}
} );
animator.start( paper, 100, 'ease' );
minder._zoomValue = zoomValue *= rate;
}
var ZoomInCommand = kity.createClass( 'ZoomInCommand', {
base: Command,
execute: function ( minder ) {
if( !this.queryState( minder ) ) {
zoom( minder, 1 / ZOOM_STEP );
}
},
queryState: function ( minder ) {
return (minder._zoomValue > MIN_ZOOM) ? 0 : -1;
}
} );
var ZoomOutCommand = kity.createClass( 'ZoomOutCommand', {
base: Command,
execute: function ( minder ) {
if( !this.queryState( minder ) ) {
zoom( minder, ZOOM_STEP );
}
},
queryState: function ( minder ) {
return (minder._zoomValue < MAX_ZOOM) ? 0 : -1;
}
} );
return { return {
commands: {
'zoom-in': ZoomInCommand,
'zoom-out': ZoomOutCommand
},
addShortcutKeys: {
"zoom-in": "+", //=
"zoom-out": "-" //-
},
events: { events: {
'ready': function () {
this._zoomValue = 1;
},
'mousewheel': function ( e ) { 'mousewheel': function ( e ) {
if ( e.originEvent.wheelDelta > 0 ) { var delta = e.originEvent.wheelDelta;
if ( this._zoom < 0.2 ) return; var me = this;
this._zoom *= 0.95;
this.getRenderContainer().scale( 0.95 ); // 稀释
if ( Math.abs( delta ) > 100 ) {
clearTimeout( this._wheelZoomTimeout );
} else { } else {
if ( this._zoom > 5 ) return; return;
this._zoom /= 0.95;
this.getRenderContainer().scale( 1 / 0.95 );
} }
this._wheelZoomTimeout = setTimeout( function () {
var value;
var lastValue = me.getPaper()._zoom || 1;
if ( delta < 0 ) {
me.execCommand('zoom-in');
} else if ( delta > 0 ) {
me.execCommand('zoom-out');
}
}, 100 );
e.originEvent.preventDefault(); e.originEvent.preventDefault();
},
'ready': function () {
this._zoom = 1;
} }
} }
};*/ };
return {};
} ); } );
\ No newline at end of file
This diff is collapsed.
/*modal 类*/ /*modal 类*/
KM.ui.define('modal', { KM.ui.define( 'modal', {
tpl: '<div class="kmui-modal" tabindex="-1" >' + tpl: '<div class="kmui-modal" tabindex="-1" >' +
'<div class="kmui-modal-header">' + '<div class="kmui-modal-header">' +
'<div class="kmui-close" data-hide="modal"></div>' + '<div class="kmui-close" data-hide="modal"></div>' +
...@@ -24,70 +24,79 @@ KM.ui.define('modal', { ...@@ -24,70 +24,79 @@ KM.ui.define('modal', {
backdrop: true, backdrop: true,
keyboard: true keyboard: true
}, },
init: function (options) { init: function ( options ) {
var me = this; var me = this;
me.root($($.parseTmpl(me.tpl, options || {}))); me.root( $( $.parseTmpl( me.tpl, options || {} ) ) );
me.data("options", options); me.data( "options", options );
if (options.okFn) { if ( options.okFn ) {
me.on('ok', $.proxy(options.okFn, me)) me.on( 'ok', $.proxy( options.okFn, me ) )
} }
if (options.cancelFn) { if ( options.cancelFn ) {
me.on('beforehide', $.proxy(options.cancelFn, me)) me.on( 'beforehide', $.proxy( options.cancelFn, me ) )
} }
me.root().delegate('[data-hide="modal"]', 'click', $.proxy(me.hide, me)) me.root().delegate( '[data-hide="modal"]', 'click', $.proxy( me.hide, me ) )
.delegate('[data-ok="modal"]', 'click', $.proxy(me.ok, me)); .delegate( '[data-ok="modal"]', 'click', $.proxy( me.ok, me ) );
$('[data-hide="modal"],[data-ok="modal"]',me.root()).hover(function(){ $( '[data-hide="modal"],[data-ok="modal"]', me.root() ).hover( function () {
$(this).toggleClass('kmui-hover') $( this ).toggleClass( 'kmui-hover' )
}); } );
setTimeout( function () {
$( '.kmui-modal' ).draggable( {
handle: '.kmui-modal-header'
} );
}, 100 );
}, },
toggle: function () { toggle: function () {
var me = this; var me = this;
return me[!me.data("isShown") ? 'show' : 'hide'](); return me[ !me.data( "isShown" ) ? 'show' : 'hide' ]();
}, },
show: function () { show: function () {
var me = this; var me = this;
me.trigger("beforeshow"); me.trigger( "beforeshow" );
if (me.data("isShown")) return; if ( me.data( "isShown" ) ) return;
me.data("isShown", true); me.data( "isShown", true );
me.escape(); me.escape();
me.backdrop(function () { me.backdrop( function () {
me.autoCenter(); me.autoCenter();
me.root() me.root()
.show() .show()
.focus() .focus()
.trigger('aftershow'); .trigger( 'aftershow' );
}) } );
$( '.kmui-modal' ).draggable( {
handle: '.kmui-modal-header'
} );
}, },
showTip: function ( text ) { showTip: function ( text ) {
$( '.kmui-modal-tip', this.root() ).html( text ).fadeIn(); $( '.kmui-modal-tip', this.root() ).html( text ).fadeIn();
}, },
hideTip: function ( text ) { hideTip: function ( text ) {
$( '.kmui-modal-tip', this.root() ).fadeOut( function (){ $( '.kmui-modal-tip', this.root() ).fadeOut( function () {
$(this).html(''); $( this ).html( '' );
} ); } );
}, },
autoCenter: function () { autoCenter: function () {
//ie6下不用处理了 //ie6下不用处理了
!$.IE6 && this.root().css("margin-left", -(this.root().width() / 2)); !$.IE6 && this.root().css( "margin-left", -( this.root().width() / 2 ) );
}, },
hide: function () { hide: function () {
var me = this; var me = this;
me.trigger("beforehide"); me.trigger( "beforehide" );
if (!me.data("isShown")) return; if ( !me.data( "isShown" ) ) return;
me.data("isShown", false); me.data( "isShown", false );
me.escape(); me.escape();
...@@ -95,61 +104,58 @@ KM.ui.define('modal', { ...@@ -95,61 +104,58 @@ KM.ui.define('modal', {
}, },
escape: function () { escape: function () {
var me = this; var me = this;
if (me.data("isShown") && me.data("options").keyboard) { if ( me.data( "isShown" ) && me.data( "options" ).keyboard ) {
me.root().on('keyup', function (e) { me.root().on( 'keyup', function ( e ) {
e.which == 27 && me.hide(); e.which == 27 && me.hide();
}) } )
} } else if ( !me.data( "isShown" ) ) {
else if (!me.data("isShown")) { me.root().off( 'keyup' );
me.root().off('keyup');
} }
}, },
hideModal: function () { hideModal: function () {
var me = this; var me = this;
me.root().hide(); me.root().hide();
me.backdrop(function () { me.backdrop( function () {
me.removeBackdrop(); me.removeBackdrop();
me.trigger('afterhide'); me.trigger( 'afterhide' );
}) } )
}, },
removeBackdrop: function () { removeBackdrop: function () {
this.$backdrop && this.$backdrop.remove(); this.$backdrop && this.$backdrop.remove();
this.$backdrop = null; this.$backdrop = null;
}, },
backdrop: function (callback) { backdrop: function ( callback ) {
var me = this; var me = this;
if (me.data("isShown") && me.data("options").backdrop) { if ( me.data( "isShown" ) && me.data( "options" ).backdrop ) {
me.$backdrop = $('<div class="kmui-modal-backdrop" />').click( me.$backdrop = $( '<div class="kmui-modal-backdrop" />' ).click(
me.data("options").backdrop == 'static' ? me.data( "options" ).backdrop == 'static' ?
$.proxy(me.root()[0].focus, me.root()[0]) $.proxy( me.root()[ 0 ].focus, me.root()[ 0 ] ) : $.proxy( me.hide, me )
: $.proxy(me.hide, me)
) )
} }
me.trigger('afterbackdrop'); me.trigger( 'afterbackdrop' );
callback && callback(); callback && callback();
}, },
attachTo: function ($obj) { attachTo: function ( $obj ) {
var me = this var me = this
if (!$obj.data('$mergeObj')) { if ( !$obj.data( '$mergeObj' ) ) {
$obj.data('$mergeObj', me.root()); $obj.data( '$mergeObj', me.root() );
$obj.on('click', function () { $obj.on( 'click', function () {
me.toggle($obj) me.toggle( $obj )
}); } );
me.data('$mergeObj', $obj) me.data( '$mergeObj', $obj )
} }
}, },
ok: function () { ok: function () {
var me = this; var me = this;
me.trigger('beforeok'); me.trigger( 'beforeok' );
if (me.trigger("ok", me) === false) { if ( me.trigger( "ok", me ) === false ) {
return; return;
} }
me.hide(); me.hide();
}, },
getBodyContainer: function () { getBodyContainer: function () {
return this.root().find('.kmui-modal-body') return this.root().find( '.kmui-modal-body' )
} }
}); } );
\ No newline at end of file
.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;
font-family:Arial, "Heiti SC", "Microsoft Yahei";
}
.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
...@@ -16,4 +16,16 @@ ...@@ -16,4 +16,16 @@
} }
.kmui-btn-toolbar .kmui-btn .kmui-icon-hand { .kmui-btn-toolbar .kmui-btn .kmui-icon-hand {
background: url(../images/hand.png) no-repeat 2px 2px; background: url(../images/hand.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-markers {
background: url(../images/flag.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-clock {
background: url(../images/clock.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-zoom-in {
background: url(../images/zoom_in.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-zoom-out {
background: url(../images/zoom_out.png) no-repeat 2px 2px;
} }
\ No newline at end of file
.kmui-modal { .kmui-modal {
position: fixed; position: fixed;
_position: absolute; top: 10px;
top: 10%; right:10px;
left: 50%;
border: 1px solid #acacac;
box-shadow: 2px 2px 5px #d3d6da;
background-color: #ffffff; background-color: #ffffff;
outline: 0; outline: 0;
border-radius: 5px;
box-shadow: 3px 3px 8px rgba(0,0,0, .5);
} }
.kmui-modal-header { .kmui-modal-header {
padding: 5px 10px; padding: 5px 10px;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
cursor: move;
} }
.kmui-modal-header .kmui-close { .kmui-modal-header .kmui-close {
float: right; float: right;
......
/*图片上传*/
.kmui-dialog-image-body {
width: 700px;
height: 400px;
}
/*插入视频*/
.kmui-dialog-video-body{
width: 600px;
height: 350px;
}
/*谷歌地图*/
.kmui-dialog-gmap-body{
width:550px;
height: 400px;
}
/*百度地图*/
.kmui-dialog-map-body{
width:580px;
height: 400px;
}
/*链接*/
.kmui-dialog-link-body{
width:400px;
height:200px;
}
\ 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";
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