Commit c20be595 authored by techird's avatar techird

commit

parent 4dc690c8
...@@ -73,8 +73,12 @@ module.exports = function ( grunt ) { ...@@ -73,8 +73,12 @@ module.exports = function ( grunt ) {
copy: { copy: {
dir: { dir: {
files: [ { files: [ {
src: [ 'dialogs/**', 'lang/**', 'lib/**', 'social/**', 'themes/**' ], src: [ 'dialogs/**', 'lang/**', 'lib/**', 'social/**', 'themes/**', 'index.html' ],
dest: distPath dest: distPath
}, {
src: [ 'kity/dist/kitygraph.all.min.js' ],
dest: distPath + 'lib/',
flatten: true
} ] } ]
} }
}, },
...@@ -83,8 +87,8 @@ module.exports = function ( grunt ) { ...@@ -83,8 +87,8 @@ module.exports = function ( grunt ) {
src: distPath + 'index.html', src: distPath + 'index.html',
overwrite: true, overwrite: true,
replacements: [ { replacements: [ {
from: /1234567890/ig, from: /kity\/dist\/kitygraph\.all\.js/ig,
to: '1234567890' to: 'lib/kitygraph.all.min.js'
} ] } ]
} }
}, },
......
( function () {
//todo 这里先写死成中文
var content = '<div class="hyperlink-content" style="padding:20px;width:360px;">';
content += '<p><label>输入链接: <input id="hyperlink_href" style="width:90%;" /></label></p>';
content += '<p style="text-align:right"><button id="hyperlink_insert">插入</button></p>';
content += '</div>';
KM.registerWidget( 'hyperlink', {
tpl: content,
initContent: function ( km ) {
var lang = km.getLang( 'dialogs.hyperlink' ),
html;
if ( lang ) {
html = $.parseTmpl( this.tpl, lang );
}
this.root().html( html );
},
initEvent: function ( km, $w ) {
$w.find('#hyperlink_insert').on('click',function(){
km.execCommand('hyperlink',$w.find('#hyperlink_href').val());
$w.kmui().hide();
});
var url = km.queryCommandValue('hyperlink');
var $input = $w.find('#hyperlink_href');
$input.val(url || 'http://');
setTimeout(function(){
$input.focus()
})
},
width: 400
} );
} )();
\ No newline at end of file
( function () { ( function () {
var utils = KM.utils;
KM.registerWidget( 'markers', { KM.registerWidget( 'markers', {
tpl: "<ul class='icon-list priority'>" + tpl:"<style>"+
".kmui-dialog-<%= container %> .priority .icon{background:url(dialogs/markers/images/iconpriority.png) 0 0}"+
".kmui-dialog-<%= container %> .progress .icon{background:url(dialogs/markers/images/iconprogress.png) 0 0}"+
".kmui-dialog-<%= container %> .icon.p2{background-position: -20px 0}"+
".kmui-dialog-<%= container %> .icon.p3{background-position: -40px 0}"+
".kmui-dialog-<%= container %> .icon.p4{background-position: -60px 0}"+
".kmui-dialog-<%= container %> .icon.p5{background-position: -80px 0}"+
"</style>"+
"<ul class='icon-list priority'>" +
"<li value='1' type='priority'><span class='icon p1'></span><span><%= priority %>1</span></li>" + "<li value='1' type='priority'><span class='icon p1'></span><span><%= priority %>1</span></li>" +
"<li value='2' type='priority'><span class='icon p2'></span><span><%= priority %>2</span></li>" + "<li value='2' type='priority'><span class='icon p2'></span><span><%= priority %>2</span></li>" +
"<li value='3' type='priority'><span class='icon p3'></span><span><%= priority %>3</span></li>" + "<li value='3' type='priority'><span class='icon p3'></span><span><%= priority %>3</span></li>" +
...@@ -15,10 +22,10 @@ ...@@ -15,10 +22,10 @@
"<li value='4' type='progress'><span class='icon p4'></span><span><%= progress.threequartersdone %></span></li>" + "<li value='4' type='progress'><span class='icon p4'></span><span><%= progress.threequartersdone %></span></li>" +
"<li value='5' type='progress'><span class='icon p5'></span><span><%= progress.done %></span></li>" + "<li value='5' type='progress'><span class='icon p5'></span><span><%= progress.done %></span></li>" +
"</ul>", "</ul>",
initContent: function ( km ) { initContent: function ( km ,$w) {
var lang = km.getLang( 'dialogs.markers' ); var lang = km.getLang( 'dialogs.markers' );
if ( lang ) { if ( lang ) {
var html = $.parseTmpl( this.tpl, lang ); var html = $.parseTmpl( this.tpl, utils.extend({'container':'markers'},lang) );
} }
this.root().html( html ); this.root().html( html );
}, },
...@@ -43,23 +50,6 @@ ...@@ -43,23 +50,6 @@
$w.find( "li[type='progress'][value='" + valPro + "']" ).addClass( "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 width: 200
} ) } )
......
...@@ -2,18 +2,49 @@ ...@@ -2,18 +2,49 @@
//todo 这里先写死成中文 //todo 这里先写死成中文
var preferenceContent = '<div class="help-content" style="padding:20px;width:360px;">'; var preferenceContent = '<div class="help-content" style="padding:20px;width:360px;">';
preferenceContent += '<h3>展开属性设置</h3>'; preferenceContent += '<h3>展开属性设置</h3>';
preferenceContent += '<p><label><input type="checkbox" name="expand" />是否全部展开</label></p>'; preferenceContent += '<p><label><input type="checkbox" name="expand" />打开时展开全部节点(刷新页面生效)</label></p>';
preferenceContent += '<p><hr/></p>';
preferenceContent += '<p><button id="reset_preference">重置</button></p>';
//preferenceContent += '<p><label><b style="color:red">有些偏好设置会在你下次刷新页面时生效</b></label></p>';
preferenceContent += '</div>'; preferenceContent += '</div>';
//todo 偏好设置暂时都在这里处理 //todo 偏好设置暂时都在这里处理
//用于在reset所有偏好时,清除这个dialog下的所有偏好
var allPreferences = {};
function execExpand(km,$w){ function checkEverything( km, $w ) {
var checked = $w.find('[name=expand]').checked(); checkExpand( km, $w )
if(checked){ }
function initEverything( km, $w ) {
initExpand( km, $w )
}
//展开
function initExpand( km, $w ) {
var expand = km.getOptions( 'defaultExpand' );
$w.find( '[name=expand]' )[ 0 ].checked = expand && expand.defaultLayer == 0;
allPreferences[ 'defaultExpand' ] = null;
}
function checkExpand( km, $w ) {
var checked = $w.find( '[name=expand]' )[ 0 ].checked;
if ( checked ) {
km.setPreferences( 'defaultExpand', {
'defaultLayer': 0,
'defaultSubShow': 0
} )
} else {
km.setPreferences( 'defaultExpand' )
} }
} }
//重置偏好
function resetPreferences( km ) {
km.setPreferences( allPreferences )
}
KM.registerWidget( 'preference', { KM.registerWidget( 'preference', {
tpl: preferenceContent, tpl: preferenceContent,
initContent: function ( km ) { initContent: function ( km ) {
...@@ -23,13 +54,18 @@ ...@@ -23,13 +54,18 @@
html = $.parseTmpl( this.tpl, lang ); html = $.parseTmpl( this.tpl, lang );
} }
this.root().html( html ); this.root().html( html );
}, },
initEvent: function ( km, $w ) { initEvent: function ( km, $w ) {
//绑定默认值
initEverything( km, $w );
$w.find( '#reset_preference' ).on( 'click', function ( e ) {
resetPreferences( km );
//重置系统默认的偏好设置
initEverything( km, $w )
} );
$w.on( 'click', '.kmui-close', function ( e ) { $w.on( 'click', '.kmui-close', function ( e ) {
checkEverything( km, $w );
km.fire('preferenceschange') km.fire( 'preferencechange' )
} ); } );
}, },
width: 400 width: 400
......
...@@ -2,37 +2,32 @@ ...@@ -2,37 +2,32 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="keywords" content="思维导图,脑图,minder,mind,kity">
<meta name="description" content="在线思维导图工具"> <script src="lib/jquery-2.1.0.min.js" charset="utf-8"></script>
<script src="../lib/jquery-2.1.0.min.js" charset="utf-8"></script> <script src="lib/ZeroClipboard.min.js" charset="utf-8"></script>
<script src="../lib/ZeroClipboard.min.js" charset="utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
ZeroClipboard.setDefaults( { moviePath: '../lib/ZeroClipboard.swf' } ); ZeroClipboard.setDefaults( { moviePath: 'lib/ZeroClipboard.swf' } );
</script> </script>
<script src="../kity/dist/kitygraph.all.min.js" charset="utf-8"></script> <script src="lib/kitygraph.all.min.js" charset="utf-8"></script>
<script src="../dist/kityminder.all.min.js" charset="utf-8"></script> <script src="import.js" charset="utf-8"></script>
<script src="../kityminder.config.js" charset="utf-8"></script> <script src="kityminder.config.js" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js" charset="utf-8"></script>
<script src="../lang/zh-cn/zh-cn.js" charset="utf-8"></script> <script src="lib/zip.js" charset="utf-8"></script>
<script src="../lib/zip.js" charset="utf-8"></script>
<script> <script>
zip.inflateJSPath = '../lib/inflate.js'; zip.inflateJSPath = 'lib/inflate.js';
</script> </script>
<script src="../lib/jquery.xml2json.js" charset="utf-8"></script>
<script src="../lib/baidu-frontia-js-full-1.0.0.js" charset="utf-8"></script>
<script src="../social/draftmanager.js" charset="utf-8"></script>
<script src="../social/social.js" charset="utf-8"></script>
<link href="../social/social.css" rel="stylesheet">
<link href="../themes/default/css/import.css" type="text/css" rel="stylesheet" /> <script src="lib/jquery.xml2json.js" charset="utf-8"></script>
<link href="../dialogs/dialogs.css" rel="stylesheet" type="text/css" /> <script src="lib/baidu-frontia-js-full-1.0.0.js" charset="utf-8"></script>
<script src="social/draftmanager.js" charset="utf-8"></script>
<link rel="stylesheet" href="css/links.css" /> <script src="social/social.js" charset="utf-8"></script>
<link href="social/social.css" rel="stylesheet">
<link href="themes/default/css/import.css" type="text/css" rel="stylesheet" />
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon"> <link href="favicon.ico" type="image/x-icon" rel="shortcut icon">
<link href="favicon.ico" type="image/x-icon" rel="apple-touch-icon-precomposed"> <link href="favicon.ico" type="image/x-icon" rel="apple-touch-icon-precomposed">
</head> </head>
<body> <body>
...@@ -40,7 +35,7 @@ ...@@ -40,7 +35,7 @@
<div id="share-dialog" > <div id="share-dialog" >
<h3>URL分享:</h3> <h3>URL分享:</h3>
<p> <p>
<input id="share-url" type="url" value="" /> <input id="share-url" type="url" value="http://naotu.baidu.com/?shareId=kcev3dd" />
<button id="copy-share-url" data-clipboard-target="share-url" type="button">复制</button> <button id="copy-share-url" data-clipboard-target="share-url" type="button">复制</button>
</p> </p>
<h3>社交分享:</h3> <h3>社交分享:</h3>
...@@ -52,27 +47,11 @@ ...@@ -52,27 +47,11 @@
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a> <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
</p> </p>
</div> </div>
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdMini":"2","bdMiniList":[],"bdPic":"","bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
<p id="about"> <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdMini":"2","bdMiniList":[],"bdPic":"","bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
KityMinder <a id="km-version" href="https://github.com/fex-team/kityminder/blob/dev/CHANGELOG.md" target="blank"></a>, Powered by f-cube, <a href="http://fex.baidu.com" target="_blank">FEX</a> |
<a href="https://github.com/fex-team/kityminder.git" target="_blank">Source</a> |
<a href="https://github.com/fex-team/kityminder/issues/new" target="_blank">Report a Bug</a> |
<a href="mailto:kity@baidu.com" target="_blank">Contact Us</a>
</p>
</body> </body>
<script> <script>
// create km instance // create km instance
window.km = KM.getKityMinder('kityminder'); window.km = KM.getKityMinder('kityminder');
$(function() {
var lastVersion = localStorage.lastKMVersion;
$('#km-version').text( 'v' + KM.version );
if( lastVersion != KM.version ) {
$( '#km-version' ).addClass( 'new-version' );
localStorage.lastKMVersion = KM.version;
}
});
</script> </script>
</html> </html>
\ No newline at end of file
/*! /*!
* ==================================================== * ====================================================
* kityminder - v1.0.0 - 2014-05-07 * kityminder - v1.0.0 - 2014-05-08
* https://github.com/fex-team/kityminder * https://github.com/fex-team/kityminder
* GitHub: https://github.com/fex-team/kityminder.git * GitHub: https://github.com/fex-team/kityminder.git
* Copyright (c) 2014 f-cube @ FEX; Licensed MIT * Copyright (c) 2014 f-cube @ FEX; Licensed MIT
...@@ -292,7 +292,7 @@ var utils = Utils = KityMinder.Utils = { ...@@ -292,7 +292,7 @@ var utils = Utils = KityMinder.Utils = {
} }
}; };
element.onerror = function () { element.onerror = function () {
throw Error('The load ' + (obj.href || obj.src) + ' fails,check the url settings of file umeditor.config.js ') throw Error('The load ' + (obj.href || obj.src) + ' fails,check the url settings of file ')
}; };
doc.getElementsByTagName("head")[0].appendChild(element); doc.getElementsByTagName("head")[0].appendChild(element);
} }
...@@ -614,12 +614,13 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", { ...@@ -614,12 +614,13 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
}, },
clone: function () { clone: function () {
function cloneNode( parent, isClonedNode ) { function cloneNode( parent, isClonedNode) {
var _tmp = new KM.MinderNode( isClonedNode.getText() ); var _tmp = new KM.MinderNode( isClonedNode.getText() );
_tmp.data = Utils.clonePlainObject( isClonedNode.getData() ); _tmp.data = Utils.clonePlainObject( isClonedNode.getData() );
_tmp.tmpData = Utils.clonePlainObject( isClonedNode.getTmpData() ) _tmp.tmpData = Utils.clonePlainObject( isClonedNode.getTmpData() );
_tmp.parent = parent; _tmp.parent = parent;
if ( parent ) { if ( parent ) {
parent.children.push( _tmp ); parent.children.push( _tmp );
} }
...@@ -673,6 +674,9 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", { ...@@ -673,6 +674,9 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
isHighlight: function () { isHighlight: function () {
return this.getTmpData( 'highlight' ) return this.getTmpData( 'highlight' )
}, },
select:function(){
this.setTmpData('highlight',true)
},
setTmpData: function ( a, v ) { setTmpData: function ( a, v ) {
var me = this; var me = this;
if ( utils.isObject( a ) ) { if ( utils.isObject( a ) ) {
...@@ -1047,7 +1051,7 @@ function importNode( node, json, km ) { ...@@ -1047,7 +1051,7 @@ function importNode( node, json, km ) {
for ( var field in data ) { for ( var field in data ) {
node.setData( field, data[ field ] ); node.setData( field, data[ field ] );
} }
node.setData( 'text',data.text || km.getLang( DEFAULT_TEXT[ node.getType() ] ) ); node.setData( 'text', data.text || km.getLang( DEFAULT_TEXT[ node.getType() ] ) );
var childrenTreeData = json.children; var childrenTreeData = json.children;
if ( !childrenTreeData ) return; if ( !childrenTreeData ) return;
...@@ -1059,7 +1063,6 @@ function importNode( node, json, km ) { ...@@ -1059,7 +1063,6 @@ function importNode( node, json, km ) {
return node; return node;
} }
// 导入导出 // 导入导出
kity.extendClass( Minder, { kity.extendClass( Minder, {
exportData: function ( protocalName ) { exportData: function ( protocalName ) {
...@@ -1068,11 +1071,11 @@ kity.extendClass( Minder, { ...@@ -1068,11 +1071,11 @@ kity.extendClass( Minder, {
json = exportNode( this.getRoot() ); json = exportNode( this.getRoot() );
protocal = KityMinder.findProtocal( protocalName ); protocal = KityMinder.findProtocal( protocalName );
if(this._fire( new MinderEvent( 'beforeexport', { if ( this._fire( new MinderEvent( 'beforeexport', {
json:json, json: json,
protocalName: protocalName, protocalName: protocalName,
protocal: protocal protocal: protocal
},true ) ) === true) return; }, true ) ) === true ) return;
if ( protocal ) { if ( protocal ) {
return protocal.encode( json, this ); return protocal.encode( json, this );
...@@ -1112,22 +1115,22 @@ kity.extendClass( Minder, { ...@@ -1112,22 +1115,22 @@ kity.extendClass( Minder, {
//******************* //*******************
function ts(d, str, last){ function ts( d, str, last ) {
var h = d.getHours(), var h = d.getHours(),
m = d.getMinutes(), m = d.getMinutes(),
s = d.getSeconds(), s = d.getSeconds(),
ms = d.getMilliseconds(); ms = d.getMilliseconds();
if(last){ if ( last ) {
console.log('--- '+str+': '+(d-last)+' ---'); console.log( '--- ' + str + ': ' + ( d - last ) + ' ---' );
}else{ } else {
console.log('--- '+str+' ---'); console.log( '--- ' + str + ' ---' );
} }
return d; return d;
} }
var t1 = ts(new Date(), '开始解析'); var t1 = ts( new Date(), '开始解析' );
//******************* //*******************
json = params.json || ( params.json = protocal.decode( local ) ); json = params.json || ( params.json = protocal.decode( local ) );
...@@ -1136,20 +1139,20 @@ kity.extendClass( Minder, { ...@@ -1136,20 +1139,20 @@ kity.extendClass( Minder, {
var self = this; var self = this;
json.then( local, function ( data ) { json.then( local, function ( data ) {
//******************* //*******************
var t2 = ts(new Date(), '解压解析耗时', t1); var t2 = ts( new Date(), '解压解析耗时', t1 );
//******************* //*******************
self._afterImportData( data, params ); self._afterImportData( data, params );
//******************* //*******************
ts(new Date(), '渲染耗时', t2); ts( new Date(), '渲染耗时', t2 );
//******************* //*******************
} ); } );
} else { } else {
//******************* //*******************
var t2 = ts(new Date(), '解压解析耗时', t1); var t2 = ts( new Date(), '解压解析耗时', t1 );
//******************* //*******************
this._afterImportData( json, params ); this._afterImportData( json, params );
//******************* //*******************
ts(new Date(), '渲染耗时', t2); ts( new Date(), '渲染耗时', t2 );
//******************* //*******************
} }
return this; return this;
...@@ -1166,7 +1169,7 @@ kity.extendClass( Minder, { ...@@ -1166,7 +1169,7 @@ kity.extendClass( Minder, {
this._root.setData(); this._root.setData();
this._root.setData( "currentstyle", curLayout ); this._root.setData( "currentstyle", curLayout );
importNode( this._root, json, this ); importNode( this._root, json, this );
this.fire( 'beforeimport' );
this._fire( new MinderEvent( 'import', params, false ) ); this._fire( new MinderEvent( 'import', params, false ) );
this._firePharse( { this._firePharse( {
type: 'contentchange' type: 'contentchange'
...@@ -1512,57 +1515,87 @@ kity.extendClass( Minder, { ...@@ -1512,57 +1515,87 @@ kity.extendClass( Minder, {
} ); } );
var keymap = KityMinder.keymap = { var keymap = KityMinder.keymap = {
'Backspace' : 8, 'Backspace': 8,
'Tab' : 9, 'Tab': 9,
'Enter' : 13, 'Enter': 13,
'Shift' : 16, 'Shift': 16,
'Control' : 17, 'Control': 17,
'Alt' : 18, 'Alt': 18,
'CapsLock' : 20, 'CapsLock': 20,
'Esc': 27, 'Esc': 27,
'Spacebar' : 32, 'Spacebar': 32,
'PageUp' : 33, 'PageUp': 33,
'PageDown' : 34, 'PageDown': 34,
'End' : 35, 'End': 35,
'Home' : 36, 'Home': 36,
'Left' : 37, 'Left': 37,
'Up' : 38, 'Up': 38,
'Right' : 39, 'Right': 39,
'Down' : 40, 'Down': 40,
'Insert' : 45, 'Insert': 45,
'Del' : 46, 'Del': 46,
'NumLock' : 144, 'NumLock': 144,
'Cmd' : 91, 'Cmd': 91,
'F2' : 113, 'F2': 113,
'F3' : 114, 'F3': 114,
'F4' : 115, 'F4': 115,
'=' : 187, '=': 187,
'-' : 189, '-': 189,
"b" : 66, "b": 66,
'i' : 73, 'i': 73,
//回退 //回退
'z' : 90, 'z': 90,
'y' : 89, 'y': 89,
//粘贴 //粘贴
'v' : 86, 'v': 86,
'x' : 88, 'x': 88,
's' : 83, 's': 83,
'n' : 78 'n': 78,
'/': 191,
'.': 190,
'notContentInput': {
8: 1,
46: 1,
13: 1,
9: 1,
33: 1,
34: 1,
35: 1,
36: 1,
16: 1,
17: 1,
18: 1,
//上下左右
37: 1,
38: 1,
39: 1,
40: 1,
113:1
},
'isSelectedNodeKey': {
//上下左右
37: 1,
38: 1,
39: 1,
40: 1,
13: 1,
9: 1
}
}; };
//添加多语言模块 //添加多语言模块
...@@ -2043,7 +2076,7 @@ KityMinder.registerModule( "HistoryModule", function () { ...@@ -2043,7 +2076,7 @@ KityMinder.registerModule( "HistoryModule", function () {
return this.data; return this.data;
}, },
cloneData: function () { cloneData: function () {
return this.getData().clone(); return this.getData().clone( );
}, },
equals: function ( scene ) { equals: function ( scene ) {
return this.getData().equals( scene.getData() ) return this.getData().equals( scene.getData() )
...@@ -2188,11 +2221,10 @@ KityMinder.registerModule( "HistoryModule", function () { ...@@ -2188,11 +2221,10 @@ KityMinder.registerModule( "HistoryModule", function () {
"saveScene": function ( e ) { "saveScene": function ( e ) {
this.historyManager.saveScene(); this.historyManager.saveScene();
}, },
"renderNode": function ( e ) { 'renderNode': function ( e ) {
var node = e.node; var node = e.node;
if ( node.isSelected() ) {
if ( node.isHighlight() ) { this.select( node )
km.select( node );
} }
}, },
"keydown": function ( e ) { "keydown": function ( e ) {
...@@ -2341,6 +2373,12 @@ KityMinder.registerModule( "IconModule", function () { ...@@ -2341,6 +2373,12 @@ KityMinder.registerModule( "IconModule", function () {
} ); } );
KityMinder.registerModule( "LayoutModule", function () { KityMinder.registerModule( "LayoutModule", function () {
var me = this;
var clearPaper = function () {
me._rc.remove();
me._rc = new kity.Group();
me._paper.addShape( this._rc );
};
kity.extendClass( Minder, { kity.extendClass( Minder, {
addLayoutStyle: function ( name, style ) { addLayoutStyle: function ( name, style ) {
if ( !this._layoutStyles ) this._layoutStyles = {}; if ( !this._layoutStyles ) this._layoutStyles = {};
...@@ -2457,10 +2495,10 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -2457,10 +2495,10 @@ KityMinder.registerModule( "LayoutModule", function () {
if ( !parent ) { if ( !parent ) {
return null; return null;
} }
if ( parent.getType() !== "root" && parent.getChildren().length !== 0 && parent.getData( "expand" ) === false ) { if ( parent.getType() !== "root" && parent.getChildren().length !== 0 && !parent.isExpanded() ) {
km.expandNode( parent ); km.expandNode( parent );
} }
parent.expand();
km.appendChildNode( parent, node, focus, silbling ); km.appendChildNode( parent, node, focus, silbling );
km.select( node, true ); km.select( node, true );
return node; return node;
...@@ -2546,6 +2584,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -2546,6 +2584,7 @@ KityMinder.registerModule( "LayoutModule", function () {
return null; return null;
} }
km.select( selectedNode, true ); km.select( selectedNode, true );
km.textEditNode(selectedNode);
}, },
queryState: function ( km ) { queryState: function ( km ) {
var selectedNode = km.getSelectedNode(); var selectedNode = km.getSelectedNode();
...@@ -2555,9 +2594,9 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -2555,9 +2594,9 @@ KityMinder.registerModule( "LayoutModule", function () {
return 0; return 0;
} }
}, },
isNeedUndo: function () { isNeedUndo: function () {
return false; return false;
} }
}; };
} )() ); } )() );
...@@ -2588,7 +2627,7 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -2588,7 +2627,7 @@ KityMinder.registerModule( "LayoutModule", function () {
}.bind( this ), 100 ); }.bind( this ), 100 );
}, },
"import": function ( e ) { "import": function ( e ) {
this.initStyle( this.getRoot() ); this.initStyle();
} }
}, },
'contextmenu': [ { 'contextmenu': [ {
...@@ -2669,7 +2708,9 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -2669,7 +2708,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
iconShape.addShapes( [ circle, plus, dec ] ); iconShape.addShapes( [ circle, plus, dec ] );
this.update(); this.update();
}, },
switchState: function () { switchState: function ( val ) {
if ( val === true || val === false )
this._show = !val;
if ( !this._show ) { if ( !this._show ) {
this._plus.setOpacity( 0 ); this._plus.setOpacity( 0 );
this._dec.setOpacity( 1 ); this._dec.setOpacity( 1 );
...@@ -3058,9 +3099,6 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -3058,9 +3099,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
if ( nodeType !== "root" && node.getChildren().length !== 0 ) { if ( nodeType !== "root" && node.getChildren().length !== 0 ) {
if ( !Layout.shicon ) { if ( !Layout.shicon ) {
Layout.shicon = new ShIcon( node ); Layout.shicon = new ShIcon( node );
if ( node.getData( 'expand' ) ) {
Layout.shicon.switchState();
}
} }
Layout.shicon.update(); Layout.shicon.update();
} }
...@@ -3128,7 +3166,9 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -3128,7 +3166,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
this._firePharse( new MinderEvent( "RenderNodeTop", { this._firePharse( new MinderEvent( "RenderNodeTop", {
node: node node: node
}, false ) ); }, false ) );
this._firePharse( new MinderEvent( "RenderNode", {
node: node
}, false ) );
updateShapeByCont( node ); updateShapeByCont( node );
var set1 = updateLayoutHorizon( node ); var set1 = updateLayoutHorizon( node );
var set2 = updateLayoutVertical( node, node.getParent(), "change" ); var set2 = updateLayoutVertical( node, node.getParent(), "change" );
...@@ -3142,6 +3182,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -3142,6 +3182,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
} }
}, },
initStyle: function () { initStyle: function () {
//渲染根节点
var _root = minder.getRoot(); var _root = minder.getRoot();
var historyPoint = _root.getPoint(); var historyPoint = _root.getPoint();
if ( historyPoint ) historyPoint = JSON.parse( JSON.stringify( historyPoint ) ); if ( historyPoint ) historyPoint = JSON.parse( JSON.stringify( historyPoint ) );
...@@ -3166,59 +3207,76 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -3166,59 +3207,76 @@ KityMinder.registerModule( "LayoutDefault", function () {
this._firePharse( new MinderEvent( "RenderNodeTop", { this._firePharse( new MinderEvent( "RenderNodeTop", {
node: _root node: _root
}, false ) ); }, false ) );
this._firePharse( new MinderEvent( "RenderNode", {
node: _root
}, false ) );
updateShapeByCont( _root ); updateShapeByCont( _root );
updateLayoutHorizon( _root ); updateLayoutHorizon( _root );
updateLayoutVertical( _root ); updateLayoutVertical( _root );
translateNode( _root ); translateNode( _root );
if ( historyPoint ) _root.setPoint( historyPoint.x, historyPoint.y ); if ( historyPoint ) _root.setPoint( historyPoint.x, historyPoint.y );
var expandoptions = minder.getOptions( 'defaultExpand' ); //渲染首层节点
var cur_layer = 0;
var expand_layer = expandoptions.defaultLayer;
var mains = _root.getChildren(); var mains = _root.getChildren();
for ( var i = 0; i < mains.length; i++ ) { for ( var i = 0; i < mains.length; i++ ) {
this.appendChildNode( _root, mains[ i ] ); this.appendChildNode( _root, mains[ i ] );
if ( mains[ i ].isExpanded() && ( mains[ i ].getChildren().length > 0 ) ) {
minder.expandNode( mains[ i ] );
}
} }
cur_layer++; _root.setPoint( _root.getLayout().x, _root.getLayout().y );
//创建一级节点的副本 },
var _buffer = ( function () { expandNode: function ( ico ) {
var items = []; var isExpand, node;
for ( var i = 0; i < mains.length; i++ ) { if ( ico instanceof MinderNode ) {
items.push( mains[ i ] ); node = ico;
isExpand = node.getLayout().shicon.switchState();
} else {
isExpand = ico.icon.switchState();
node = ico.icon._node;
}
var _buffer;
if ( isExpand ) {
node.expand();
//遍历子树展开需要展开的节点
_buffer = [ node ];
while ( _buffer.length !== 0 ) {
var c = _buffer[ 0 ].getChildren();
if ( _buffer[ 0 ].isExpanded() && c.length !== 0 ) {
for ( var x = 0; x < c.length; x++ ) {
minder.appendChildNode( _buffer[ 0 ], c[ x ] );
}
_buffer = _buffer.concat( c );
}
_buffer.shift();
} }
return items; } else {
} )(); node.collapse();
next = []; //遍历子树移除需要移除的节点
var layer_nolimit = ( expand_layer < 1 ) || false; _buffer = node.getChildren();
var sub_nolimit = ( expandoptions.defaultSubShow < 1 ) || false; while ( _buffer.length !== 0 ) {
var loopcontinue = function () { var Layout = _buffer[ 0 ].getLayout();
return ( layer_nolimit ? ( _buffer.length !== 0 ) : ( _buffer.length !== 0 && cur_layer < expand_layer ) ); if ( Layout.added ) {
}; Layout.added = false;
while ( loopcontinue() ) { _buffer[ 0 ].getRenderContainer().remove();
cur_layer++; Layout.connect.remove();
var layer_len = _buffer.length; if ( Layout.shicon ) Layout.shicon.remove();
for ( var j = 0; j < layer_len; j++ ) {
var c = _buffer[ j ].getChildren();
if ( ( sub_nolimit || ( c.length <= expandoptions.defaultSubShow ) ) && c.length !== 0 ) {
this.expandNode( _buffer[ j ] );
_buffer = _buffer.concat( _buffer[ j ].getChildren() );
} }
_buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
_buffer.shift();
}
var set = updateLayoutVertical( node, node.getParent(), "contract" );
for ( var i = 0; i < set.length; i++ ) {
translateNode( set[ i ] );
updateConnectAndshIcon( set[ i ] );
} }
_buffer.splice( 0, layer_len );
} }
_root.setPoint( _root.getLayout().x, _root.getLayout().y );
}, },
appendChildNode: function ( parent, node, focus, sibling ) { appendChildNode: function ( parent, node, focus, sibling ) {
if ( parent.getType() !== "root" && parent.getChildren().length !== 0 && parent.getData( "expand" ) === false ) {
minder.expandNode( parent );
}
minder.handelNodeInsert( node ); minder.handelNodeInsert( node );
var Layout = node.getLayout();
node.clearLayout(); node.clearLayout();
node.getContRc().clear(); node.getContRc().clear();
node.setData( 'expand', false ); Layout = node.getLayout();
if ( parent.getType() !== 'root' ) {
parent.setData( 'expand', true );
}
var Layout = node.getLayout();
Layout.added = true; Layout.added = true;
var parentLayout = parent.getLayout(); var parentLayout = parent.getLayout();
var children = parent.getChildren(); var children = parent.getChildren();
...@@ -3304,6 +3362,9 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -3304,6 +3362,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
this._firePharse( new MinderEvent( "RenderNodeTop", { this._firePharse( new MinderEvent( "RenderNodeTop", {
node: node node: node
}, false ) ); }, false ) );
this._firePharse( new MinderEvent( "RenderNode", {
node: node
}, false ) );
updateShapeByCont( node ); updateShapeByCont( node );
var set1 = updateLayoutVertical( node, parent, "append" ); var set1 = updateLayoutVertical( node, parent, "append" );
var set2 = updateLayoutHorizon( node ); var set2 = updateLayoutHorizon( node );
...@@ -3316,6 +3377,8 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -3316,6 +3377,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
if ( focus ) { if ( focus ) {
showNodeInView( node ); showNodeInView( node );
} }
var shicon = parent.getLayout().shicon;
if ( shicon ) shicon.switchState( true );
}, },
appendSiblingNode: function ( sibling, node, focus ) { appendSiblingNode: function ( sibling, node, focus ) {
var parent = sibling.getParent(); var parent = sibling.getParent();
...@@ -3364,42 +3427,6 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -3364,42 +3427,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
_buffer.shift(); _buffer.shift();
} }
} }
},
expandNode: function ( ico ) {
var isExpand, node;
if ( ico instanceof MinderNode ) {
node = ico;
isExpand = node.getLayout().shicon.switchState();
} else {
isExpand = ico.icon.switchState();
node = ico.icon._node;
}
node.setData( "expand", isExpand );
var _buffer = node.getChildren();
if ( isExpand ) {
for ( var j = 0; j < _buffer.length; j++ ) {
minder.appendChildNode( node, _buffer[ j ] );
}
} else {
var _buffer = node.getChildren();
while ( _buffer.length !== 0 ) {
var Layout = _buffer[ 0 ].getLayout();
if ( Layout.added ) {
Layout.added = false;
_buffer[ 0 ].getRenderContainer().remove();
Layout.connect.remove();
if ( Layout.shicon ) Layout.shicon.remove();
}
_buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
_buffer.shift();
}
}
var set = [];
if ( !isExpand ) set = updateLayoutVertical( node, node.getParent(), "contract" );
for ( var i = 0; i < set.length; i++ ) {
translateNode( set[ i ] );
updateConnectAndshIcon( set[ i ] );
}
} }
}; };
this.addLayoutStyle( "default", _style ); this.addLayoutStyle( "default", _style );
...@@ -4131,13 +4158,14 @@ var ViewDragger = kity.createClass( "ViewDragger", { ...@@ -4131,13 +4158,14 @@ var ViewDragger = kity.createClass( "ViewDragger", {
lastPosition = null, lastPosition = null,
currentPosition = null; currentPosition = null;
this._minder.on( 'normal.beforemousedown readonly.beforemousedown', function ( e ) { this._minder.on( 'normal.beforemousedown readonly.beforemousedown readonly.beforetouchstart', function ( e ) {
// 点击未选中的根节点临时开启 // 点击未选中的根节点临时开启
if ( e.getTargetNode() == this.getRoot() && if ( e.getTargetNode() == this.getRoot() &&
( !this.getRoot().isSelected() || !this.isSingleSelect() ) ) { ( !this.getRoot().isSelected() || !this.isSingleSelect() ) ) {
lastPosition = e.getPosition(); lastPosition = e.getPosition();
dragger.setEnabled( true ); dragger.setEnabled( true );
isRootDrag = true; isRootDrag = true;
e.originEvent.preventDefault();
var me = this; var me = this;
setTimeout( function () { setTimeout( function () {
me.setStatus( 'hand' ); me.setStatus( 'hand' );
...@@ -4145,16 +4173,15 @@ var ViewDragger = kity.createClass( "ViewDragger", { ...@@ -4145,16 +4173,15 @@ var ViewDragger = kity.createClass( "ViewDragger", {
} }
} ) } )
.on( 'hand.beforemousedown', function ( e ) { .on( 'hand.beforemousedown hand.beforetouchend', function ( e ) {
// 已经被用户打开拖放模式 // 已经被用户打开拖放模式
if ( dragger.isEnabled() ) { if ( dragger.isEnabled() ) {
lastPosition = e.getPosition(); lastPosition = e.getPosition();
e.stopPropagation(); e.stopPropagation();
e.originEvent.preventDefault();
} }
} ) } )
.on( 'hand.beforemousemove', function ( e ) { .on( 'hand.beforemousemove hand.beforetouchmove', function ( e ) {
if ( lastPosition ) { if ( lastPosition ) {
currentPosition = e.getPosition(); currentPosition = e.getPosition();
...@@ -4162,6 +4189,8 @@ var ViewDragger = kity.createClass( "ViewDragger", { ...@@ -4162,6 +4189,8 @@ var ViewDragger = kity.createClass( "ViewDragger", {
var offset = kity.Vector.fromPoints( lastPosition, currentPosition ); var offset = kity.Vector.fromPoints( lastPosition, currentPosition );
dragger.move( offset ); dragger.move( offset );
e.stopPropagation(); e.stopPropagation();
e.preventDefault();
e.originEvent.preventDefault();
lastPosition = currentPosition; lastPosition = currentPosition;
} }
} ) } )
...@@ -4206,7 +4235,7 @@ KityMinder.registerModule( 'View', function () { ...@@ -4206,7 +4235,7 @@ KityMinder.registerModule( 'View', function () {
base: Command, base: Command,
execute: function ( km, focusNode ) { execute: function ( km, focusNode ) {
var viewport = km.getPaper().getViewPort(); var viewport = km.getPaper().getViewPort();
var offset = focusNode.getRenderContainer().getRenderBox( 'paper' ); var offset = focusNode.getRenderContainer().getRenderBox( 'view' );
var dx = viewport.center.x - offset.x - offset.width / 2, var dx = viewport.center.x - offset.x - offset.width / 2,
dy = viewport.center.y - offset.y; dy = viewport.center.y - offset.y;
km.getRenderContainer().fxTranslate( dx, dy, 1000, "easeOutQuint" ); km.getRenderContainer().fxTranslate( dx, dy, 1000, "easeOutQuint" );
...@@ -4286,6 +4315,9 @@ var MoveToParentCommand = kity.createClass( 'MoveToParentCommand', { ...@@ -4286,6 +4315,9 @@ var MoveToParentCommand = kity.createClass( 'MoveToParentCommand', {
node = nodes[ i ]; node = nodes[ i ];
if ( node.getParent() ) { if ( node.getParent() ) {
minder.removeNode( [ node ] ); minder.removeNode( [ node ] );
if ( !parent.isExpanded() && parent.getChildren().length > 0 && parent.getType() !== 'root' ) {
minder.expandNode( parent );
}
minder.appendChildNode( parent, node ); minder.appendChildNode( parent, node );
} }
} }
...@@ -4778,11 +4810,11 @@ KityMinder.registerModule( "KeyboardModule", function () { ...@@ -4778,11 +4810,11 @@ KityMinder.registerModule( "KeyboardModule", function () {
case keys.Backspace: case keys.Backspace:
case keys.Del: case keys.Del:
e.preventDefault(); e.preventDefault();
if ( this.queryCommandState( 'removenode' ) !== -1 ) this.execCommand( 'removenode' ); this.execCommand( 'removenode' );
break; break;
case keys.F2: case keys.F2:
e.preventDefault(); e.preventDefault();
if ( this.queryCommandState( 'editnode' ) !== -1 ) this.execCommand( 'editnode' ); this.execCommand( 'editnode' );
break; break;
case keys.Left: case keys.Left:
...@@ -4971,8 +5003,33 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -4971,8 +5003,33 @@ KityMinder.registerModule( "TextEditModule", function () {
return km.receiver.isTextEditStatus(); return km.receiver.isTextEditStatus();
}; };
km.textEditNode = function(node){
var textShape = node.getTextShape();
this.setStatus('textedit');
sel.setHide();
sel.setStartOffset(0);
sel.setEndOffset(textShape.getContent().length);
receiver.setTextEditStatus(true)
.setSelection(sel)
.setKityMinder(this)
.setMinderNode(node)
.setTextShape(textShape)
.setRange(range)
.setBaseOffset()
.setContainerStyle()
.setSelectionHeight()
.setContainerTxt(textShape.getContent())
.updateTextData()
.updateSelectionShow()
.updateRange(range).setTextEditStatus(true);
sel.setData('relatedNode',node);
};
var selectionByClick = false; var selectionByClick = false;
var dragmoveTimer;
return { return {
"events": { "events": {
//插入光标 //插入光标
...@@ -5014,7 +5071,7 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -5014,7 +5071,7 @@ KityMinder.registerModule( "TextEditModule", function () {
.setBaseOffset() .setBaseOffset()
.setContainerStyle() .setContainerStyle()
.setSelectionHeight() .setSelectionHeight()
.setCurrentIndex(e.getPosition()) .setCurrentIndex(e.getPosition(this.getRenderContainer()))
.updateSelection() .updateSelection()
.setRange(range); .setRange(range);
sel.setData('relatedNode',node); sel.setData('relatedNode',node);
...@@ -5024,13 +5081,61 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -5024,13 +5081,61 @@ KityMinder.registerModule( "TextEditModule", function () {
sel.setShow(); sel.setShow();
selectionByClick = false; selectionByClick = false;
} }
km.setStatus('textedit') km.setStatus('textedit');
lastMousedownTimer = +new Date;
}
}
},
//当输入键值是内容时,进入textedit状态
'normal.beforekeydown':function(e){
var node = this.getSelectedNode();
if(node){
if ( this.isSingleSelect() && node.isSelected()) {
var keyCode = e.originEvent.keyCode;
if(!keymap.notContentInput[keyCode] && range.nativeSel.rangeCount != 0){
var nativeRange = range.nativeSel.getRangeAt(0);
if(nativeRange && (nativeRange.startContainer === receiver.container || receiver.container.contains(nativeRange.startContainer )))
km.setStatus('textedit')
}
}
}
},
//当节点选区通过键盘发生变化时,输入状态要准备好
'normal.keyup':function(e){
var node = this.getSelectedNode();
if(node){
if ( this.isSingleSelect() && node.isSelected()) {
var keyCode = e.originEvent.keyCode;
if(keymap.isSelectedNodeKey[keyCode] && km.getStatus() != 'textedit'){
//准备输入状态
var textShape = node.getTextShape();
sel.setHide();
sel.setStartOffset(0);
sel.setEndOffset(textShape.getContent().length);
receiver.setTextEditStatus(true)
.setSelection(sel)
.setKityMinder(this)
.setMinderNode(node)
.setTextShape(textShape)
.setRange(range)
.setBaseOffset()
.setContainerStyle()
.setSelectionHeight()
.setContainerTxt(textShape.getContent())
.updateRange(range).setTextEditStatus(true);
sel.setData('relatedNode',node);
}
} }
} }
}, },
'normal.mouseup textedit.mouseup':function(e){ 'normal.mouseup textedit.mouseup':function(e){
if(mouseDownStatus){ if(mouseDownStatus){
if(!sel.collapsed ){ if(!sel.collapsed ){
try{ try{
receiver.updateRange(range) receiver.updateRange(range)
}catch(e){ }catch(e){
...@@ -5039,8 +5144,37 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -5039,8 +5144,37 @@ KityMinder.registerModule( "TextEditModule", function () {
}else }else
sel.setShow() sel.setShow()
}else{
//当选中节点后,输入状态准备
var node = e.getTargetNode();
if(node){
if ( this.isSingleSelect() && node.isSelected()) {
//准备输入状态
var textShape = node.getTextShape();
sel.setHide();
sel.setStartOffset(0);
sel.setEndOffset(textShape.getContent().length);
receiver.setTextEditStatus(true)
.setSelection(sel)
.setKityMinder(this)
.setMinderNode(node)
.setTextShape(textShape)
.setRange(range)
.setBaseOffset()
.setContainerStyle()
.setSelectionHeight()
.setContainerTxt(textShape.getContent())
.updateRange(range).setTextEditStatus(true);
sel.setData('relatedNode',node);
}
}
} }
mouseDownStatus = false; mouseDownStatus = false;
oneTime = 0; oneTime = 0;
}, },
...@@ -5048,10 +5182,8 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -5048,10 +5182,8 @@ KityMinder.registerModule( "TextEditModule", function () {
if(mouseDownStatus){ if(mouseDownStatus){
e.stopPropagationImmediately(); e.stopPropagationImmediately();
var offset = e.getPosition(); var offset = e.getPosition(this.getRenderContainer());
if(Math.abs(offset.y - lastEvtPosition.y) >= 2 && Math.abs(lastEvtPosition.x - offset.x) <= 2 ){
if(Math.abs(offset.y - lastEvtPosition.y) >= 1 && Math.abs(lastEvtPosition.x - offset.x) <= 1 ){
sel.setHide(); sel.setHide();
mouseDownStatus = false; mouseDownStatus = false;
return; return;
...@@ -5089,45 +5221,45 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -5089,45 +5221,45 @@ KityMinder.registerModule( "TextEditModule", function () {
sel.setHide(); sel.setHide();
}, },
"execCommand": function( e ) { "execCommand": function( e ) {
var cmds = { // var cmds = {
'appendchildnode' : 1, // 'appendchildnode' : 1,
'appendsiblingnode' : 1, // 'appendsiblingnode' : 1,
'editnode' : 1 // 'editnode' : 1
}; // };
if ( cmds[ e.commandName ] ){ // if ( cmds[ e.commandName ] ){
//
var node = km.getSelectedNode(); // var node = km.getSelectedNode();
if( !node ){ // if( !node ){
return; // return;
} // }
//
var textShape = node.getTextShape(); // var textShape = node.getTextShape();
//
textShape.setStyle('cursor','default'); // textShape.setStyle('cursor','default');
node.getTextShape().setStyle('cursor','text'); // node.getTextShape().setStyle('cursor','text');
km.setStatus('textedit'); // km.setStatus('textedit');
receiver.setTextEditStatus(true) // receiver.setTextEditStatus(true)
.setSelection(sel) // .setSelection(sel)
.setKityMinder(this) // .setKityMinder(this)
.setMinderNode(node) // .setMinderNode(node)
.setTextShape(textShape) // .setTextShape(textShape)
.setBaseOffset() // .setBaseOffset()
.setContainerStyle() // .setContainerStyle()
.setSelectionHeight() // .setSelectionHeight()
.getTextOffsetData() // .getTextOffsetData()
.setIndex(0) // .setIndex(0)
.updateSelection() // .updateSelection()
.setRange(range); // .setRange(range);
//
sel.setStartOffset(0); // sel.setStartOffset(0);
sel.setEndOffset(textShape.getContent().length); // sel.setEndOffset(textShape.getContent().length);
sel.setShow(); // sel.setShow();
//
receiver.updateSelectionShow(1) // receiver.updateSelectionShow(1)
.updateRange(range); // .updateRange(range);
return; // return;
//
} // }
if((e.commandName == 'priority' || e.commandName == 'progress') && this.getStatus() == 'textedit' ){ if((e.commandName == 'priority' || e.commandName == 'progress') && this.getStatus() == 'textedit' ){
...@@ -5415,9 +5547,11 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5415,9 +5547,11 @@ Minder.Receiver = kity.createClass( 'Receiver', {
updateIndex: function () { updateIndex: function () {
this.index = this.range.getStart().startOffset; this.index = this.range.getStart().startOffset;
return this;
}, },
updateTextData: function () { updateTextData: function () {
this.textShape.textData = this.getTextOffsetData(); this.textShape.textData = this.getTextOffsetData();
return this;
}, },
setSelection: function ( selection ) { setSelection: function ( selection ) {
this.selection = selection; this.selection = selection;
...@@ -5566,7 +5700,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5566,7 +5700,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
endOffset = this.textData[ this.selection.endOffset ], endOffset = this.textData[ this.selection.endOffset ],
width = 0; width = 0;
if ( this.selection.collapsed ) { if ( this.selection.collapsed ) {
this.selection.updateShow( startOffset || this.textData[ this.textData.length - 1 ], 0 ); this.selection.updateShow( startOffset || this.textData[ this.textData.length - 1 ],1 );
return this; return this;
} }
if ( !endOffset ) { if ( !endOffset ) {
...@@ -5697,7 +5831,9 @@ Minder.Selection = kity.createClass( 'Selection', { ...@@ -5697,7 +5831,9 @@ Minder.Selection = kity.createClass( 'Selection', {
var me = this, var me = this,
state = ''; state = '';
me.setStyle( 'display', '' ); me.setStyle( 'display', '' );
if(this.collapsed){ if(this.collapsed){
me.setOpacity(1);
this.timer = setInterval( function () { this.timer = setInterval( function () {
me.setStyle( 'display', state ); me.setStyle( 'display', state );
state = state ? '' : 'none'; state = state ? '' : 'none';
...@@ -6061,27 +6197,21 @@ KityMinder.registerModule( "NodeText", function () { ...@@ -6061,27 +6197,21 @@ KityMinder.registerModule( "NodeText", function () {
} ); } );
KityMinder.registerModule( "hyperlink", function () { KityMinder.registerModule( "hyperlink", function () {
var linkShapePath = "M16.614,10.224h-1.278c-1.668,0-3.07-1.07-3.599-2.556h4.877c0.707,0,1.278-0.571,1.278-1.278V3.834 c0-0.707-0.571-1.278-1.278-1.278h-4.877C12.266,1.071,13.668,0,15.336,0h1.278c2.116,0,3.834,1.716,3.834,3.834V6.39 C20.448,8.508,18.73,10.224,16.614,10.224z M5.112,5.112c0-0.707,0.573-1.278,1.278-1.278h7.668c0.707,0,1.278,0.571,1.278,1.278 S14.765,6.39,14.058,6.39H6.39C5.685,6.39,5.112,5.819,5.112,5.112z M2.556,3.834V6.39c0,0.707,0.573,1.278,1.278,1.278h4.877 c-0.528,1.486-1.932,2.556-3.599,2.556H3.834C1.716,10.224,0,8.508,0,6.39V3.834C0,1.716,1.716,0,3.834,0h1.278 c1.667,0,3.071,1.071,3.599,2.556H3.834C3.129,2.556,2.556,3.127,2.556,3.834z";
return { return {
"commands": { "commands": {
"createlink" : kity.createClass( "hyperlink", { "hyperlink": kity.createClass( "hyperlink", {
base: Command, base: Command,
execute: function (url) { execute: function ( km, url ) {
var nodes = km.getSelectedNodes(); var nodes = km.getSelectedNodes();
if ( this.queryState( 'hyperlink' ) == 1 ) { utils.each( nodes, function ( i, n ) {
utils.each( nodes, function ( i, n ) { n.setData( 'hyperlink', url );
n.setData( 'hyperlink' ); km.updateLayout( n )
} )
} )
} else {
utils.each( nodes, function ( i, n ) {
n.setData( 'hyperlink', url );
} )
}
}, },
queryState: function () { queryState: function ( km ) {
var nodes = km.getSelectedNodes(), var nodes = km.getSelectedNodes(),
result = 0; result = 0;
if ( nodes.length == 0 ) { if ( nodes.length == 0 ) {
...@@ -6089,28 +6219,292 @@ KityMinder.registerModule( "hyperlink", function () { ...@@ -6089,28 +6219,292 @@ KityMinder.registerModule( "hyperlink", function () {
} }
utils.each( nodes, function ( i, n ) { utils.each( nodes, function ( i, n ) {
if ( n && n.getData( 'hyperlink' ) ) { if ( n && n.getData( 'hyperlink' ) ) {
result = 1; result = 0;
return false; return false;
} }
} ); } );
return result; return result;
},
queryValue: function ( km ) {
var node = km.getSelectedNode();
return node.getData( 'hyperlink' );
}
} ),
"unhyperlink": kity.createClass( "hyperlink", {
base: Command,
execute: function ( km ) {
var nodes = km.getSelectedNodes();
utils.each( nodes, function ( i, n ) {
n.setData( 'hyperlink' );
km.updateLayout( n )
} )
},
queryState: function ( km ) {
var nodes = km.getSelectedNodes();
if ( nodes.length == 0 ) {
return -1;
}
var link = false;
utils.each( nodes, function ( i, n ) {
if ( n.getData( 'hyperlink' ) ) {
link = true;
return false;
}
} );
if ( link ) {
return 0
}
return -1;
} }
} ) } )
}, },
"events": { "events": {
"RenderNodeRight": function ( e ) { "RenderNodeRight": function ( e ) {
var node = e.node,url; var node = e.node,
if(url = node.getData('h')){ url;
var link = new kity.HyperLink(url); if ( url = node.getData( 'hyperlink' ) ) {
var rect = new kity.Rect(); var link = new kity.HyperLink( url );
var linkshape = new kity.Path();
var box = node.getContRc().getBoundaryBox(); var box = node.getContRc().getBoundaryBox();
rect.setWidth(10).setHeight(10).fill('#ccc').setPosition(box.x + box.width + 2,rect.getHeight()/-2); var style = this.getCurrentLayoutStyle()[ node.getType() ];
link.appendChild(rect); linkshape.setPathData( linkShapePath ).fill( '#666' ).setTranslate( box.x + box.width + style.spaceLeft, -5 );
node.getContRc().appendChild(link); link.addShape( linkshape );
link.setTarget( '_blank' );
link.setStyle( 'cursor', 'pointer' );
node.getContRc().addShape( link );
} }
}
}
};
} );
KityMinder.registerModule( "Expand", function () {
var EXPAND_STATE_DATA = 'expandState',
STATE_EXPAND = 'expand',
STATE_COLLAPSE = 'collapse';
var layerTravel = function ( root, fn ) {
var _buffer = [ root ];
while ( _buffer.length !== 0 ) {
fn( _buffer[ 0 ] );
_buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
_buffer.shift();
}
}
// var getCommonParents = function ( nodes ) {
// var _buffer = [];
// var resultSet = [];
// for ( var i = 0; i < nodes.length; i++ ) {
// _buffer.push( nodes[ i ] );
// }
// while ( _buffer.length !== 0 ) {
// var parent = _buffer[ 0 ].getParent();
// if ( parent.getType() === 'root' || _buffer.length === 1 ) {
// resultSet.push( _buffer[ 0 ] );
// } else {
// if ( _buffer.indexOf( parent ) === -1 ) {
// _buffer.push( parent );
// }
// }
// _buffer.shift();
// }
// return resultSet;
// }
// var setOptionValue = function ( root, layer, sub ) {
// var cur_layer = 1;
// var _buffer = root.getChildren();
// while ( cur_layer < layer ) {
// var layer_len = _buffer.length;
// for ( var i = 0; i < layer_len; i++ ) {
// var c = _buffer[ i ].getChildren();
// if ( c.length < sub || ( !sub ) ) {
// _buffer[ i ].expand();
// _buffer = _buffer.concat( c );
// }
// }
// _buffer.splice( 0, layer_len );
// cur_layer++;
// }
// }
/**
* 该函数返回一个策略,表示递归到节点指定的层数
*
* 返回的策略表示把操作(展开/收起)进行到指定的层数
* 也可以给出一个策略指定超过层数的节点如何操作,默认不进行任何操作
*
* @param {int} deep_level 指定的层数
* @param {Function} policy_after_level 超过的层数执行的策略
*/
function generateDeepPolicy( deep_level, policy_after_level ) {
return function ( node, state, policy, level ) {
var children, child, i;
node.setData( EXPAND_STATE_DATA, state );
level = level || 1;
children = node.getChildren();
for ( i = 0; i < children.length; i++ ) {
child = children[ i ];
if ( level <= deep_level ) {
policy( child, state, policy, level + 1 );
} else if ( policy_after_level ) {
policy_after_level( child, state, policy, level + 1 );
}
}
};
}
/**
* 节点展开和收缩的策略常量
*
* 策略是一个处理函数,处理函数接受 3 个参数:
*
* @param {MinderNode} node 要处理的节点
* @param {Enum} state 取值为 "expand" | "collapse",表示要对节点进行的操作是展开还是收缩
* @param {Function} policy 提供当前策略的函数,方便递归调用
*/
var EXPAND_POLICY = MinderNode.EXPAND_POLICY = {
/**
* 策略 1:只修改当前节点的状态,不递归子节点的状态
*/
KEEP_STATE: function ( node, state, policy ) {
node.setData( EXPAND_STATE_DATA, state );
},
generateDeepPolicy: generateDeepPolicy,
/**
* 策略 2:把操作进行到儿子
*/
DEEP_TO_CHILD: generateDeepPolicy( 1 ),
/**
* 策略 3:把操作进行到叶子
*/
DEEP_TO_LEAF: generateDeepPolicy( Number.MAX_VALUE )
};
// 将展开的操作和状态读取接口拓展到 MinderNode 上
kity.extendClass( MinderNode, {
/**
* 使用指定的策略展开节点
* @param {Policy} policy 展开的策略,默认为 KEEP_STATE
*/
expand: function ( policy ) {
policy = policy || EXPAND_POLICY.KEEP_STATE;
policy( this, STATE_EXPAND, policy );
return this;
},
/**
* 使用指定的策略收起节点
* @param {Policy} policy 展开的策略,默认为 KEEP_STATE
*/
collapse: function ( policy ) {
policy = policy || EXPAND_POLICY.KEEP_STATE;
policy( this, STATE_COLLAPSE, policy );
return this;
},
/**
* 判断节点当前的状态是否为展开
*/
isExpanded: function () {
return this.getData( EXPAND_STATE_DATA ) === STATE_EXPAND;
}
} );
var ExpandNodeCommand = kity.createClass( "ExpandNodeCommand", ( function () {
return {
base: Command,
execute: function ( km ) {
var selectedNodes = km.getSelectedNodes();
if ( selectedNodes.length === 0 || selectedNodes[ 0 ].getType() === 'root' ) {
layerTravel( km.getRoot(), function ( n ) {
n.expand();
} );
km.initStyle();
} else {
var selectedNode = km.getSelectedNode();
var children = selectedNode.getChildren();
if ( children.length === 0 ) {
return false;
}
layerTravel( selectedNode, function ( n ) {
if ( n !== selectedNode ) n.expand();
} );
if ( !selectedNode.isExpanded() ) {
km.expandNode( selectedNode );
} else {
km.expandNode( selectedNode );
km.expandNode( selectedNode );
}
}
},
queryState: function ( km ) {
return 0;
} }
};
} )() );
var CollapseNodeCommand = kity.createClass( "CollapseNodeCommand", ( function () {
return {
base: Command,
execute: function ( km ) {
var selectedNodes = km.getSelectedNodes();
if ( selectedNodes.length === 0 || selectedNodes[ 0 ].getType() === 'root' ) {
layerTravel( km.getRoot(), function ( n ) {
n.collapse();
} );
km.initStyle();
} else {
var selectedNode = km.getSelectedNode();
var children = selectedNode.getChildren();
if ( children.length === 0 ) {
return false;
}
if ( selectedNode.isExpanded() ) {
layerTravel( selectedNode, function ( n ) {
if ( n !== selectedNode ) n.collapse();
} );
km.expandNode( selectedNode );
}
}
},
queryState: function ( km ) {
return 0;
}
};
} )() );
return {
'events': {
'beforeimport': function ( e ) {
// var _root = this.getRoot();
// var options = this.getOptions();
// var defaultExpand = options.defaultExpand;
//setOptionValue( _root, defaultExpand.defaultLayer, defaultExpand.defaultSubShow );
}
},
'addShortcutKeys': {
"ExpandNode": "ctrl+/", //expand
"CollapseNode": "ctrl+." //collapse
},
'commands': {
'ExpandNode': ExpandNodeCommand,
'CollapseNode': CollapseNodeCommand
} }
}; };
} ); } );
...@@ -7863,7 +8257,13 @@ utils.extend( KityMinder, function () { ...@@ -7863,7 +8257,13 @@ utils.extend( KityMinder, function () {
pro.root( $widget.kmui().getBodyContainer() ); pro.root( $widget.kmui().getBodyContainer() );
//清除光标
km.fire('selectionclear');
pro.initContent( km, $widget ); pro.initContent( km, $widget );
//在dialog上阻止键盘冒泡,导致跟编辑输入冲突的问题
$widget.on('keydown keyup keypress',function(e){
e.stopPropagation()
});
if ( !pro._preventDefault ) { if ( !pro._preventDefault ) {
pro.initEvent( km, $widget ); pro.initEvent( km, $widget );
} }
...@@ -7876,7 +8276,7 @@ utils.extend( KityMinder, function () { ...@@ -7876,7 +8276,7 @@ utils.extend( KityMinder, function () {
} }
}() ); }() );
KM.registerToolbarUI( 'bold italic redo undo', KM.registerToolbarUI( 'bold italic redo undo unhyperlink expandnode collapsenode hand zoom-in zoom-out',
function ( name ) { function ( name ) {
var me = this; var me = this;
var $btn = $.kmuibutton( { var $btn = $.kmuibutton( {
...@@ -8174,24 +8574,6 @@ KM.registerToolbarUI( 'saveto', function ( name ) { ...@@ -8174,24 +8574,6 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
} ); } );
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;
}
);
KM.registerUI( 'tooltips', KM.registerUI( 'tooltips',
function ( name ) { function ( name ) {
var km = this; var km = this;
...@@ -8229,16 +8611,16 @@ KM.registerToolbarUI( 'switchlayout', function ( name ) { ...@@ -8229,16 +8611,16 @@ KM.registerToolbarUI( 'switchlayout', function ( name ) {
itemStyles: [], itemStyles: [],
value: me.getLayoutStyleItems(), value: me.getLayoutStyleItems(),
autowidthitem: [], autowidthitem: [],
enabledRecord:false enabledRecord: false
}, },
$combox = null; $combox = null;
if ( options.items.length == 0 ) { if ( options.items.length == 0 ) {
return null; return null;
} }
utils.each(options.items,function(i,item){ utils.each( options.items, function ( i, item ) {
options.items[i] = me.getLang('layout')[item]; options.items[ i ] = me.getLang( 'layout' )[ item ];
}); } );
//实例化 //实例化
$combox = $.kmuibuttoncombobox( options ).css( 'zIndex', me.getOptions( 'zIndex' ) + 1 ); $combox = $.kmuibuttoncombobox( options ).css( 'zIndex', me.getOptions( 'zIndex' ) + 1 );
var comboboxWidget = $combox.kmui(); var comboboxWidget = $combox.kmui();
...@@ -8268,19 +8650,19 @@ KM.registerToolbarUI( 'switchlayout', function ( name ) { ...@@ -8268,19 +8650,19 @@ KM.registerToolbarUI( 'switchlayout', function ( name ) {
} ); } );
var data = []; var data = [];
utils.each(me.getLayoutStyleItems(),function(i,v){ utils.each( me.getLayoutStyleItems(), function ( i, v ) {
data.push({ data.push( {
label:me.getLang( 'tooltips.' + name ) + ' ' + v, label: me.getLang( 'tooltips.' + name ) + ' ' + v,
cmdName:'switchlayout', cmdName: 'switchlayout',
exec:function(){ exec: function () {
me.execCommand('switchlayout',v); me.execCommand( 'switchlayout', v );
} }
}) } )
}); } );
data.push({ data.push( {
divider:1 divider: 1
}); } );
me.addContextmenu(data); me.addContextmenu( data );
return comboboxWidget.button().addClass( 'kmui-combobox' ); return comboboxWidget.button().addClass( 'kmui-combobox' );
} ); } );
...@@ -8303,7 +8685,8 @@ KM.registerToolbarUI( 'node', function ( name ) { ...@@ -8303,7 +8685,8 @@ KM.registerToolbarUI( 'node', function ( name ) {
itemStyles: [], itemStyles: [],
value: [], value: [],
autowidthitem: [], autowidthitem: [],
enabledRecord: false enabledRecord: false,
enabledSelected: false
}, },
$combox = null; $combox = null;
if ( options.items.length == 0 ) { if ( options.items.length == 0 ) {
...@@ -8396,19 +8779,25 @@ KM.registerUI( 'contextmenu', function () { ...@@ -8396,19 +8779,25 @@ KM.registerUI( 'contextmenu', function () {
}); });
me.$container.append($menu); me.$container.append($menu);
me.on('contextmenu',function(e){ me.on('contextmenu',function(e){
var node = e.getTargetNode();
if(node){
this.removeAllSelectedNodes();
this.select(node)
}
var items = me.getContextmenu(); var items = me.getContextmenu();
var data = []; var data = [];
utils.each(items,function(i,item){ utils.each(items,function(i,item){
if(item.divider){ if(item.divider){
data.push(item) data.length && data.push(item);
return; return;
} }
if(me.queryCommandState(item.cmdName)!=-1){ if(me.queryCommandState(item.cmdName)!=-1){
data.push({ data.push({
label:item.label, label:item.label,
value:item.cmdName value:item.cmdName
}) })
} }
}); });
...@@ -8420,10 +8809,8 @@ KM.registerUI( 'contextmenu', function () { ...@@ -8420,10 +8809,8 @@ KM.registerUI( 'contextmenu', function () {
$menu.kmui().setData({ $menu.kmui().setData({
data:data data:data
}).position(e.getPosition()).show(); }).position(e.getPosition()).show();
e.preventDefault()
} }
e.preventDefault()
}); });
me.on('click',function(){ me.on('click',function(){
...@@ -8484,6 +8871,53 @@ KM.registerToolbarUI( 'markers help preference', function ( name ) { ...@@ -8484,6 +8871,53 @@ KM.registerToolbarUI( 'markers help preference', function ( name ) {
return $btn; return $btn;
} ); } );
KM.registerToolbarUI( 'hyperlink', function ( name ) {
var me = this,
currentRange, $dialog,
opt = {
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;
} );
/* /*
http://www.xmind.net/developer/ http://www.xmind.net/developer/
...@@ -8534,6 +8968,11 @@ KityMinder.registerProtocal( 'xmind', function () { ...@@ -8534,6 +8968,11 @@ KityMinder.registerProtocal( 'xmind', function () {
} }
} }
// 处理超链接
if(topic['xlink:href']){
obj.data.hyperlink = topic['xlink:href'];
}
//处理子节点 //处理子节点
if( topic.children && topic.children.topics && topic.children.topics.topic ){ if( topic.children && topic.children.topics && topic.children.topics.topic ){
var tmp = topic.children.topics.topic; var tmp = topic.children.topics.topic;
...@@ -8567,33 +9006,33 @@ KityMinder.registerProtocal( 'xmind', function () { ...@@ -8567,33 +9006,33 @@ KityMinder.registerProtocal( 'xmind', function () {
}, onerror); }, onerror);
} }
return { return {
fileDescription: 'xmind格式文件', fileDescription: 'xmind格式文件',
fileExtension: '.xmind', fileExtension: '.xmind',
decode: function ( local ) { decode: function ( local ) {
return { return {
then : function(local, callback){ then : function(local, callback){
getEntries( local, function( entries ) {
entries.forEach(function( entry ) {
if(entry.filename == 'content.xml'){
entry.getData(new zip.TextWriter(), function(text) {
var km = xml2km($.parseXML(text));
callback && callback( km );
});
}
});
});
}
};
}, getEntries( local, function( entries ) {
// recognize: recognize, entries.forEach(function( entry ) {
recognizePriority: -1 if(entry.filename == 'content.xml'){
}; entry.getData(new zip.TextWriter(), function(text) {
var km = xml2km($.parseXML(text));
callback && callback( km );
});
}
});
});
}
};
},
// recognize: recognize,
recognizePriority: -1
};
} ); } );
...@@ -8642,6 +9081,11 @@ KityMinder.registerProtocal( 'freemind', function () { ...@@ -8642,6 +9081,11 @@ KityMinder.registerProtocal( 'freemind', function () {
} }
} }
// 处理超链接
if(topic.LINK){
obj.data.hyperlink = topic.LINK;
}
//处理子节点 //处理子节点
if( topic.node ){ if( topic.node ){
...@@ -8668,19 +9112,19 @@ KityMinder.registerProtocal( 'freemind', function () { ...@@ -8668,19 +9112,19 @@ KityMinder.registerProtocal( 'freemind', function () {
return result; return result;
} }
return { return {
fileDescription: 'xmind格式文件', fileDescription: 'xmind格式文件',
fileExtension: '.xmind', fileExtension: '.xmind',
decode: function ( local ) { decode: function ( local ) {
var json = xml2km( local ); var json = xml2km( local );
return json; return json;
}, },
// recognize: recognize, // recognize: recognize,
recognizePriority: -1 recognizePriority: -1
}; };
} ); } );
...@@ -8731,6 +9175,11 @@ KityMinder.registerProtocal( 'mindmanager', function () { ...@@ -8731,6 +9175,11 @@ KityMinder.registerProtocal( 'mindmanager', function () {
} }
} }
// 处理超链接
if ( topic.Hyperlink ) {
obj.data.hyperlink = topic.Hyperlink.Url;
}
//处理子节点 //处理子节点
if ( topic.SubTopics && topic.SubTopics.Topic ) { if ( topic.SubTopics && topic.SubTopics.Topic ) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -18,7 +18,11 @@ KityMinder.LANG[ 'zh-cn' ] = { ...@@ -18,7 +18,11 @@ KityMinder.LANG[ 'zh-cn' ] = {
'markers': '添加标签', 'markers': '添加标签',
'switchlayout': '切换主题', 'switchlayout': '切换主题',
'help': '帮助', 'help': '帮助',
'preference': '偏好设置' 'preference': '偏好设置',
'hyperlink':'插入链接',
'unhyperlink':"删除链接",
'expandnode':"展开节点",
'collapsenode':"闭合节点"
}, },
'popupcolor': { 'popupcolor': {
'clearColor': '清空颜色', 'clearColor': '清空颜色',
...@@ -44,7 +48,8 @@ KityMinder.LANG[ 'zh-cn' ] = { ...@@ -44,7 +48,8 @@ KityMinder.LANG[ 'zh-cn' ] = {
}, },
'help': { 'help': {
} },
hyperlink:{}
}, },
'node': { 'node': {
'appendsiblingnode': '插入同级节点', 'appendsiblingnode': '插入同级节点',
......
/*!
* ====================================================
* kitygraph - v1.0.0 - 2014-05-08
* https://github.com/kitygraph/kity
* GitHub: https://github.com/kitygraph/kity.git
* Copyright (c) 2014 Baidu UEditor Group; Licensed MIT
* ====================================================
*/
!function(){function define(a,b,c){if(_modules[a]={exports:{},value:null,factory:null},2===arguments.length&&(c=b),"[object Object]"===_modules.toString.call(c))_modules[a].value=c;else{if("function"!=typeof c)throw new Error("define函数未定义的行为");_modules[a].factory=c}}function require(a){var b=_modules[a],c=null;return b?b.value?b.value:(c=b.factory.call(null,require,b.exports,b),c&&(b.exports=c),b.value=b.exports,b.value):null}function use(a){return require(a)}var _modules={};define("animate/animator",["animate/timeline","graphic/color","graphic/matrix","graphic/eventhandler","animate/frame","core/utils","core/class","animate/easing","core/config","graphic/shape","graphic/svg","graphic/styled","graphic/data","graphic/pen","graphic/box"],function(a){function b(a){var b=parseFloat(a,10);return/ms/.test(a)?b:/s/.test(a)?1e3*b:/min/.test(a)?60*b*1e3:b}var c=a("animate/timeline"),d=a("animate/easing"),e=a("core/class").createClass("Animator",{constructor:function(a,b,c){if(1==arguments.length){var d=arguments[0];this.beginValue=d.beginValue,this.finishValue=d.finishValue,this.setter=d.setter}else this.beginValue=a,this.finishValue=b,this.setter=c},start:function(a,c,d,e,f){4===arguments.length&&"function"==typeof e&&(f=e,e=0);var g=this.create(a,c,d,f);return e=b(e),e>0?setTimeout(function(){g.play()},e):g.play(),g},create:function(a,f,g,h){var i;return f=f&&b(f)||e.DEFAULT_DURATION,g=g||e.DEFAULT_EASING,"string"==typeof g&&(g=d[g]),i=new c(this,a,f,g),"function"==typeof h&&i.on("finish",h),i},reverse:function(){return new e(this.finishValue,this.beginValue,this.setter)}});e.DEFAULT_DURATION=300,e.DEFAULT_EASING="linear";var f=a("graphic/shape");return a("core/class").extendClass(f,{animate:function(a,b,c,d,e){function f(){g.shift(),g.length&&setTimeout(g[0].t.play.bind(g[0].t),g[0].d)}var g=this._KityAnimateQueue=this._KityAnimateQueue||[],h=a.create(this,b,c,e);return h.on("finish",f),g.push({t:h,d:d}),1==g.length&&setTimeout(h.play.bind(h),d),this},stop:function(){var a=this._KityAnimateQueue;if(a)for(;a.length;)a.shift().stop()}}),e}),define("animate/easing",[],function(){var a={linear:function(a,b,c,d){return c*(a/d)+b},swing:function(b,c,d,e){return a.easeOutQuad(b,c,d,e)},ease:function(b,c,d,e){return a.easeInOutCubic(b,c,d,e)},easeInQuad:function(a,b,c,d){return c*(a/=d)*a+b},easeOutQuad:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInOutQuad:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b},easeInCubic:function(a,b,c,d){return c*(a/=d)*a*a+b},easeOutCubic:function(a,b,c,d){return c*((a=a/d-1)*a*a+1)+b},easeInOutCubic:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a+b:c/2*((a-=2)*a*a+2)+b},easeInQuart:function(a,b,c,d){return c*(a/=d)*a*a*a+b},easeOutQuart:function(a,b,c,d){return-c*((a=a/d-1)*a*a*a-1)+b},easeInOutQuart:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a+b:-c/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(a,b,c,d){return c*(a/=d)*a*a*a*a+b},easeOutQuint:function(a,b,c,d){return c*((a=a/d-1)*a*a*a*a+1)+b},easeInOutQuint:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a*a+b:c/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(a,b,c,d){return-c*Math.cos(a/d*(Math.PI/2))+c+b},easeOutSine:function(a,b,c,d){return c*Math.sin(a/d*(Math.PI/2))+b},easeInOutSine:function(a,b,c,d){return-c/2*(Math.cos(Math.PI*a/d)-1)+b},easeInExpo:function(a,b,c,d){return 0==a?b:c*Math.pow(2,10*(a/d-1))+b},easeOutExpo:function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},easeInOutExpo:function(a,b,c,d){return 0==a?b:a==d?b+c:(a/=d/2)<1?c/2*Math.pow(2,10*(a-1))+b:c/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(a,b,c,d){return-c*(Math.sqrt(1-(a/=d)*a)-1)+b},easeOutCirc:function(a,b,c,d){return c*Math.sqrt(1-(a=a/d-1)*a)+b},easeInOutCirc:function(a,b,c,d){return(a/=d/2)<1?-c/2*(Math.sqrt(1-a*a)-1)+b:c/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(a,b,c,d){var e=1.70158,f=0,g=c;if(0==a)return b;if(1==(a/=d))return b+c;if(f||(f=.3*d),g<Math.abs(c)){g=c;var e=f/4}else var e=f/(2*Math.PI)*Math.asin(c/g);return-(g*Math.pow(2,10*(a-=1))*Math.sin(2*(a*d-e)*Math.PI/f))+b},easeOutElastic:function(a,b,c,d){var e=1.70158,f=0,g=c;if(0==a)return b;if(1==(a/=d))return b+c;if(f||(f=.3*d),g<Math.abs(c)){g=c;var e=f/4}else var e=f/(2*Math.PI)*Math.asin(c/g);return g*Math.pow(2,-10*a)*Math.sin(2*(a*d-e)*Math.PI/f)+c+b},easeInOutElastic:function(a,b,c,d){var e=1.70158,f=0,g=c;if(0==a)return b;if(2==(a/=d/2))return b+c;if(f||(f=.3*d*1.5),g<Math.abs(c)){g=c;var e=f/4}else var e=f/(2*Math.PI)*Math.asin(c/g);return 1>a?-.5*g*Math.pow(2,10*(a-=1))*Math.sin(2*(a*d-e)*Math.PI/f)+b:g*Math.pow(2,-10*(a-=1))*Math.sin(2*(a*d-e)*Math.PI/f)*.5+c+b},easeInBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),c*(a/=d)*a*((e+1)*a-e)+b},easeOutBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),c*((a=a/d-1)*a*((e+1)*a+e)+1)+b},easeInOutBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),(a/=d/2)<1?c/2*a*a*(((e*=1.525)+1)*a-e)+b:c/2*((a-=2)*a*(((e*=1.525)+1)*a+e)+2)+b},easeInBounce:function(b,c,d,e){return d-a.easeOutBounce(e-b,0,d,e)+c},easeOutBounce:function(a,b,c,d){return(a/=d)<1/2.75?7.5625*c*a*a+b:2/2.75>a?c*(7.5625*(a-=1.5/2.75)*a+.75)+b:2.5/2.75>a?c*(7.5625*(a-=2.25/2.75)*a+.9375)+b:c*(7.5625*(a-=2.625/2.75)*a+.984375)+b},easeInOutBounce:function(b,c,d,e){return e/2>b?.5*a.easeInBounce(2*b,0,d,e)+c:.5*a.easeOutBounce(2*b-e,0,d,e)+.5*d+c}};return a}),define("animate/frame",[],function(a,b){function c(a){1===j.push(a)&&i(d)}function d(){var a=j;for(j=[];a.length;)h(a.pop())}function e(a){var b=g(a);return c(b),b}function f(a){var b=j.indexOf(a);~b&&j.splice(b,1)}function g(a){var b={index:0,time:+new Date,elapsed:0,action:a,next:function(){c(b)}};return b}function h(a){var b=+new Date,c=b-a.time;c>200&&(c=1e3/60),a.dur=c,a.elapsed+=c,a.time=b,a.action.call(null,a),a.index++}var i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(a){return setTimeout(a,1e3/60)},j=[];b.requestFrame=e,b.releaseFrame=f}),define("animate/opacityanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/matrix","core/utils","graphic/box","graphic/point","core/config","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/pen"],function(a){var b=a("animate/animator"),c=(a("graphic/matrix"),a("core/class").createClass("OpacityAnimator",{base:b,constructor:function(a){this.callBase({beginValue:function(a){return a.getOpacity()},finishValue:a,setter:function(a,b){a.setOpacity(b)}})}})),d=a("graphic/shape");return a("core/class").extendClass(d,{fxOpacity:function(a,b,d,e,f){return this.animate(new c(a),b,d,e,f)},fadeTo:function(){return this.fxOpacity.apply(this,arguments)},fadeIn:function(){return this.fxOpacity.apply(this,[1].concat([].slice.call(arguments)))},fadeOut:function(){return this.fxOpacity.apply(this,[0].concat([].slice.call(arguments)))}}),c}),define("animate/rotateanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/matrix","core/utils","graphic/box","graphic/point","core/config","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/pen"],function(a){var b=a("animate/animator"),c=(a("graphic/matrix"),a("core/class").createClass("RotateAnimator",{base:b,constructor:function(a,b,c){this.callBase({beginValue:0,finishValue:a,setter:function(a,d,e){var f=e.getDelta();a.rotate(f,b,c)}})}})),d=a("graphic/shape");return a("core/class").extendClass(d,{fxRotate:function(a,b,d,e,f){return this.animate(new c(a),b,d,e,f)},fxRotateAnchor:function(a,b,d,e,f,g,h){return this.animate(new c(a,b,d),e,f,g,h)}}),c}),define("animate/scaleanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/matrix","core/utils","graphic/box","graphic/point","core/config","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/pen"],function(a){var b=a("animate/animator"),c=(a("graphic/matrix"),a("core/class").createClass("ScaleAnimator",{base:b,constructor:function(a,b){this.callBase({beginValue:0,finishValue:1,setter:function(c,d,e){var f=e.getDelta(),g=Math.pow(a,f),h=Math.pow(b,f);c.scale(h,g)}})}})),d=a("graphic/shape");return a("core/class").extendClass(d,{fxScale:function(a,b,d,e,f,g){return this.animate(new c(a,b),d,e,f,g)}}),c}),define("animate/timeline",["graphic/color","core/utils","graphic/standardcolor","core/class","graphic/matrix","graphic/box","graphic/point","graphic/eventhandler","graphic/shapeevent","animate/frame","core/config"],function(a){function b(a,b,c){return g.paralle(a,b,function(a,b){return a+(b-a)*c})}function c(a,b){return g.paralle(a,b,function(a,b){return b-a})}function d(a,b,c){this.timeline=a,this.target=a.target,this.type=b;for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d])}var e=(a("graphic/color"),a("graphic/matrix"),a("graphic/eventhandler")),f=a("animate/frame"),g=a("core/utils"),h=a("core/class").createClass("Timeline",{mixins:[e],constructor:function(a,b,c,d){this.callMixin(),this.target=b,this.time=0,this.duration=c,this.easing=d,this.animator=a,this.beginValue=a.beginValue,this.finishValue=a.finishValue,this.setter=a.setter,this.status="ready"},nextFrame:function(a){"playing"==this.status&&(this.time+=a.dur,this.setValue(this.getValue()),this.time>=this.duration&&this.timeUp(),a.next())},getPlayTime:function(){return this.rollbacking?this.duration-this.time:this.time},getTimeProportion:function(){return this.getPlayTime()/this.duration},getValueProportion:function(){return this.easing(this.getPlayTime(),0,1,this.duration)},getValue:function(){var a=this.beginValue,c=this.finishValue,d=this.getValueProportion();return b(a,c,d)},setValue:function(a){this.lastValue=this.currentValue,this.currentValue=a,this.setter.call(this.target,this.target,a,this)},getDelta:function(){return this.lastValue=void 0===this.lastValue?this.beginValue:this.lastValue,c(this.lastValue,this.currentValue)},play:function(){var a=(this.context,this.status);switch(this.status="playing",a){case"ready":g.isFunction(this.beginValue)&&(this.beginValue=this.beginValue.call(this.target,this.target)),g.isFunction(this.finishValue)&&(this.finishValue=this.finishValue.call(this.target,this.target)),this.time=0,this.frame=f.requestFrame(this.nextFrame.bind(this));break;case"finished":case"stoped":this.time=0,this.frame=f.requestFrame(this.nextFrame.bind(this));break;case"paused":this.frame.next()}return this.fire("play",new d(this,"play",{lastStatus:a})),this},pause:function(){return this.status="paused",this.fire("pause",new d(this,"pause")),f.releaseFrame(this.frame),this},stop:function(){return this.status="stoped",this.setValue(this.finishValue),this.rollbacking=!1,this.fire("stop",new d(this,"stop")),f.releaseFrame(this.frame),this},timeUp:function(){this.repeatOption?(this.time=0,this.rollback?this.rollbacking?(this.decreaseRepeat(),this.rollbacking=!1):(this.rollbacking=!0,this.fire("rollback",new d(this,"rollback"))):this.decreaseRepeat(),this.repeatOption?this.fire("repeat",new d(this,"repeat")):this.finish()):this.finish()},finish:function(){this.setValue(this.finishValue),this.status="finished",this.fire("finish",new d(this,"finish")),f.releaseFrame(this.frame)},decreaseRepeat:function(){this.repeatOption!==!0&&this.repeatOption--},repeat:function(a,b){return this.repeatOption=a,this.rollback=b,this}});return h.requestFrame=f.requestFrame,h.releaseFrame=f.releaseFrame,h}),define("animate/translateanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/matrix","core/utils","graphic/box","graphic/point","core/config","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/pen"],function(a){var b=a("animate/animator"),c=(a("graphic/matrix"),a("core/class").createClass("TranslateAnimator",{base:b,constructor:function(a,b){this.callBase({x:0,y:0},{x:a,y:b},function(a,b,c){var d=c.getDelta();a.translate(d.x,d.y)})}})),d=a("graphic/shape");return a("core/class").extendClass(d,{fxTranslate:function(a,b,d,e,f,g){return this.animate(new c(a,b),d,e,f,g)}}),c}),define("core/browser",[],function(){var a=function(){var a=navigator.userAgent.toLowerCase(),b=window.opera,c={ie:/(msie\s|trident.*rv:)([\w.]+)/.test(a),opera:!!b&&b.version,webkit:a.indexOf(" applewebkit/")>-1,mac:a.indexOf("macintosh")>-1,quirks:"BackCompat"==document.compatMode};c.gecko="Gecko"==navigator.product&&!c.webkit&&!c.opera&&!c.ie;var d=0;if(c.ie&&(d=1*(a.match(/(msie\s|trident.*rv:)([\w.]+)/)[2]||0),c.ie11Compat=11==document.documentMode,c.ie9Compat=9==document.documentMode),c.gecko){var e=a.match(/rv:([\d\.]+)/);e&&(e=e[1].split("."),d=1e4*e[0]+100*(e[1]||0)+1*(e[2]||0))}return/chrome\/(\d+\.\d)/i.test(a)&&(c.chrome=+RegExp.$1),/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(a)&&!/chrome/i.test(a)&&(c.safari=+(RegExp.$1||RegExp.$2)),c.opera&&(d=parseFloat(b.version())),c.webkit&&(d=parseFloat(a.match(/ applewebkit\/(\d+)/)[1])),c.version=d,c.isCompatible=!c.mobile&&(c.ie&&d>=6||c.gecko&&d>=10801||c.opera&&d>=9.5||c.air&&d>=1||c.webkit&&d>=522||!1),c}();return a}),define("core/class",["core/config"],function(require,exports){function Class(){}function getCallerClass(a){a.constructor}function checkBaseConstructorCall(a,b){var c=a.toString();if(!/this\.callBase/.test(c))throw new Error(b+" : 类构造函数没有调用父类的构造函数!为了安全,请调用父类的构造函数")}function checkMixinConstructorCall(a,b){var c=a.toString();if(!/this\.callMixin/.test(c))throw new Error(b+" : 类构造函数没有调用父类的构造函数!为了安全,请调用父类的构造函数")}function inherit(constructor,BaseClass,classname){var KityClass=eval("(function "+classname+"( __inherit__flag ) {if( __inherit__flag != KITY_INHERIT_FLAG ) {KityClass.__KityConstructor.apply(this, arguments);}this.__KityClassName = KityClass.__KityClassName;})");KityClass.__KityConstructor=constructor,KityClass.prototype=new BaseClass(KITY_INHERIT_FLAG);for(var methodName in BaseClass.prototype)BaseClass.prototype.hasOwnProperty(methodName)&&0!==methodName.indexOf("__Kity")&&(KityClass.prototype[methodName]=BaseClass.prototype[methodName]);return KityClass.prototype.constructor=KityClass,KityClass}function mixin(a,b){if(!1==b instanceof Array)return a;var c,d,e,f=b.length;for(a.__KityMixins={constructor:[]},c=0;f>c;c++){d=b[c].prototype;for(e in d)!1!==d.hasOwnProperty(e)&&0!==e.indexOf("__Kity")&&("constructor"===e?a.__KityMixins.constructor.push(d[e]):a.prototype[e]=a.__KityMixins[e]=d[e])}return a}function extend(a,b){b.__KityClassName&&(b=b.prototype);for(var c in b)if(b.hasOwnProperty(c)&&c.indexOf("__Kity")&&"constructor"!=c){var d=a.prototype[c]=b[c];d.__KityMethodClass=a,d.__KityMethodName=c}return a}function upperCamael(a){return a.substr(0,1).toUpperCase()+a.substr(1)}function generateGetMethodFor(a,b,c){var d=(c.bool?"is":"get")+upperCamael(b);c instanceof Array&&~c.indexOf("get"),a[d]="function"==typeof get?function(){return get(this._accessProperty()[b])}:function(){var a=this._accessProperty();return b in a?a[b]:a[b]="get"}}function generateSetMethodFor(a,b,c){var d="set"+b.substr(0,1).toUpperCase()+b.substr(1);a[d]="function"==typeof c?function(){var a=Array.prototype.slice.call(arguments),d=this._accessProperty();a.unshift(function(a){d[b]=a});var e=c.apply(this,a);return void 0!==e&&c.chain?this:e}:function(a){return this._accessProperty()[b]=a,this}}function generatePropertyFor(a,b){var c,d;for(c in b)b.hasOwnProperty(c)&&"function"!=typeof b[c]&&(d=b[c],generateGetMethodFor(a,c,d),generateSetMethodFor(a,c,d))}Function.prototype.bind=Function.prototype.bind||function(a){var b=Array.prototype.slice.call(arguments,1);return this.apply(a,b)};var config=require("core/config");if(config.debug){var origin=Object.prototype.toString;Object.prototype.toString=function(){return this.__KityClassName||origin.call(this)}}Class.__KityClassName="Class",Class.prototype.base=function(a){var b=arguments.callee.caller,c=b.__KityMethodClass.__KityBaseClass.prototype[a];return c.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callBase=function(){var a=arguments.callee.caller,b=a.__KityMethodClass.__KityBaseClass.prototype[a.__KityMethodName];return b.apply(this,arguments)},Class.prototype.mixin=function(a){var b=arguments.callee.caller,c=b.__KityMethodClass.__KityMixins;if(!c)return this;var d=c[a];return d.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callMixin=function(){var a=arguments.callee.caller,b=a.__KityMethodName,c=a.__KityMethodClass.__KityMixins;if(!c)return this;var d=c[b];if("constructor"==b){for(var e=0,f=d.length;f>e;e++)d[e].call(this);return this}return d.apply(this,arguments)},Class.prototype.pipe=function(a){return"function"==typeof a&&a.call(this,this),this},Class.prototype.getType=function(){return this.__KityClassName},Class.prototype.getClass=function(){return this.constructor};var KITY_INHERIT_FLAG="__KITY_INHERIT_FLAG_"+ +new Date;Class.prototype._accessProperty=function(){return this._propertyRawData||(this._propertyRawData={})},exports.createClass=function(a,b){var c,d,e;return 1===arguments.length&&(b=arguments[0],a="AnonymousClass"),e=b.base||Class,b.hasOwnProperty("constructor")?(c=b.constructor,e!=Class&&checkBaseConstructorCall(c,a)):c=function(){this.callBase.apply(this,arguments),this.callMixin.apply(this,arguments)},d=inherit(c,e,a),d=mixin(d,b.mixins),d.__KityClassName=c.__KityClassName=a,d.__KityBaseClass=c.__KityBaseClass=e,d.__KityMethodName=c.__KityMethodName="constructor",d.__KityMethodClass=c.__KityMethodClass=d,delete b.mixins,delete b.constructor,delete b.base,generatePropertyFor(d,b),d=extend(d,b)},exports.extendClass=extend}),define("core/config",[],function(){return{debug:!0,version:"1.0.0"}}),define("core/utils",[],function(){var a={each:function(a,b,c){if(null!==a)if(a.length===+a.length){for(var d=0,e=a.length;e>d;d++)if(b.call(c,a[d],d,a)===!1)return!1}else for(var f in a)if(a.hasOwnProperty(f)&&b.call(c,a[f],f,a)===!1)return!1},extend:function(a){for(var b=arguments,c=this.isBoolean(b[b.length-1])?b[b.length-1]:!1,d=this.isBoolean(b[b.length-1])?b.length-1:b.length,e=1;d>e;e++){var f=b[e];for(var g in f)c&&a.hasOwnProperty(g)||(a[g]=f[g])}return a},clone:function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},copy:function(a){return"object"!=typeof a?a:"function"==typeof a?null:JSON.parse(JSON.stringify(a))},getValue:function(a,b){return void 0!==a?a:b},flatten:function(b){var c,d=[],e=b.length;for(c=0;e>c;c++)b[c]instanceof Array?d=d.concat(a.flatten(b[c])):d.push(b[c]);return d},paralle:function(b,c,d){var e,f,g,h;if(!1===isNaN(parseFloat(b)))return d(b,c);if(b instanceof Array){for(h=[],g=0;g<b.length;g++)h.push(a.paralle(b[g],c[g],d));return h}if(b instanceof Object){h={},e=b.getClass&&b.getClass(),e&&e.parse&&(b=b.valueOf(),c=c.valueOf());for(f in b)b.hasOwnProperty(f)&&c.hasOwnProperty(f)&&(h[f]=a.paralle(b[f],c[f],d));return e&&e.parse&&(h=e.parse(h)),h}return h},parallelize:function(b){return function(c,d){return a.paralle(c,d,b)}}};return a.each(["String","Function","Array","Number","RegExp","Object","Boolean"],function(b){a["is"+b]=function(a){return Object.prototype.toString.apply(a)=="[object "+b+"]"}}),a}),define("filter/effect/colormatrixeffect",["filter/effect/effect","graphic/svg","core/class","core/utils","core/config"],function(a){var b=a("filter/effect/effect"),c=a("core/utils"),d=a("core/class").createClass("ColorMatrixEffect",{base:b,constructor:function(a,e){this.callBase(b.NAME_COLOR_MATRIX),this.set("type",c.getValue(a,d.TYPE_MATRIX)),this.set("in",c.getValue(e,b.INPUT_SOURCE_GRAPHIC))}});return c.extend(d,{TYPE_MATRIX:"matrix",TYPE_SATURATE:"saturate",TYPE_HUE_ROTATE:"hueRotate",TYPE_LUMINANCE_TO_ALPHA:"luminanceToAlpha",MATRIX_ORIGINAL:"10000010000010000010".split("").join(" "),MATRIX_EMPTY:"00000000000000000000".split("").join(" ")}),d}),define("filter/effect/compositeeffect",["filter/effect/effect","graphic/svg","core/class","core/utils","core/config"],function(a){var b=a("filter/effect/effect"),c=a("core/utils"),d=a("core/class").createClass("CompositeEffect",{base:b,constructor:function(a,e,f){this.callBase(b.NAME_COMPOSITE),this.set("operator",c.getValue(a,d.OPERATOR_OVER)),e&&this.set("in",e),f&&this.set("in2",f)}});return c.extend(d,{OPERATOR_OVER:"over",OPERATOR_IN:"in",OPERATOR_OUT:"out",OPERATOR_ATOP:"atop",OPERATOR_XOR:"xor",OPERATOR_ARITHMETIC:"arithmetic"}),d}),define("filter/effect/convolvematrixeffect",["filter/effect/effect","graphic/svg","core/class","core/utils","core/config"],function(a){var b=a("filter/effect/effect"),c=a("core/utils"),d=a("core/class").createClass("ConvolveMatrixEffect",{base:b,constructor:function(a,e){this.callBase(b.NAME_CONVOLVE_MATRIX),this.set("edgeMode",c.getValue(a,d.MODE_DUPLICATE)),this.set("in",c.getValue(e,b.INPUT_SOURCE_GRAPHIC))}});return c.extend(d,{MODE_DUPLICATE:"duplicate",MODE_WRAP:"wrap",MODE_NONE:"none"}),d}),define("filter/effect/effect",["graphic/svg","core/class","core/config","core/utils"],function(a){var b=a("graphic/svg"),c=a("core/class").createClass("Effect",{constructor:function(a){this.node=b.createNode(a)},getId:function(){return this.node.id},setId:function(a){return this.node.id=a,this},set:function(a,b){return this.node.setAttribute(a,b),this},get:function(a){return this.node.getAttribute(a)},getNode:function(){return this.node},toString:function(){return this.node.getAttribute("result")||""}});return a("core/utils").extend(c,{NAME_GAUSSIAN_BLUR:"feGaussianBlur",NAME_OFFSET:"feOffset",NAME_COMPOSITE:"feComposite",NAME_COLOR_MATRIX:"feColorMatrix",NAME_CONVOLVE_MATRIX:"feConvolveMatrix",INPUT_SOURCE_GRAPHIC:"SourceGraphic",INPUT_SOURCE_ALPHA:"SourceAlpha",INPUT_BACKGROUND_IMAGE:"BackgroundImage",INPUT_BACKGROUND_ALPHA:"BackgroundAlpha",INPUT_FILL_PAINT:"FillPaint",INPUT_STROKE_PAINT:"StrokePaint"}),c}),define("filter/effect/gaussianblureffect",["filter/effect/effect","graphic/svg","core/class","core/utils","core/config"],function(a){var b=a("filter/effect/effect"),c=a("core/utils");return a("core/class").createClass("GaussianblurEffect",{base:b,constructor:function(a,d){this.callBase(b.NAME_GAUSSIAN_BLUR),this.set("stdDeviation",c.getValue(a,1)),this.set("in",c.getValue(d,b.INPUT_SOURCE_GRAPHIC))}})}),define("filter/effect/offseteffect",["filter/effect/effect","graphic/svg","core/class","core/utils","core/config"],function(a){var b=a("filter/effect/effect"),c=a("core/utils");return a("core/class").createClass("OffsetEffect",{base:b,constructor:function(a,d,e){this.callBase(b.NAME_OFFSET),this.set("dx",c.getValue(a,0)),this.set("dy",c.getValue(d,0)),this.set("in",c.getValue(e,b.INPUT_SOURCE_GRAPHIC))}})}),define("filter/effectcontainer",["core/class","core/config","graphic/container"],function(a){return a("core/class").createClass("EffectContainer",{base:a("graphic/container"),addEffect:function(){return this.addItem.apply(this,arguments)},prependEffect:function(){return this.prependItem.apply(this,arguments)},appendEffect:function(){return this.appendItem.apply(this,arguments)},removeEffect:function(){return this.removeItem.apply(this,arguments)},addEffects:function(){return this.addItems.apply(this,arguments)},setEffects:function(){return this.setItems.apply(this,arguments)},getEffect:function(){return this.getItem.apply(this,arguments)},getEffects:function(){return this.getItems.apply(this,arguments)},getFirstEffect:function(){return this.getFirstItem.apply(this,arguments)},getLastEffect:function(){return this.getLastItem.apply(this,arguments)},itemAddedHandler:function(a,b){var c=this.getEffects().length,d=this.getItem(b+1);return c===b+1?void this.node.appendChild(a.getNode()):void this.node.insertBefore(a.getNode(),d.getNode())}})}),define("filter/filter",["graphic/svg","core/class","core/config","filter/effectcontainer","graphic/container","graphic/shape","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){var b=a("graphic/svg"),c=a("core/class"),d=c.createClass("Filter",{mixins:[a("filter/effectcontainer")],constructor:function(a,c,d,e){this.node=b.createNode("filter"),void 0!==a&&this.set("x",a),void 0!==c&&this.set("y",c),void 0!==d&&this.set("width",d),void 0!==e&&this.set("height",e)},getId:function(){return this.id},setId:function(a){return this.node.id=a,this},set:function(a,b){return this.node.setAttribute(a,b),this},get:function(a){return this.node.getAttribute(a)},getNode:function(){return this.node}}),e=a("graphic/shape");return c.extendClass(e,{applyFilter:function(a){var b=a.get("id");return b&&this.node.setAttribute("filter","url(#"+b+")"),this}}),d}),define("filter/gaussianblurfilter",["filter/effect/gaussianblureffect","filter/effect/effect","core/utils","core/class","core/config","filter/filter","graphic/svg","filter/effectcontainer","graphic/shape"],function(a){var b=a("filter/effect/gaussianblureffect");return a("core/class").createClass("GaussianblurFilter",{base:a("filter/filter"),constructor:function(a){this.callBase(),this.addEffect(new b(a))}})}),define("filter/projectionfilter",["filter/effect/gaussianblureffect","filter/effect/effect","core/utils","core/class","graphic/svg","filter/effect/colormatrixeffect","graphic/color","graphic/standardcolor","filter/effect/compositeeffect","filter/effect/offseteffect","core/config","filter/filter","filter/effectcontainer","graphic/shape"],function(a){var b=a("filter/effect/gaussianblureffect"),c=a("filter/effect/effect"),d=a("filter/effect/colormatrixeffect"),e=a("graphic/color"),f=a("core/utils"),g=a("filter/effect/compositeeffect"),h=a("filter/effect/offseteffect");return a("core/class").createClass("ProjectionFilter",{base:a("filter/filter"),constructor:function(a,e,f){this.callBase(),this.gaussianblurEffect=new b(a,c.INPUT_SOURCE_ALPHA),this.gaussianblurEffect.set("result","gaussianblur"),this.addEffect(this.gaussianblurEffect),this.offsetEffect=new h(e,f,this.gaussianblurEffect),this.offsetEffect.set("result","offsetBlur"),this.addEffect(this.offsetEffect),this.colorMatrixEffect=new d(d.TYPE_MATRIX,this.offsetEffect),this.colorMatrixEffect.set("values",d.MATRIX_ORIGINAL),this.colorMatrixEffect.set("result","colorOffsetBlur"),this.addEffect(this.colorMatrixEffect),this.compositeEffect=new g(g.OPERATOR_OVER,c.INPUT_SOURCE_GRAPHIC,this.colorMatrixEffect),this.addEffect(this.compositeEffect)},setColor:function(a){var b=null,c=[];if(f.isString(a)&&(a=e.parse(a)),!a)return this;b=d.MATRIX_EMPTY.split(" "),c.push(a.get("r")),c.push(a.get("g")),c.push(a.get("b"));for(var g=0,h=c.length;h>g;g++)b[5*g+3]=c[g]/255;return b[18]=a.get("a"),this.colorMatrixEffect.set("values",b.join(" ")),this},setOpacity:function(a){var b=this.colorMatrixEffect.get("values").split(" ");return b[18]=a,this.colorMatrixEffect.set("values",b.join(" ")),this},setOffset:function(a,b){this.setOffsetX(a),this.setOffsetY(b)},setOffsetX:function(a){this.offsetEffect.set("dx",a)},setOffsetY:function(a){this.offsetEffect.set("dy",a)},setDeviation:function(a){this.gaussianblurEffect.set("stdDeviation",a)}})}),define("graphic/bezier",["core/class","core/config","graphic/pointcontainer","graphic/container","graphic/path","core/utils","graphic/shape","graphic/svg"],function(a){return a("core/class").createClass("Bezier",{mixins:[a("graphic/pointcontainer")],base:a("graphic/path"),constructor:function(a){this.callBase(),a=a||[],this.changeable=!0,this.setBezierPoints(a)},getBezierPoints:function(){return this.getPoints()},setBezierPoints:function(a){return this.setPoints(a)},onContainerChanged:function(){this.changeable&&this.update()},update:function(){var a=null,b=this.getBezierPoints();if(!(b.length<2)){a=this.getDrawer(),a.clear();var c=b[0].getVertex(),d=null,e=null;a.moveTo(c.x,c.y);for(var f=1,g=b.length;g>f;f++)c=b[f].getVertex(),e=b[f].getBackward(),d=b[f-1].getForward(),a.bezierTo(d.x,d.y,e.x,e.y,c.x,c.y);return this}}})}),define("graphic/bezierpoint",["graphic/shapepoint","core/class","graphic/point","graphic/vector","graphic/matrix","core/config"],function(a){var b=a("graphic/shapepoint"),c=a("graphic/vector"),d=a("core/class").createClass("BezierPoint",{constructor:function(a,c,d){this.vertex=new b(a,c),this.forward=new b(a,c),this.backward=new b(a,c),this.setSmooth(void 0===d||d),this.setSymReflaction(!0)},clone:function(){var a=new d,b=null;return b=this.getVertex(),a.setVertex(b.x,b.y),b=this.getForward(),a.setForward(b.x,b.y),b=this.getBackward(),a.setBackward(b.x,b.y),a.setSmooth(a.isSmooth()),a},setVertex:function(a,b){return this.vertex.setPoint(a,b),this.update(),this},moveTo:function(a,b){var c=this.forward.getPoint(),d=this.backward.getPoint(),e=this.vertex.getPoint(),f={left:a-e.x,top:b-e.y};this.forward.setPoint(c.x+f.left,c.y+f.top),this.backward.setPoint(d.x+f.left,d.y+f.top),this.vertex.setPoint(a,b),this.update()},setForward:function(a,b){return this.forward.setPoint(a,b),this.smooth&&this.updateAnother(this.forward,this.backward),this.update(),this},setBackward:function(a,b){return this.backward.setPoint(a,b),this.smooth&&this.updateAnother(this.backward,this.forward),this.update(),this},setSymReflaction:function(a){this.symReflaction=a},isSymReflaction:function(){return this.symReflaction},updateAnother:function(a,b){var d=this.getVertex(),e=c.fromPoints(a.getPoint(),d),f=c.fromPoints(d,b.getPoint());f=c.normalize(e,this.isSymReflaction()?e.length():f.length()),b.setPoint(d.x+f.x,d.y+f.y)},setSmooth:function(a){return this.smooth=!!a,this},getVertex:function(){return this.vertex.getPoint()},getForward:function(){return this.forward.getPoint()},getBackward:function(){return this.backward.getPoint()},isSmooth:function(){return this.smooth},update:function(){return this.container?void(this.container.update&&this.container.update(this)):this}});return d}),define("graphic/box",[],function(){var a=kity.createClass("Box",{constructor:function(a,b,c,d){var e=arguments[0];e&&"object"==typeof e&&(a=e.x,b=e.y,c=e.width,d=e.height),0>c&&(a-=c=-c),0>d&&(b-=d=-d),this.x=a,this.y=b,this.width=c,this.height=d},getLeft:function(){return this.x},getRight:function(){return this.x+this.width},getTop:function(){return this.y},getBottom:function(){return this.y+this.height},getRangeX:function(){return[this.x,this.x+this.width]},getRangeY:function(){return[this.y,this.y+this.height]},merge:function(b){var c=Math.min(this.x,b.x),d=Math.max(this.x+this.width,b.x+b.width),e=Math.min(this.y,b.y),f=Math.max(this.y+this.height,b.y+b.height);return new a(c,e,d-c,f-e)},valueOf:function(){return[this.x,this.y,this.width,this.height]},toString:function(){return this.valueOf().join(" ")}});return a}),define("graphic/circle",["core/class","core/config","graphic/ellipse","core/utils","graphic/point","graphic/path"],function(a){return a("core/class").createClass("Circle",{base:a("graphic/ellipse"),constructor:function(a,b,c){this.callBase(a,a,b,c)},getRadius:function(){return this.getRadiusX()},setRadius:function(a){return this.callBase(a,a)}})}),define("graphic/clip",["core/class","core/config","graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box","graphic/shapecontainer","graphic/container"],function(a){var b=a("core/class"),c=a("graphic/shape"),d=b.createClass("Clip",{base:c,mixins:[a("graphic/shapecontainer")],constructor:function(){this.callBase("clipPath")},clip:function(a){return a.getNode().setAttribute("clip-path","url(#"+this.getId()+")"),this}});return b.extendClass(c,{clipWith:function(a){return a.clip(this),this}}),d}),define("graphic/color",["core/utils","graphic/standardcolor","core/class","core/config"],function(a){var b=a("core/utils"),c=a("graphic/standardcolor"),d={},e=a("core/class").createClass("Color",{constructor:function(){var a=null;"string"==typeof arguments[0]?(a=d.parseToValue(arguments[0]),null===a&&(a={r:0,g:0,b:0,h:0,s:0,l:0,a:1})):(a={r:0|arguments[0],g:0|arguments[1],b:0|arguments[2],a:parseFloat(arguments[3])||1},a=d.overflowFormat(a),a=b.extend(a,d.rgbValueToHslValue(a))),this._color=a},set:function(a,c){if(!e._MAX_VALUE[a])throw new Error("Color set(): Illegal parameter");
return"a"!==a&&(c=Math.floor(c)),"h"==a&&(c=(c+360)%360),this._color[a]=Math.max(e._MIN_VALUE[a],Math.min(e._MAX_VALUE[a],c)),-1!=="rgb".indexOf(a)?this._color=b.extend(this._color,d.rgbValueToHslValue(this._color)):-1!=="hsl".indexOf(a)&&(this._color=b.extend(this._color,d.hslValueToRGBValue(this._color))),this},inc:function(a,b){return b=this.get(a)+b,"h"==a?b=(b+360)%360:(b=Math.min(e._MAX_VALUE[a],b),b=Math.max(e._MIN_VALUE[a],b)),this.clone().set(a,b)},dec:function(a,b){return this.inc(a,-b)},clone:function(){return new e(this.toRGBA())},get:function(a){return e._MAX_VALUE[a]?this._color[a]:null},getValues:function(){return b.clone(this._color)},valueOf:function(){return this.getValues()},toRGB:function(){return d.toString(this._color,"rgb")},toRGBA:function(){return d.toString(this._color,"rgba")},toHEX:function(){return d.toString(this._color,"hex")},toHSL:function(){return d.toString(this._color,"hsl")},toHSLA:function(){return d.toString(this._color,"hsla")},toString:function(){return 1===this._color.a?this.toRGB():this.toRGBA()}});return b.extend(e,{_MAX_VALUE:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},_MIN_VALUE:{r:0,g:0,b:0,h:0,s:0,l:0,a:0},R:"r",G:"g",B:"b",H:"h",S:"s",L:"l",A:"a",parse:function(a){var c;return b.isString(a)&&(c=d.parseToValue(a)),b.isObject(a)&&"r"in a&&(c=a),null===c?new e:new e(c.r,c.g,c.b,c.a)},createHSL:function(a,b,c){return e.createHSLA(a,b,c,1)},createHSLA:function(a,b,c,d){var f=null;return b+="%",c+="%",f=["hsla("+a,b,c,d+")"],e.parse(f.join(", "))},createRGB:function(a,b,c){return e.createRGBA(a,b,c,1)},createRGBA:function(a,b,c,d){return new e(a,b,c,d)}}),b.extend(d,{parseToValue:function(a){var b={};if(a=c.EXTEND_STANDARD[a]||c.COLOR_STANDARD[a]||a,/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(a))b=d.hexToValue(a);else if(/^(rgba?)/i.test(a))b=d.rgbaToValue(a);else{if(!/^(hsla?)/i.test(a))return null;b=d.hslaToValue(a)}return d.overflowFormat(b)},hexToValue:function(a){var c={},e=["r","g","b"];return/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(a)?(a=RegExp.$1.split(""),b.each(e,function(b,e){c[b]=d.toNumber(3===a.length?a[e]+a[e]:a[2*e]+a[2*e+1])}),c=b.extend(c,d.rgbValueToHslValue(c)),c.a=1,c):null},rgbaToValue:function(a){var c={},e=!1,f=["r","g","b"];return/^(rgba?)/i.test(a)?(e=4===RegExp.$1.length,a=a.replace(/^rgba?/i,"").replace(/\s+/g,"").replace(/[^0-9,.]/g,"").split(","),b.each(f,function(b,d){c[b]=0|a[d]}),c=b.extend(c,d.rgbValueToHslValue(c)),c.a=e?parseFloat(a[3]):1,c):null},hslaToValue:function(a){var c={},e=!1;return/^(hsla?)/i.test(a)?(e=4===RegExp.$1.length,a=a.replace(/^hsla?/i,"").replace(/\s+/g,"").replace(/[^0-9,.]/g,"").split(","),c.h=0|a[0],c.s=0|a[1],c.l=0|a[2],c=b.extend(c,d.hslValueToRGBValue(c)),c=d.hslValueToRGBValue(c),c.a=e?parseFloat(a[3]):1,c):null},hslValueToRGBValue:function(a){function c(a,b,c){return 0>c?c+=1:c>1&&(c-=1),1>6*c?a+6*(b-a)*c:1>2*c?b:2>3*c?a+(b-a)*(2/3-c)*6:a}var d=null,e=null,f={};return a=b.extend({},a),a.h=a.h/360,a.s=a.s/100,a.l=a.l/100,0===a.s?f.r=f.g=f.b=a.l:(d=a.l<.5?a.l*(1+a.s):a.l+a.s-a.l*a.s,e=2*a.l-d,f.r=c(e,d,a.h+1/3),f.g=c(e,d,a.h),f.b=c(e,d,a.h-1/3)),f.r=Math.min(Math.round(255*f.r),255),f.g=Math.min(Math.round(255*f.g),255),f.b=Math.min(Math.round(255*f.b),255),f},rgbValueToHslValue:function(a){var c=null,d=null,e={};return a=b.extend({},a),a.r=a.r/255,a.g=a.g/255,a.b=a.b/255,c=Math.max(a.r,a.g,a.b),d=Math.min(a.r,a.g,a.b),c===d?e.h=0:c===a.r?e.h=a.g>=a.b?60*(a.g-a.b)/(c-d):60*(a.g-a.b)/(c-d)+360:c===a.g?e.h=60*(a.b-a.r)/(c-d)+120:c===a.b&&(e.h=60*(a.r-a.g)/(c-d)+240),e.l=(c+d)/2,e.s=0===e.l||c===d?0:e.l>0&&e.l<=.5?(c-d)/(c+d):(c-d)/(2-c-d),e.h=Math.round(e.h),e.s=Math.round(100*e.s),e.l=Math.round(100*e.l),e},toString:function(a,c){var e=[];return a=b.extend({},a),-1!==c.indexOf("hsl")&&(a.s+="%",a.l+="%"),"hex"!==c?(b.each(c.split(""),function(b){e.push(a[b])}),(c+"("+e.join(", ")+")").toLowerCase()):(e.push(d.toHexValue(+a.r)),e.push(d.toHexValue(+a.g)),e.push(d.toHexValue(+a.b)),("#"+e.join("")).toLowerCase())},toNumber:function(a){return 0|Number("0x"+a)},toHexValue:function(a){var b=a.toString(16);return 1===b.length?"0"+b:b},overflowFormat:function(a){var c=b.extend({},a),d="rgba";return b.each(d.split(""),function(a){c.hasOwnProperty(a)&&(c[a]=Math.min(e._MAX_VALUE[a],c[a]),c[a]=Math.max(e._MIN_VALUE[a],c[a]))}),c}}),e}),define("graphic/container",["core/class","core/config"],function(a){function b(){return this.container.removeItem(this),this}return a("core/class").createClass("Container",{getItems:function(){return this.items||(this.items=[])},getItem:function(a){return this.getItems()[a]},getFirstItem:function(){return this.getItem(0)},getLastItem:function(){return this.getItem(this.getItems().length-1)},indexOf:function(a){return this.getItems().indexOf(a)},eachItem:function(a){var b,c=this.getItems(),d=c.length;for(b=0;d>b;b++)a.call(this,b,c[b]);return this},addItem:function(a,c,d){var e=this.getItems(),f=e.length;return~e.indexOf(a)?this:(c>=0&&f>c||(c=f),e.splice(c,0,a),"object"==typeof a&&(a.container=this,a.remove=b),this.handleAdd(a,c),d||this.onContainerChanged("add",[a]),this)},addItems:function(a){for(var b=0,c=a.length;c>b;b++)this.addItem(a[b],-1,!0);return this.onContainerChanged("add",a),this},setItems:function(a){return this.clear().addItems(a)},appendItem:function(a){return this.addItem(a)},prependItem:function(a){return this.addItem(a,0)},removeItem:function(a,b){if("number"!=typeof a)return this.removeItem(this.indexOf(a));var c=this.getItems(),d=(c.length,c[a]);return void 0===d?this:(c.splice(a,1),d.container&&delete d.container,d.remove&&delete d.remove,this.handleRemove(d,a),b||this.onContainerChanged("remove",[d]),this)},clear:function(){for(var a,b=[];a=this.getFirstItem();)b.push(a),this.removeItem(0,!0);return this.onContainerChanged("remove",b),this},onContainerChanged:function(){},handleAdd:function(){},handleRemove:function(){}})}),define("graphic/curve",["core/utils","core/class","core/config","graphic/path","graphic/shape","graphic/svg","graphic/pointcontainer","graphic/container"],function(a){var b=a("core/utils"),c={getCurvePanLines:function(a,b){var d=c.getCenterPoints(a),e=c.getPanLine(a.length,d);return c.getMovedPanLines(a,e,b)},getCenterPoints:function(a){for(var b={},c=null,d=0,e=0,f=a.length;f>d;d++)e=d===f-1?0:d+1,c=d+","+e,b[c]={x:(a[d].x+a[e].y)/2,y:(a[d].x+a[e].y)/2};return b},getPanLine:function(a,b){for(var c,d={},e=null,f=0;a>f;f++){var g=null,h=null;c=(f+1)%a,e=c,g=b[f+","+c],f=c,c=(f+1)%a,h=b[f+","+c],d[e]={points:[{x:g.x,y:g.y},{x:h.x,y:h.y}],center:{x:(g.x+h.x)/2,y:(g.y+h.y)/2}},f=(e+a-1)%a}return d},getMovedPanLines:function(a,c,d){var e={};return b.each(a,function(a,f){var g=c[f],h=g.center,i={x:h.x-a.x,y:h.y-a.y},j=e[f]={points:[],center:{x:a.x,y:a.y}};b.each(g.points,function(a){var b={x:a.x-i.x,y:a.y-i.y},c=j.center,e=b.x-c.x,f=b.y-c.y;b.x=c.x+d*e,b.y=c.y+d*f,j.points.push(b)})}),e}};return a("core/class").createClass("Curve",{base:a("graphic/path"),mixins:[a("graphic/pointcontainer")],constructor:function(a,b){this.callBase(),this.setPoints(a||[]),this.closeState=!!b,this.changeable=!0,this.smoothFactor=1,this.update()},onContainerChanged:function(){this.changeable&&this.update()},setSmoothFactor:function(a){return this.smoothFactor=0>a?0:a,this.update(),this},getSmoothFactor:function(){return this.smoothFactor},update:function(){var a=this.getPoints(),b=null,d=this.getDrawer(),e=null,f=null,g=null;if(d.clear(),0===a.length)return this;if(d.moveTo(a[0]),1===a.length)return this;if(2===a.length)return d.lineTo(a[1]),this;b=c.getCurvePanLines(a,this.getSmoothFactor());for(var h=1,i=a.length;i>h;h++)e=b[h].center,f=this.closeState||h!=i-1?b[h].points[0]:b[h].center,g=this.closeState||1!=h?b[h-1].points[1]:b[h-1].center,d.bezierTo(g.x,g.y,f.x,f.y,e.x,e.y);return this.closeState&&(e=b[0].center,f=b[0].points[0],g=b[a.length-1].points[1],d.bezierTo(g.x,g.y,f.x,f.y,e.x,e.y)),this},close:function(){return this.closeState=!0,this.update()},open:function(){return this.closeState=!1,this.update()},isClose:function(){return!!this.closeState}})}),define("graphic/data",["core/class","core/config"],function(a){return a("core/class").createClass("Data",{constructor:function(){this._data={}},setData:function(a,b){return this._data[a]=b,this},getData:function(a){return this._data[a]},removeData:function(a){return delete this._data[a],this}})}),define("graphic/defbrush",["core/class","core/config","graphic/resource","graphic/svg"],function(a){return a("core/class").createClass("GradientBrush",{base:a("graphic/resource"),constructor:function(a){this.callBase(a)}})}),define("graphic/ellipse",["core/utils","graphic/point","core/class","core/config","graphic/path","graphic/shape","graphic/svg"],function(a){var b=(a("core/utils"),a("graphic/point"));return a("core/class").createClass("Ellipse",{base:a("graphic/path"),constructor:function(a,b,c,d){this.callBase(),this.rx=a||0,this.ry=b||0,this.cx=c||0,this.cy=d||0,this.update()},update:function(){var a=this.rx,b=this.ry,c=this.cx+a,d=this.cx-a,e=this.cy,f=this.getDrawer();return f.clear(),f.moveTo(c,e),f.arcTo(a,b,0,1,1,d,e),f.arcTo(a,b,0,1,1,c,e),this},getRadius:function(){return{x:this.rx,y:this.ry}},getRadiusX:function(){return this.rx},getRadiusY:function(){return this.ry},getCenter:function(){return new b(this.cx,this.cy)},getCenterX:function(){return this.cx},getCenterY:function(){return this.cy},setRadius:function(a,b){return this.rx=a,this.ry=b,this.update()},setRadiusX:function(a){return this.rx=a,this.update()},setRadiusY:function(a){return this.ry=a,this.update()},setCenter:function(a,c){if(1==arguments.length){var d=b.parse(arguments[0]);a=d.x,c=d.y}return this.cx=a,this.cy=c,this.update()},setCenterX:function(a){return this.cx=a,this.update()},setCenterY:function(a){return this.cy=a,this.update()}})}),define("graphic/eventhandler",["core/utils","graphic/shapeevent","graphic/matrix","graphic/point","core/class","core/config"],function(a){function b(a,b,c){return c=!!c,i.isString(a)&&(a=a.match(/\S+/g)),i.each(a,function(a){d.call(this,this.node,a,b,c)},this),this}function c(a,b){var c=null,d=this._EVNET_UID,e=void 0===b;try{c=l[d][a]}catch(g){return}return e||(e=!0,i.each(c,function(a,d){a===b?delete c[d]:e=!1})),e&&(f(this.node,a,k[d][a]),delete l[d][a],delete k[d][a]),this}function d(a,b,c,d){var f=this._EVNET_UID,g=this;k[f]||(k[f]={}),k[f][b]||(k[f][b]=function(a){a=new j(a||window.event),i.each(l[f][b],function(c){var e;return c&&(e=c.call(g,a),d&&g.off(b,c)),e},g)}),l[f]||(l[f]={}),l[f][b]?l[f][b].push(c):(l[f][b]=[c],a&&e(a,b,k[f][b]))}function e(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)}function f(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent(b,c)}function g(a,b,c){var d=new CustomEvent(b,{bubbles:!0,cancelable:!0});d.__kity_param=c,a.dispatchEvent(d)}function h(a,b,c){var d=null,e=null;try{if(e=k[a._EVNET_UID][b],!e)return}catch(f){return}d=i.extend({type:b,target:a},c||{}),e.call(a,d)}!function(){function a(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail),c}a.prototype=window.Event.prototype,window.CustomEvent=a}();var i=a("core/utils"),j=a("graphic/shapeevent"),k={},l={},m=0;return a("core/class").createClass("EventHandler",{constructor:function(){this._EVNET_UID=++m},addEventListener:function(a,c){return b.call(this,a,c,!1)},addOnceEventListener:function(a,c){return b.call(this,a,c,!0)},removeEventListener:function(a,b){return c.call(this,a,b)},on:function(){return this.addEventListener.apply(this,arguments)},once:function(){return this.addOnceEventListener.apply(this,arguments)},off:function(){return this.removeEventListener.apply(this,arguments)},fire:function(){return this.trigger.apply(this,arguments)},trigger:function(a,b){return this.node?g(this.node,a,b):h(this,a,b),this}})}),define("graphic/gradientbrush",["graphic/svg","graphic/defbrush","core/class","graphic/resource","graphic/color","core/utils","graphic/standardcolor","core/config"],function(a){var b=a("graphic/svg"),c=a("graphic/defbrush"),d=a("graphic/color");return a("core/class").createClass("GradientBrush",{base:c,constructor:function(a){this.callBase(a),this.stops=[]},addStop:function(a,c,e){var f=b.createNode("stop");return c instanceof d||(c=d.parse(c)),void 0===e&&(e=c.get("a")),f.setAttribute("offset",a),f.setAttribute("stop-color",c.toRGB()),1>e&&f.setAttribute("stop-opacity",e),this.node.appendChild(f),this}})}),define("graphic/group",["graphic/shapecontainer","graphic/container","core/utils","core/class","graphic/shape","core/config","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){var b=a("graphic/shapecontainer");return a("core/class").createClass("Group",{mixins:[b],base:a("graphic/shape"),constructor:function(){this.callBase("g")}})}),define("graphic/hyperlink",["graphic/shapecontainer","graphic/container","core/utils","core/class","graphic/shape","core/config","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){var b=a("graphic/shapecontainer");return a("core/class").createClass("HyperLink",{mixins:[b],base:a("graphic/shape"),constructor:function(a){this.callBase("a"),this.setHref(a)},setHref:function(a){return this.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a),this},getHref:function(){return this.node.getAttributeNS("xlink:href")},setTarget:function(a){return this.node.setAttribute("target",a),this},getTarget:function(){return this.node.getAttribute("target")}})}),define("graphic/image",["core/class","core/config","graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){return a("core/class").createClass("Image",{base:a("graphic/shape"),constructor:function(a,b,c,d,e){this.callBase("image"),this.url=a,this.width=b||0,this.height=c||0,this.x=d||0,this.y=e||0,this.update()},update:function(){return this.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",this.url),this.node.setAttribute("x",this.x),this.node.setAttribute("y",this.y),this.node.setAttribute("width",this.width),this.node.setAttribute("height",this.height),this},setUrl:function(a){return this.url=""===a?null:a,this.update()},getUrl:function(){return this.url},setWidth:function(a){return this.width=a,this.update()},getWidth:function(){return this.width},setHeight:function(a){return this.height=a,this.update()},getHeight:function(){return this.height},setX:function(a){return this.x=a,this.update()},getX:function(){return this.x},setY:function(a){return this.y=a,this.update()},getY:function(){return this.y}})}),define("graphic/line",["core/class","core/config","graphic/path","core/utils","graphic/shape","graphic/svg"],function(a){return a("core/class").createClass("Line",{base:a("graphic/path"),constructor:function(a,b,c,d){this.callBase(),this.point1={x:a||0,y:b||0},this.point2={x:c||0,y:d||0},this.update()},setPoint1:function(a,b){return this.point1.x=a,this.point1.y=b,this.update()},setPoint2:function(a,b){return this.point2.x=a,this.point2.y=b,this.update()},getPoint1:function(){return{x:this.point1.x,y:this.point1.y}},getPoint2:function(){return{x:this.point2.x,y:this.point2.y}},update:function(){var a=this.getDrawer();return a.clear(),a.moveTo(this.point1.x,this.point1.y),a.lineTo(this.point2.x,this.point2.y),this}})}),define("graphic/lineargradientbrush",["graphic/svg","graphic/gradientbrush","graphic/defbrush","graphic/color","core/class","core/config"],function(a){var b="LinearGradientBrush",c=(a("graphic/svg"),a("graphic/gradientbrush"));return a("core/class").createClass(b,{base:c,constructor:function(a){this.callBase("linearGradient"),this.setStartPosition(0,0),this.setEndPosition(1,0),"function"==typeof a&&a.call(this,this)},setStartPosition:function(a,b){return this.node.setAttribute("x1",a),this.node.setAttribute("y1",b),this},setEndPosition:function(a,b){return this.node.setAttribute("x2",a),this.node.setAttribute("y2",b),this},getStartPosition:function(){return{x:+this.node.getAttribute("x1"),y:+this.node.getAttribute("y1")}},getEndPosition:function(){return{x:+this.node.getAttribute("x2"),y:+this.node.getAttribute("y2")}}})}),define("graphic/marker",["graphic/point","core/class","core/config","graphic/resource","graphic/svg","graphic/shapecontainer","graphic/container","core/utils","graphic/shape","graphic/viewbox","graphic/path"],function(a){var b=a("graphic/point"),c=a("core/class").createClass("Marker",{base:a("graphic/resource"),mixins:[a("graphic/shapecontainer"),a("graphic/viewbox")],constructor:function(){this.callBase("marker"),this.setOrient("auto")},setRef:function(a,b){return 1===arguments.length&&(b=a.y,a=a.x),this.node.setAttribute("refX",a),this.node.setAttribute("refY",b),this},getRef:function(){return new b(+this.node.getAttribute("refX"),+this.node.getAttribute("refY"))},setWidth:function(a){return this.node.setAttribute("markerWidth",this.width=a),this},setOrient:function(a){return this.node.setAttribute("orient",this.orient=a),this},getOrient:function(){return this.orient},getWidth:function(){return+this.width},setHeight:function(a){return this.node.setAttribute("markerHeight",this.height=a),this},getHeight:function(){return+this.height}}),d=a("graphic/path");return a("core/class").extendClass(d,{setMarkerStart:function(a){this.node.setAttribute("marker-start",a.toString())},setMarkerMid:function(a){this.node.setAttribute("marker-mid",a.toString())},setMarkerEnd:function(a){this.node.setAttribute("marker-end",a.toString())}}),c}),define("graphic/mask",["core/class","core/config","graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box","graphic/shapecontainer","graphic/container"],function(a){var b=a("core/class"),c=a("graphic/shape"),d=b.createClass("Mask",{base:c,mixins:[a("graphic/shapecontainer")],constructor:function(){this.callBase("mask")},mask:function(a){return a.getNode().setAttribute("mask","url(#"+this.getId()+")"),this}});return b.extendClass(c,{maskWith:function(a){return a.mask(this),this}}),d}),define("graphic/matrix",["core/utils","graphic/box","graphic/point","core/class","core/config"],function(a){function b(a,b){return{a:b.a*a.a+b.c*a.b,b:b.b*a.a+b.d*a.b,c:b.a*a.c+b.c*a.d,d:b.b*a.c+b.d*a.d,e:b.a*a.e+b.c*a.f+b.e,f:b.b*a.e+b.d*a.f+b.f}}function c(a){return a*Math.PI/180}var d=a("core/utils"),e=a("graphic/box"),f=/matrix\((.+)\)/i,g=a("graphic/point"),h=a("core/class").createClass("Matrix",{constructor:function(){arguments.length?this.setMatrix.apply(this,arguments):this.setMatrix(1,0,0,1,0,0)},translate:function(a,c){return this.m=b(this.m,{a:1,c:0,e:a,b:0,d:1,f:c}),this},rotate:function(a){var d=c(a),e=Math.sin(d),f=Math.cos(d);return this.m=b(this.m,{a:f,c:-e,e:0,b:e,d:f,f:0}),this},scale:function(a,c){return void 0===c&&(c=a),this.m=b(this.m,{a:a,c:0,e:0,b:0,d:c,f:0}),this},skew:function(a,d){void 0===d&&(d=a);var e=Math.tan(c(a)),f=Math.tan(c(d));return this.m=b(this.m,{a:1,c:e,e:0,b:f,d:1,f:0}),this},inverse:function(){var a,b,c,d,e,f,g,i=this.m,j=i.a,k=i.b,l=i.c,m=i.d,n=i.e,o=i.f;return a=j*m-k*l,b=m/a,c=-k/a,d=-l/a,e=j/a,f=(l*o-n*m)/a,g=(k*n-j*o)/a,new h(b,c,d,e,f,g)},setMatrix:function(a,b,c,e,f,g){return this.m=1===arguments.length?d.clone(arguments[0]):{a:a,b:b,c:c,d:e,e:f,f:g},this},getMatrix:function(){return d.clone(this.m)},getTranslate:function(){var a=this.m;return{x:a.e/a.a,y:a.f/a.d}},mergeMatrix:function(a){return new h(b(this.m,a.m))},merge:function(a){return this.mergeMatrix(a)},toString:function(){return this.valueOf().join(" ")},valueOf:function(){var a=this.m;return[a.a,a.b,a.c,a.d,a.e,a.f]},transformPoint:function(){return h.transformPoint.apply(null,[].slice.call(arguments).concat([this.m]))},transformBox:function(a){return h.transformBox(a,this.m)}});return h.parse=function(a){var b,c=parseFloat;if(b=f.exec(a)){var d=b[1].split(",");return 6!=d.length&&(d=b[1].split(" ")),new h({a:c(d[0]),b:c(d[1]),c:c(d[2]),d:c(d[3]),e:c(d[4]),f:c(d[5])})}return new h},h.transformPoint=function(a,b,c){return 2===arguments.length&&(c=b,b=a.y,a=a.x),new g(c.a*a+c.c*b+c.e,c.b*a+c.d*b+c.f)},h.transformBox=function(a,b){for(var c,f,g=Number.MAX_VALUE,i=-Number.MAX_VALUE,j=Number.MAX_VALUE,k=-Number.MAX_VALUE,l=[[a.x,a.y],[a.x+a.width,a.y],[a.x,a.y+a.height],[a.x+a.width,a.y+a.height]],m=[];c=l.pop();)f=h.transformPoint(c[0],c[1],b),m.push(f),g=Math.min(g,f.x),i=Math.max(i,f.x),j=Math.min(j,f.y),k=Math.max(k,f.y);var a=new e({x:g,y:j,width:i-g,height:k-j});return d.extend(a,{closurePoints:m,left:g,right:i,top:j,bottom:k}),a},h.getCTM=function(a,b){var c={a:1,b:0,c:0,d:1,e:0,f:0};switch(b=b||"parent"){case"screen":c=a.node.getScreenCTM();break;case"doc":case"paper":c=a.node.getCTM();break;case"view":case"top":a.getPaper()&&(c=a.node.getTransformToElement(a.getPaper().shapeNode));break;case"parent":a.node.parentNode&&(c=a.node.getTransformToElement(a.node.parentNode));break;default:b.node&&(c=a.node.getTransformToElement(b.shapeNode||b.node))}return new h(c.a,c.b,c.c,c.d,c.e,c.f)},h}),define("graphic/palette",["graphic/standardcolor","graphic/color","core/utils","core/class","core/config"],function(a){var b=a("graphic/standardcolor"),c=a("graphic/color"),d=a("core/utils"),e=a("core/class").createClass("Palette",{constructor:function(){this.color={}},get:function(a){var d=this.color[a]||b.EXTEND_STANDARD[a]||b.COLOR_STANDARD[a]||"";return d?new c(d):null},getColorValue:function(a){return this.color[a]||b.EXTEND_STANDARD[a]||b.COLOR_STANDARD[a]||""},add:function(a,b){return this.color[a]="string"==typeof b?new c(b).toRGBA():b.toRGBA(),b},remove:function(a){return this.color.hasOwnProperty(a)?(delete this.color[a],!0):!1}});return d.extend(e,{getColor:function(a){var d=b.EXTEND_STANDARD[a]||b.COLOR_STANDARD[a];return d?new c(d):null},getColorValue:function(a){return b.EXTEND_STANDARD[a]||b.COLOR_STANDARD[a]||""},addColor:function(a,d){return b.EXTEND_STANDARD[a]="string"==typeof d?new c(d).toRGBA():d.toRGBA(),d},removeColor:function(a){return b.EXTEND_STANDARD.hasOwnProperty(a)?(delete b.EXTEND_STANDARD[a],!0):!1}}),e}),define("graphic/paper",["core/class","core/config","core/utils","graphic/svg","graphic/container","graphic/shapecontainer","graphic/shape","graphic/viewbox","graphic/eventhandler","graphic/shapeevent","graphic/styled","graphic/matrix","graphic/box","graphic/point","graphic/data","graphic/pen"],function(a){var b=a("core/class"),c=a("core/utils"),d=a("graphic/svg"),e=a("graphic/container"),f=a("graphic/shapecontainer"),g=a("graphic/viewbox"),h=a("graphic/eventhandler"),i=a("graphic/styled"),j=a("graphic/matrix"),k=b.createClass("Paper",{mixins:[f,h,i,g],constructor:function(a){this.callBase(),this.node=this.createSVGNode(),this.node.paper=this,this.node.appendChild(this.resourceNode=d.createNode("defs")),this.node.appendChild(this.shapeNode=d.createNode("g")),this.resources=new e,this.setWidth("100%").setHeight("100%"),a&&this.renderTo(a),this.callMixin()},renderTo:function(a){c.isString(a)&&(a=document.getElementById(a)),this.container=a,a.appendChild(this.node)},createSVGNode:function(){var a=d.createNode("svg");return a.setAttribute("xmlns","http://www.w3.org/2000/svg"),a.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),a},getNode:function(){return this.node},getContainer:function(){return this.container},getWidth:function(){return+this.node.getAttribute("width")},setWidth:function(a){return this.node.setAttribute("width",a),this},getHeight:function(){return+this.node.getAttribute("height")},setHeight:function(a){return this.node.setAttribute("height",a),this},setViewPort:function(a,b,c){var d,e;1==arguments.length&&(d=arguments[0],a=d.center.x,b=d.center.y,c=d.zoom),c=c||1,e=this.getViewBox();var f=new j,g=e.x+e.width/2-a,h=e.y+e.height/2-b;return f.translate(-a,-b),f.scale(c),f.translate(a,b),f.translate(g,h),this.shapeNode.setAttribute("transform","matrix("+f+")"),this.viewport={center:{x:a,y:b},offset:{x:g,y:h},zoom:c},this},getViewPort:function(){if(!this.viewport){var a=this.getViewBox();return{zoom:1,center:{x:a.x+a.width/2,y:a.y+a.height/2},offset:{x:0,y:0}}}return this.viewport},getViewPortTransform:function(){var a=this.shapeNode.getCTM();return new j(a.a,a.b,a.c,a.d,a.e,a.f)},getTransform:function(){return this.getViewPortTransform().reverse()},addResource:function(a){return this.resources.appendItem(a),a.node&&this.resourceNode.appendChild(a.node),this},removeResource:function(a){return a.remove&&a.remove(),a.node&&this.resourceNode.removeChild(a.node),this},getPaper:function(){return this}}),l=a("graphic/shape");return b.extendClass(l,{getPaper:function(){for(var a=this.container;a&&a instanceof k==!1;)a=a.container;return a},whenPaperReady:function(a){function b(){var b=c.getPaper();return b&&a&&a.call(c,b),b}var c=this;return b()||this.on("add treeadd",function d(){b()&&(c.off("add",d),c.off("treeadd",d))}),this}}),k}),define("graphic/path",["core/utils","core/class","core/config","graphic/shape","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){var b=a("core/utils"),c=a("core/class").createClass,d=a("graphic/shape"),e=a("graphic/svg"),f=(a("core/config"),Array.prototype.slice),g=b.flatten,h=c("PathDrawer",{constructor:function(a){this.segment=[],this.path=a,this.__clear=!1},getPath:function(){return this.path},pushSegment:function(){var a=f.call(arguments),b=this.path.getPathData();return this.__clear&&(b="",this.__clear=!1),a=g(a),this.path.setPathData(b?b+" "+a.join(" "):a.join(" ")),this},push:function(a,b){return this.pushSegment([a,f.call(b)])},moveTo:function(){return this.push("M",arguments)},moveBy:function(){return this.push("m",arguments)},lineTo:function(){return this.push("L",arguments)},lineBy:function(){return this.push("k",arguments)},arcTo:function(){return this.push("A",arguments)},arcBy:function(){return this.push("a",arguments)},carcTo:function(a){return this.push("A",[a,a,0].concat(f.call(arguments,1)))},carcBy:function(a){return this.push("a",[a,a,0].concat(f.call(arguments,1)))},bezierTo:function(){return this.push("C",arguments)},bezierBy:function(){return this.push("c",arguments)},close:function(){return this.pushSegment(["z"])},clear:function(){return this.__clear=!0,this.path.setPathData("M 0 0"),this}});return c("Path",{base:d,constructor:function(a){this.callBase("path"),a&&this.setPathData(a),this.node.setAttribute("fill",e.defaults.fill),this.node.setAttribute("stroke",e.defaults.stroke)},setPathData:function(a){return a?(a instanceof Array&&(a=g(a).join(" ")),this.pathdata=a,this.node.setAttribute("d",a),this.trigger("shapeupdate",{type:"pathdata"}),this):void 0},getPathData:function(){return this.pathdata||""},getDrawer:function(){return new h(this)},isClosed:function(){var a=this.getPathData();return!!~a.indexOf("z")||!!~a.indexOf("Z")}})}),define("graphic/patternbrush",["graphic/defbrush","core/class","graphic/resource","graphic/shapecontainer","graphic/container","core/utils","graphic/shape","graphic/svg","core/config"],function(a){{var b=a("graphic/defbrush"),c=a("graphic/shapecontainer");a("graphic/svg")}return a("core/class").createClass("PatternBrush",{base:b,mixins:[c],constructor:function(){this.callBase("pattern"),this.node.setAttribute("patternUnits","userSpaceOnUse")},setX:function(a){return this.x=a,this.node.setAttribute("x",a),this},setY:function(a){return this.y=a,this.node.setAttribute("y",a),this},setWidth:function(a){return this.width=a,this.node.setAttribute("width",a),this},setHeight:function(a){return this.height=a,this.node.setAttribute("height",a),this},getWidth:function(){return this.width},getHeight:function(){return this.height}})}),define("graphic/pen",["graphic/color","core/utils","graphic/standardcolor","core/class","core/config"],function(a){a("graphic/color");return a("core/class").createClass("Pen",{constructor:function(a,b){this.brush=a,this.width=b||1,this.linecap=null,this.linejoin=null,this.dashArray=null,this.opacity=1},getBrush:function(){return this.color},setBrush:function(a){return this.brush=a,this},setColor:function(a){return this.setBrush(a)},getWidth:function(){return this.width},setWidth:function(a){return this.width=a,this},getOpacity:function(){return this.opacity},setOpacity:function(a){this.opacity=a},getLineCap:function(){return this.linecap},setLineCap:function(a){return this.linecap=a,this},getLineJoin:function(){return this.linejoin},setLineJoin:function(a){return this.linejoin=a,this},getDashArray:function(){return this.dashArray},setDashArray:function(a){return this.dashArray=a,this},stroke:function(a){var b=a.node;b.setAttribute("stroke",this.brush.toString()),b.setAttribute("stroke-width",this.getWidth()),this.getOpacity()<1&&b.setAttribute("stroke-opacity",this.getOpacity()),this.getLineCap()&&b.setAttribute("stroke-linecap",this.getLineCap()),this.getLineJoin()&&b.setAttribute("stroke-linejoin",this.getLineJoin()),this.getDashArray()&&b.setAttribute("stroke-dasharray",this.getDashArray())}})}),define("graphic/pie",["core/class","core/config","graphic/sweep","graphic/point","graphic/path"],function(a){return a("core/class").createClass({base:a("graphic/sweep"),constructor:function(a,b,c){this.callBase([0,a],b,c)},getRadius:function(){return this.getSectionArray()[1]},setRadius:function(a){this.setSectionArray([0,a])}})}),define("graphic/point",["core/class","core/config"],function(a){var b=a("core/class").createClass("Point",{constructor:function(a,b){this.x=a||0,this.y=b||0},offset:function(a,c){return 1==arguments.length&&(c=a.y,a=a.x),new b(this.x+a,this.y+c)},valueOf:function(){return[this.x,this.y]},toString:function(){return this.valueOf().join(" ")}});return b.fromPolar=function(a,c,d){return"rad"!=d&&(c=c/180*Math.PI),new b(a*Math.cos(c),a*Math.sin(c))},b.parse=function(a){return a instanceof b?a:"string"==typeof a?b.parse(a.split(/\s*[\s,]\s*/)):"0"in a&&"1"in a?new b(a[0],a[1]):void 0},b}),define("graphic/pointcontainer",["core/class","core/config","graphic/container"],function(a){return a("core/class").createClass("PointContainer",{base:a("graphic/container"),constructor:function(){this.callBase()},addPoint:function(){return this.addItem.apply(this,arguments)},prependPoint:function(){return this.prependItem.apply(this,arguments)},appendPoint:function(){return this.appendItem.apply(this,arguments)},removePoint:function(){return this.removeItem.apply(this,arguments)},addPoints:function(){return this.addItems.apply(this,arguments)},setPoints:function(){return this.setItems.apply(this,arguments)},getPoint:function(){return this.getItem.apply(this,arguments)},getPoints:function(){return this.getItems.apply(this,arguments)},getFirstPoint:function(){return this.getFirstItem.apply(this,arguments)},getLastPoint:function(){return this.getLastItem.apply(this,arguments)}})}),define("graphic/poly",["core/utils","core/class","core/config","graphic/path","graphic/shape","graphic/svg","graphic/pointcontainer","graphic/container"],function(a){a("core/utils");return a("core/class").createClass("Poly",{base:a("graphic/path"),mixins:[a("graphic/pointcontainer")],constructor:function(a,b){this.callBase(),this.closeable=!!b,this.setPoints(a||[]),this.changeable=!0,this.update()},onContainerChanged:function(){this.changeable&&this.update()},update:function(){var a=this.getDrawer(),b=this.getPoints();if(a.clear(),!b.length)return this;a.moveTo(b[0]);for(var c,d=1,e=b.length;e>d;d++)c=b[d],a.lineTo(c);return this.closeable&&b.length>2&&a.close(),this}})}),define("graphic/polygon",["core/class","core/config","graphic/poly","core/utils","graphic/path","graphic/pointcontainer"],function(a){return a("core/class").createClass("Polygon",{base:a("graphic/poly"),constructor:function(a){this.callBase(a,!0)}})}),define("graphic/polyline",["core/class","core/config","graphic/poly","core/utils","graphic/path","graphic/pointcontainer"],function(a){return a("core/class").createClass("Polyline",{base:a("graphic/poly"),constructor:function(a){this.callBase(a)
}})}),define("graphic/radialgradientbrush",["graphic/gradientbrush","graphic/svg","graphic/defbrush","graphic/color","core/class","core/config"],function(a){var b=a("graphic/gradientbrush");return a("core/class").createClass("RadialGradientBrush",{base:b,constructor:function(a){this.callBase("radialGradient"),this.setCenter(.5,.5),this.setFocal(.5,.5),this.setRadius(.5),"function"==typeof a&&a.call(this,this)},setCenter:function(a,b){return this.node.setAttribute("cx",a),this.node.setAttribute("cy",b),this},getCenter:function(){return{x:+this.node.getAttribute("cx"),y:+this.node.getAttribute("cy")}},setFocal:function(a,b){return this.node.setAttribute("fx",a),this.node.setAttribute("fy",b),this},getFocal:function(){return{x:+this.node.getAttribute("fx"),y:+this.node.getAttribute("fy")}},setRadius:function(a){return this.node.setAttribute("r",a),this},getRadius:function(){return+this.node.getAttribute("r")}})}),define("graphic/rect",["core/utils","graphic/point","core/class","core/config","graphic/path","graphic/shape","graphic/svg"],function(a){var b={},c=a("core/utils"),d=a("graphic/point");return c.extend(b,{formatRadius:function(a,b,c){var d=Math.floor(Math.min(a/2,b/2));return Math.min(d,c)},getPathData:function(a,b,c,d,e){var f=null;return 0===e?f=["M "+a+","+b," h "+c," v "+d," h "+-c," Z"]:(c-=2*e,d-=2*e,f=["M "+(a+e)+","+b," h "+c," a "+e+" "+e+" 0 0 1 "+e+" "+e," v "+d," a "+e+" "+e+" 0 0 1 "+-e+" "+e," h "+-c," a "+e+" "+e+" 0 0 1 "+-e+" "+-e," v "+-d," a "+e+" "+e+" 0 0 1 "+e+" "+-e," Z"]),f.join("")}}),a("core/class").createClass("Rect",{base:a("graphic/path"),constructor:function(a,c,d,e,f){this.callBase(),this.x=d||0,this.y=e||0,this.width=a||0,this.height=c||0,this.radius=b.formatRadius(this.width,this.height,f||0),this.update()},update:function(){var a=b.getPathData(this.x,this.y,this.width,this.height,this.radius);return this.setPathData(a),this},setWidth:function(a){return this.width=a,this.update()},setHeight:function(a){return this.height=a,this.update()},setSize:function(a,b){return this.width=a,this.height=b,this.update()},getRadius:function(){return this.radius},setRadius:function(a){return this.radius=a,this.update()},getPosition:function(){return new d(this.x,this.y)},setPosition:function(a,b){if(1==arguments.length){var c=d.parse(arguments[0]);b=c.y,a=c.x}return this.x=a,this.y=b,this.update()},getWidth:function(){return this.width},getHeight:function(){return this.height},getPositionX:function(){return this.x},getPositionY:function(){return this.y},setPositionX:function(a){return this.x=a,this.update()},setPositionY:function(a){return this.y=a,this.update()}})}),define("graphic/regularpolygon",["graphic/point","core/class","core/config","graphic/path","core/utils","graphic/shape","graphic/svg"],function(a){var b=a("graphic/point");return a("core/class").createClass("RegularPolygon",{base:a("graphic/path"),constructor:function(a,c,d,e){this.callBase(),this.radius=c||0,this.side=Math.max(a||3,3),arguments.length>2&&3==arguments.length&&(e=d.y,d=d.x),this.center=new b(d,e),this.draw()},getSide:function(){return this.side},setSide:function(a){return this.side=a,this.draw()},getRadius:function(){return this.radius},setRadius:function(a){return this.radius=a,this.draw()},draw:function(){var a,c=this.radius,d=this.side,e=2*Math.PI/d,f=this.getDrawer();for(f.clear(),f.moveTo(b.fromPolar(c,Math.PI/2,"rad").offset(this.center)),a=0;d>=a;a++)f.lineTo(b.fromPolar(c,e*a+Math.PI/2,"rad").offset(this.center));return f.close(),this}})}),define("graphic/resource",["graphic/svg","core/class","core/config"],function(a){var b=a("graphic/svg");return a("core/class").createClass("Resource",{constructor:function(a){this.callBase(),this.node=b.createNode(a)},toString:function(){return"url(#"+this.node.id+")"}})}),define("graphic/ring",["core/class","core/config","graphic/sweep","graphic/point","graphic/path"],function(a){return a("core/class").createClass({base:a("graphic/sweep"),constructor:function(a,b){this.callBase([a,b],360,0)},getInnerRadius:function(){return this.getSectionArray()[0]},getOuterRadius:function(){return this.getSectionArray()[1]},setInnerRadius:function(a){this.setSectionArray([a,this.getOuterRadius()])},setOuterRadius:function(a){this.setSectionArray([this.getInnerRadius(),a])}})}),define("graphic/shape",["graphic/svg","core/utils","graphic/eventhandler","graphic/shapeevent","core/class","graphic/styled","graphic/data","graphic/matrix","graphic/box","graphic/point","graphic/pen","graphic/color","core/config"],function(a){var b=a("graphic/svg"),c=a("core/utils"),d=a("graphic/eventhandler"),e=a("graphic/styled"),f=a("graphic/data"),g=a("graphic/matrix"),h=(a("graphic/pen"),Array.prototype.slice),i=a("graphic/box"),j=a("core/class").createClass("Shape",{mixins:[d,e,f],constructor:function(a){this.node=b.createNode(a),this.node.shape=this,this.transform={translate:null,rotate:null,scale:null,matrix:null},this.callMixin()},getId:function(){return this.node.id},setId:function(a){return this.node.id=a,this},getNode:function(){return this.node},getBoundaryBox:function(){var a;try{a=this.node.getBBox()}catch(b){a={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}return new i(a)},getRenderBox:function(a){var b=this.getBoundaryBox(),c=this.getTransform(a);return c.transformBox(b)},getWidth:function(){return this.getRenderBox().width},getHeight:function(){return this.getRenderBox().height},getSize:function(){var a=this.getRenderBox();return delete a.x,delete a.y,a},setOpacity:function(a){return this.node.setAttribute("opacity",a),this},getOpacity:function(){var a=this.node.getAttribute("opacity");return a?+a:1},setVisible:function(a){return a?this.node.removeAttribute("display"):this.node.setAttribute("display","none"),this},getVisible:function(){this.node.getAttribute("display")},hasAncestor:function(a){for(var b=this.container;b;){if(b===a)return!0;b=b.container}return!1},getTransform:function(a){return g.getCTM(this,a)},clearTransform:function(){return this.node.removeAttribute("transform"),this.transform={translate:null,rotate:null,scale:null,matrix:null},this.trigger("shapeupdate",{type:"transform"}),this},_applyTransform:function(){var a=this.transform,b=[];return a.translate&&b.push(["translate(",a.translate,")"]),a.rotate&&b.push(["rotate(",a.rotate,")"]),a.scale&&b.push(["scale(",a.scale,")"]),a.matrix&&b.push(["matrix(",a.matrix,")"]),this.node.setAttribute("transform",c.flatten(b).join(" ")),this},setMatrix:function(a){return this.transform.matrix=a,this._applyTransform()},setTranslate:function(a){return this.transform.translate=null!==a&&h.call(arguments)||null,this._applyTransform()},setRotate:function(a){return this.transform.rotate=null!==a&&h.call(arguments)||null,this._applyTransform()},setScale:function(a){return this.transform.scale=null!=a&&h.call(arguments)||null,this._applyTransform()},translate:function(a,b){var c=this.transform.matrix||new g;return void 0===b&&(b=0),this.transform.matrix=c.translate(a,b),this._applyTransform()},rotate:function(a){var b=this.transform.matrix||new g;return this.transform.matrix=b.rotate(a),this._applyTransform()},scale:function(a,b){var c=this.transform.matrix||new g;return void 0===b&&(b=a),this.transform.matrix=c.scale(a,b),this._applyTransform()},skew:function(a,b){var c=this.transform.matrix||new g;return void 0===b&&(b=a),this.transform.matrix=c.skew(a,b),this._applyTransform()},stroke:function(a,b){return a&&a.stroke?a.stroke(this):(this.node.setAttribute("stroke",a.toString()),b&&this.node.setAttribute("stroke-width",b)),this},fill:function(a){return this.node.setAttribute("fill",a.toString()),this},setAttr:function(a,b){var d=this;c.isObject(a)&&c.each(a,function(a,b){d.setAttr(b,a)}),void 0===b||null===b||""===b?this.node.removeAttribute(a):this.node.setAttribute(a,b)},getAttr:function(a){return this.node.getAttribute(a)}});return j}),define("graphic/shapecontainer",["graphic/container","core/class","core/utils","core/config","graphic/shape","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){var b=a("graphic/container"),c=a("core/utils"),d=a("core/class").createClass("ShapeContainer",{base:b,isShapeContainer:!0,handleAdd:function(a,b){var c=this.getShapeNode();c.insertBefore(a.node,c.childNodes[b]||null),a.trigger("add",{container:this}),a.notifyTreeModification&&a.notifyTreeModification("treeadd",this)},handleRemove:function(a){var b=this.getShapeNode();b.removeChild(a.node),a.trigger("remove",{container:this}),a.notifyTreeModification&&a.notifyTreeModification("treeremove",this)},notifyTreeModification:function(a,b){this.eachItem(function(c,d){d.notifyTreeModification&&d.notifyTreeModification(a,b),d.trigger(a,{container:b})})},getShape:function(a){return this.getItem(a)},addShape:function(a,b){return this.addItem(a,b)},appendShape:function(a){return this.addShape(a)},prependShape:function(a){return this.addShape(a,0)},replaceShape:function(a,b){var c=this.indexOf(b);if(-1!==c)return this.removeShape(c),this.addShape(a,c),this},addShapeBefore:function(a,b){var c=this.indexOf(b);return this.addShape(a,c)},addShapeAfter:function(a,b){var c=this.indexOf(b);return this.addShape(a,-1===c?void 0:c+1)},addShapes:function(a){return this.addItems(a)},removeShape:function(a){return this.removeItem(a)},getShapes:function(){return this.getItems()},getShapesByType:function(a){function b(e){a.toLowerCase()==e.getType().toLowerCase()&&d.push(e),e.isShapeContainer&&c.each(e.getShapes(),function(a){b(a)})}var d=[];return b(this),d},getShapeById:function(a){return this.getShapeNode().getElementById(a).shape},arrangeShape:function(a,b){return this.removeShape(a).addShape(a,b)},getShapeNode:function(){return this.shapeNode||this.node}}),e=a("graphic/shape");return a("core/class").extendClass(e,{bringTo:function(a){return this.container.arrangeShape(this,a),this},bringFront:function(){return this.bringTo(this.container.indexOf(this)+1)},bringBack:function(){return this.bringTo(this.container.indexOf(this)-1)},bringTop:function(){return this.container.removeShape(this).addShape(this),this},bringRear:function(){return this.bringTo(0)},bringRefer:function(a,b){return a.container&&(this.remove&&this.remove(),a.container.addShape(this,a.container.indexOf(a)+(b||0))),this},bringAbove:function(a){return this.bringRefer(a)},bringBelow:function(a){return this.bringRefer(a,1)},replaceBy:function(a){return this.container&&(a.bringAbove(this),this.remove()),this}}),d}),define("graphic/shapeevent",["graphic/matrix","core/utils","graphic/box","graphic/point","core/class","core/config"],function(a){{var b=a("graphic/matrix"),c=a("core/utils");a("graphic/point")}return a("core/class").createClass("ShapeEvent",{constructor:function(a){var b=null;c.isObject(a.target)?c.extend(this,a):(this.type=a.type,b=a.target,b.correspondingUseElement&&(b=b.correspondingUseElement),this.originEvent=a,this.targetShape=b.shape||b.paper||a.currentTarget&&(a.currentTarget.shape||a.currentTarget.paper),a.__kity_param&&c.extend(this,a.__kity_param))},preventDefault:function(){var a=this.originEvent;return a?a.preventDefault?(a.preventDefault(),a.cancelable):(a.returnValue=!1,!0):!0},getPosition:function(a,c){if(!this.originEvent)return null;var d=this.originEvent.touches?this.originEvent.touches[c||0]:this.originEvent,e=d&&d.clientX||0,f=d&&d.clientY||0,g=this.targetShape.shapeNode||this.targetShape.node,h=b.transformPoint(e,f,g.getScreenCTM().inverse());return b.getCTM(this.targetShape,a||"view").transformPoint(h)},stopPropagation:function(){var a=this.originEvent;return a?void(a.stopPropagation?a.stopPropagation():a.cancelBubble=!1):!0}})}),define("graphic/shapepoint",["core/class","core/config","graphic/point"],function(a){return a("core/class").createClass("ShapePoint",{base:a("graphic/point"),constructor:function(a,b){this.callBase(a,b)},setX:function(a){return this.setPoint(a,this.y)},setY:function(a){return this.setPoint(this.x,a)},setPoint:function(a,b){return this.x=a,this.y=b,this.update(),this},getPoint:function(){return this},update:function(){return this.container&&this.container.update&&this.container.update(),this}})}),define("graphic/standardcolor",[],{COLOR_STANDARD:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00"},EXTEND_STANDARD:{}}),define("graphic/star",["graphic/point","core/class","core/config","graphic/path","core/utils","graphic/shape","graphic/svg"],function(a){var b={3:.2,5:.38196601125,6:.57735026919,8:.541196100146,10:.726542528005,12:.707106781187},c=a("graphic/point");return a("core/class").createClass("Star",{base:a("graphic/path"),constructor:function(a,b,d,e,f){this.callBase(),this.vertex=a||3,this.radius=b||0,this.shrink=d,this.offset=e||new c(0,0),this.angleOffset=f||0,this.draw()},getVertex:function(){return this.vertex},setVertex:function(a){return this.vertex=a,this.draw()},getRadius:function(){return this.radius},setRadius:function(a){return this.radius=a,this.draw()},getShrink:function(){return this.shrink},setShrink:function(a){return this.shrink=a,this.draw()},getOffset:function(){return this.offset},setOffset:function(a){return this.offset=a,this.draw()},getAngleOffset:function(){return this.angleOffset},setAngleOffset:function(a){return this.angleOffset=a,this.draw()},draw:function(){var a,d,e=this.radius,f=this.radius*(this.shrink||b[this.vertex]||.5),g=this.vertex,h=this.offset,i=90,j=180/g,k=this.angleOffset,l=this.getDrawer();for(l.clear(),l.moveTo(c.fromPolar(f,i)),a=1;2*g>=a;a++)d=i+j*a,l.lineTo(a%2?c.fromPolar(e,d+k).offset(h):c.fromPolar(f,d));l.close()}})}),define("graphic/styled",["core/class","core/config"],function(a){function b(a){return a.classList||(a.classList=new c(a)),a.classList}var c=a("core/class").createClass("ClassList",{constructor:function(a){this._node=a,this._list=a.className.toString().split(" ")},_update:function(){this._node.className=this._list.join(" ")},add:function(a){this._list.push(a),this._update()},remove:function(a){var b=this._list.indexOf(a);~b&&this._list.splice(b,1),this._update()},contains:function(a){return~this._list.indexOf(a)}});return a("core/class").createClass("Styled",{addClass:function(a){return b(this.node).add(a),this},removeClass:function(a){return b(this.node).remove(a),this},hasClass:function(a){return b(this.node).contains(a)},setStyle:function(a){if(2==arguments.length)return this.node.style[arguments[0]]=arguments[1],this;for(var b in a)a.hasOwnProperty(b)&&(this.node.style[b]=a[b]);return this}})}),define("graphic/svg",[],function(){var a=document,b=0,c={createNode:function(d){var e=a.createElementNS(c.ns,d);return e.id="kity_"+d+"_"+b++,e},defaults:{stroke:"none",fill:"none"},xlink:"http://www.w3.org/1999/xlink",ns:"http://www.w3.org/2000/svg"};return c}),define("graphic/sweep",["graphic/point","core/class","core/config","graphic/path","core/utils","graphic/shape","graphic/svg"],function(a){var b=a("graphic/point");return a("core/class").createClass("Sweep",{base:a("graphic/path"),constructor:function(a,b,c){this.callBase(),this.sectionArray=a||[],this.angle=b||0,this.angleOffset=c||0,this.draw()},getSectionArray:function(){return this.sectionArray},setSectionArray:function(a){return this.sectionArray=a,this.draw()},getAngle:function(){return this.angle},setAngle:function(a){return this.angle=a,this.draw()},getAngleOffset:function(){return this.angleOffset},setAngleOffset:function(a){return this.angleOffset=a,this.draw()},draw:function(){var a,b=this.sectionArray;for(a=0;a<b.length;a+=2)this.drawSection(b[a],b[a+1]);return this},drawSection:function(a,c){var d=this.angle&&(this.angle%360?this.angle%360:360),e=this.angleOffset,f=e+d/2,g=e+d,h=this.getDrawer();h.moveTo(b.fromPolar(a,e)),h.lineTo(b.fromPolar(c,e)),c&&(h.carcTo(c,0,1,b.fromPolar(c,f)),h.carcTo(c,0,1,b.fromPolar(c,g))),h.lineTo(b.fromPolar(a,g)),a&&(h.carcTo(a,0,1,b.fromPolar(a,f)),h.carcTo(a,0,1,b.fromPolar(a,e))),h.close()}})}),define("graphic/text",["graphic/textcontent","graphic/shape","core/class","graphic/shapecontainer","graphic/container","core/utils","graphic/svg","core/config"],function(a){function b(a){var b=window.getComputedStyle(a.node).font;if(f[b])return f[b];var c=a.getBoundaryBox(),d=a.getY()+ +a.node.getAttribute("dy"),e=d-c.y,g=e-c.height;return f[b]={top:e,bottom:g,middle:(e+g)/2}}var c=a("graphic/textcontent"),d=a("graphic/shapecontainer"),e=a("graphic/svg"),f={};return a("core/class").createClass("Text",{base:c,mixins:[d],constructor:function(a){this.callBase("text"),void 0!==a&&this.setContent(a),this.whenPaperReady(function(){this.setVerticalAlign(this.verticalAlign)})},setX:function(a){return this.node.setAttribute("x",a),this},setPosition:function(a,b){return this.setX(a).setY(b)},setY:function(a){return this.node.setAttribute("y",a),this},getX:function(){return+this.node.getAttribute("x")||0},getY:function(){return+this.node.getAttribute("y")||0},setFont:function(a){return this.callBase(a),this.setVerticalAlign(this.getVerticalAlign())},setTextAnchor:function(a){return this.node.setAttribute("text-anchor",a),this},getTextAnchor:function(){return this.node.getAttribute("text-anchor")||"start"},setVerticalAlign:function(a){var c;switch(a){case"top":c=b(this).top;break;case"bottom":c=b(this).bottom;break;case"middle":c=b(this).middle;break;default:c=0}return this.node.setAttribute("dy",c),this.verticalAlign=a,this},getVerticalAlign:function(){return this.verticalAlign||"baseline"},setStartOffset:function(a){this.shapeNode!=this.node&&this.shapeNode.setAttribute("startOffset",100*a+"%")},addSpan:function(a){return this.addShape(a),this},setPath:function(a){var b=this.shapeNode;if(this.shapeNode==this.node){for(b=this.shapeNode=e.createNode("textPath");this.node.firstChild;)this.shapeNode.appendChild(this.node.firstChild);this.node.appendChild(b)}return b.setAttributeNS(e.xlink,"xlink:href","#"+a.node.id),this.setAnchor(this.getAnchor()),this}})}),define("graphic/textcontent",["graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box","core/class","core/config"],function(a){var b=a("graphic/shape");return a("core/class").createClass("TextContent",{base:b,constructor:function(a){this.callBase(a),this.shapeNode=this.shapeNode||this.node},clearContent:function(){for(;this.shapeNode.firstChild;)this.shapeNode.removeChild(this.shapeNode.firstChild);return this},setContent:function(a){return this.shapeNode.textContent=a,this},getContent:function(){return this.shapeNode.textContent},appendContent:function(a){return this.shapeNode.textContent+=a,this},setSize:function(a){return this.setFontSize(a)},setFontSize:function(a){return this.setFont({size:a})},setFontFamily:function(a){return this.setFont({family:a})},setFontBold:function(a){return this.setFont({weight:a?"bold":"normal"})},setFontItalic:function(a){return this.setFont({style:a?"italic":"normal"})},setFont:function(a){return a.family&&this.node.setAttribute("font-family",a.family),a.size&&this.node.setAttribute("font-size",a.size),a.weight&&this.node.setAttribute("font-weight",a.weight),a.style&&this.node.setAttribute("font-style",a.style),this},getExtentOfChar:function(a){return this.node.getExtentOfChar(a)},getRotationOfChar:function(a){return this.node.getRotationOfChar(a)},getCharNumAtPosition:function(a,b){return this.node.getCharNumAtPosition(this.node.viewportElement.createSVGPoint(a,b))}})}),define("graphic/textspan",["graphic/textcontent","graphic/shape","core/class","graphic/styled","core/config"],function(a){var b=a("graphic/textcontent"),c=a("graphic/styled");return a("core/class").createClass("TextSpan",{base:b,mixins:[c],constructor:function(a){this.callBase("tspan"),this.setContent(a)}})}),define("graphic/use",["graphic/svg","core/class","core/config","graphic/shape","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/box"],function(a){var b=a("graphic/svg"),c=a("core/class"),d=c.createClass("Use",{base:a("graphic/shape"),constructor:function(a){var c=null;this.callBase("use"),c=a.getId(),c&&this.node.setAttributeNS(b.xlink,"xlink:href","#"+c),"none"===a.node.getAttribute("fill")&&a.node.removeAttribute("fill"),"none"===a.node.getAttribute("stroke")&&a.node.removeAttribute("stroke")}}),e=a("graphic/shape");return c.extendClass(e,{use:function(){return new d(this)}}),d}),define("graphic/vector",["graphic/point","core/class","graphic/matrix","core/utils","graphic/box","core/config"],function(a){var b=a("graphic/point"),c=a("graphic/matrix"),d=a("core/class").createClass("Vector",{base:b,constructor:function(a,b){this.callBase(a,b)},square:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.square())},add:function(a){return new d(this.x+a.x,this.y+a.y)},minus:function(a){return new d(this.x-a.x,this.y-a.y)},dot:function(a){return this.x*a.x+this.y*a.y},project:function(a){return a.multipy(this.dot(a)/a.square())},normalize:function(a){return void 0===a&&(a=1),this.multipy(a/this.length())},multipy:function(a){return new d(this.x*a,this.y*a)},rotate:function(a,b){"rad"==b&&(a=a/Math.PI*180);var e=(new c).rotate(a).transformPoint(this);return new d(e.x,e.y)},vertical:function(){return new d(this.y,-this.x)},reverse:function(){return this.multipy(-1)}});return d.fromPoints=function(a,b){return new d(b.x-a.x,b.y-a.y)},a("core/class").extendClass(b,{asVector:function(){return new d(this.x,this.y)}}),d}),define("graphic/view",["graphic/shapecontainer","graphic/container","core/utils","core/class","graphic/shape","graphic/viewbox","core/config","graphic/view"],function(a){var b=a("graphic/shapecontainer"),c=a("graphic/viewbox");return a("core/class").createClass("View",{mixins:[b,c],base:a("graphic/view"),constructor:function(){this.callBase("view")}})}),define("graphic/viewbox",["core/class","core/config"],function(a){return a("core/class").createClass("ViewBox",{getViewBox:function(){var a=this.node.getAttribute("viewBox");return null===a?{x:0,y:0,width:this.node.clientWidth||this.node.parentNode.clientWidth,height:this.node.clientHeight||this.node.parentNode.clientHeight}:(a=a.split(" "),{x:+a[0],y:+a[1],width:+a[2],height:+a[3]})},setViewBox:function(a,b,c,d){return this.node.setAttribute("viewBox",[a,b,c,d].join(" ")),this}})}),function(a){define("kity.start",function(b){var c=a.kity=b("core/class");b("core/utils").extend(c,{Utils:b("core/utils"),Browser:b("core/browser"),Bezier:b("graphic/bezier"),BezierPoint:b("graphic/bezierpoint"),Circle:b("graphic/circle"),Clip:b("graphic/clip"),Color:b("graphic/color"),Curve:b("graphic/curve"),Ellipse:b("graphic/ellipse"),GradientBrush:b("graphic/gradientbrush"),Group:b("graphic/group"),HyperLink:b("graphic/hyperlink"),Image:b("graphic/image"),Line:b("graphic/line"),LinearGradientBrush:b("graphic/lineargradientbrush"),Mask:b("graphic/mask"),Matrix:b("graphic/matrix"),Marker:b("graphic/marker"),Palette:b("graphic/palette"),Paper:b("graphic/paper"),Path:b("graphic/path"),PatternBrush:b("graphic/patternbrush"),Pen:b("graphic/pen"),Point:b("graphic/point"),Polygon:b("graphic/polygon"),Polyline:b("graphic/polyline"),Pie:b("graphic/pie"),RadialGradientBrush:b("graphic/radialgradientbrush"),Rect:b("graphic/rect"),RegularPolygon:b("graphic/regularpolygon"),Ring:b("graphic/ring"),Shape:b("graphic/shape"),ShapePoint:b("graphic/shapepoint"),Sweep:b("graphic/sweep"),Star:b("graphic/star"),Text:b("graphic/text"),TextSpan:b("graphic/textspan"),Use:b("graphic/use"),Vector:b("graphic/vector"),Animator:b("animate/animator"),Easing:b("animate/easing"),OpacityAnimator:b("animate/opacityanimator"),RotateAnimator:b("animate/rotateanimator"),ScaleAnimator:b("animate/scaleanimator"),Timeline:b("animate/timeline"),TranslateAnimator:b("animate/translateanimator"),Filter:b("filter/filter"),GaussianblurFilter:b("filter/gaussianblurfilter"),ProjectionFilter:b("filter/projectionfilter"),ColorMatrixEffect:b("filter/effect/colormatrixeffect"),CompositeEffect:b("filter/effect/compositeeffect"),ConvolveMatrixEffect:b("filter/effect/convolvematrixeffect"),Effect:b("filter/effect/effect"),GaussianblurEffect:b("filter/effect/gaussianblureffect"),OffsetEffect:b("filter/effect/offseteffect")})});try{use("kity.start")}catch(b){}}(this)}();
\ No newline at end of file
...@@ -79,7 +79,7 @@ $( function () { ...@@ -79,7 +79,7 @@ $( function () {
minder = window.km, minder = window.km,
// 草稿箱实例 // 草稿箱实例
draftManager = window.draftManager || ( window.draftManager = new window.DraftManager( minder ) ), draftManager,
// 当前是否要检测文档内容是否变化的开关 // 当前是否要检测文档内容是否变化的开关
watchingChanges = true, watchingChanges = true,
...@@ -99,8 +99,8 @@ $( function () { ...@@ -99,8 +99,8 @@ $( function () {
loadShare(); loadShare();
bindShortCuts(); bindShortCuts();
bindDraft(); bindDraft();
watchChanges(); draftManager && watchChanges();
if ( !loadPath() && !isShareLink ) loadDraft( 0 ); if ( draftManager && !loadPath() && !isShareLink ) loadDraft( 0 );
} }
// 创建 UI // 创建 UI
...@@ -159,14 +159,16 @@ $( function () { ...@@ -159,14 +159,16 @@ $( function () {
}, 30 ); }, 30 );
} ); } );
var clip = new window.ZeroClipboard( $copy_url_btn, { if ( window.ZeroClipboard ) {
hoverClass: 'hover', var clip = new window.ZeroClipboard( $copy_url_btn, {
activeClass: 'active' hoverClass: 'hover',
} ); activeClass: 'active'
clip.on( 'dataRequested', function ( client, args ) { } );
$copy_url_btn.loading( '已复制' ); clip.on( 'dataRequested', function ( client, args ) {
clearTimeout( copyTrickTimer ); $copy_url_btn.loading( '已复制' );
} ); clearTimeout( copyTrickTimer );
} );
}
} }
// 初始化云平台 frontia // 初始化云平台 frontia
...@@ -207,11 +209,16 @@ $( function () { ...@@ -207,11 +209,16 @@ $( function () {
$share_btn.loading( false ); $share_btn.loading( false );
return notice( '加载分享内容失败!请确认分享链接正确。' ); return notice( '加载分享内容失败!请确认分享链接正确。' );
} }
var draft = draftManager.openByPath( 'share/' + shareId );
if ( draft ) { if ( draftManager ) {
draftManager.load(); var draft = draftManager.openByPath( 'share/' + shareId );
if ( draft ) {
draftManager.load();
} else {
draftManager.create( 'share/' + shareId );
minder.importData( ret.result[ 0 ].obj.shareMinder.data, 'json' );
}
} else { } else {
draftManager.create( 'share/' + shareId );
minder.importData( ret.result[ 0 ].obj.shareMinder.data, 'json' ); minder.importData( ret.result[ 0 ].obj.shareMinder.data, 'json' );
} }
setRemotePath( null, false ); setRemotePath( null, false );
...@@ -537,11 +544,14 @@ $( function () { ...@@ -537,11 +544,14 @@ $( function () {
minder.importData( data, format ); minder.importData( data, format );
if ( !draftManager.openByPath( remotePath ) ) { if ( draftManager ) {
draftManager.create(); if ( !draftManager.openByPath( remotePath ) ) {
draftManager.create();
}
draftManager.save( remotePath );
draftManager.sync();
} }
draftManager.save( remotePath );
draftManager.sync();
minder.execCommand( 'camera', minder.getRoot() ); minder.execCommand( 'camera', minder.getRoot() );
$user_btn.loading( false ).text( getFileName( remotePath ) ); $user_btn.loading( false ).text( getFileName( remotePath ) );
...@@ -570,13 +580,13 @@ $( function () { ...@@ -570,13 +580,13 @@ $( function () {
// 点击文件菜单 // 点击文件菜单
function openFile( e ) { function openFile( e ) {
var path = $( this ).data( 'value' ); var path = $( this ).data( 'value' );
var draft = draftManager.getCurrent(); var draft = draftManager && draftManager.getCurrent();
if ( draft && draft.path == path ) { if ( draft && draft.path == path ) {
if ( !draft.sync && window.confirm( '“' + getFileName( path ) + '”在草稿箱包含未保存的更改,确定加载网盘版本覆盖草稿箱中的版本吗?' ) ) { if ( !draft.sync && window.confirm( '“' + getFileName( path ) + '”在草稿箱包含未保存的更改,确定加载网盘版本覆盖草稿箱中的版本吗?' ) ) {
setRemotePath( path, true ); setRemotePath( path, true );
loadRemote(); loadRemote();
} }
} else { } else if ( draftManager ) {
draft = draftManager.openByPath( path ); draft = draftManager.openByPath( path );
setRemotePath( path, !draft || draft.sync ); setRemotePath( path, !draft || draft.sync );
if ( draft ) { if ( draft ) {
...@@ -586,6 +596,9 @@ $( function () { ...@@ -586,6 +596,9 @@ $( function () {
} else { } else {
loadRemote(); loadRemote();
} }
} else {
setRemotePath( path, true );
loadRemote();
} }
} }
...@@ -625,8 +638,10 @@ $( function () { ...@@ -625,8 +638,10 @@ $( function () {
addToRecentMenu( [ savedFile ] ); addToRecentMenu( [ savedFile ] );
} }
setRemotePath( savedFile.path, true ); setRemotePath( savedFile.path, true );
draftManager.save( remotePath ); if ( draftManager ) {
draftManager.sync(); draftManager.save( remotePath );
draftManager.sync();
}
clearTimeout( timeout ); clearTimeout( timeout );
} else { } else {
error( '保存到云盘失败,可能是网络问题导致!' ); error( '保存到云盘失败,可能是网络问题导致!' );
...@@ -751,6 +766,12 @@ $( function () { ...@@ -751,6 +766,12 @@ $( function () {
} }
function bindDraft() { function bindDraft() {
if ( !draftManager ) {
if ( window.DraftManager ) {
draftManager = new window.DraftManager( minder );
}
}
$draft_menu.delegate( 'a.delete', 'click', function ( e ) { $draft_menu.delegate( 'a.delete', 'click', function ( e ) {
var $li = $( this ).closest( 'li.draft-item' ); var $li = $( this ).closest( 'li.draft-item' );
draftManager.remove( +$li.data( 'draft-index' ) ); draftManager.remove( +$li.data( 'draft-index' ) );
......
...@@ -34,4 +34,17 @@ ...@@ -34,4 +34,17 @@
} }
.kmui-btn-toolbar .kmui-btn .kmui-icon-preference { .kmui-btn-toolbar .kmui-btn .kmui-icon-preference {
background: url(../images/setting.png) no-repeat 2px 2px; background: url(../images/setting.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-expandnode {
background: url(../images/expand.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-collapsenode {
background: url(../images/contract.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-hyperlink {
background: url(../images/link.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-unhyperlink {
background: url(../images/unlink.png) no-repeat 2px 2px;
} }
\ No newline at end of file
Subproject commit 84b8e320dc03c3070607d20c7a5f354168d48181 Subproject commit efa481b263c2727e90101edc7710dd9a9a393f5f
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script src="lib/jquery-2.1.0.min.js" charset="utf-8"></script>
<script src="kity/dist/kitygraph.all.js" charset="utf-8"></script>
<script src="import.js" charset="utf-8"></script>
<script src="kityminder.config.js" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js" charset="utf-8"></script>
<script src="lib/zip.js" charset="utf-8"></script>
<script>
zip.inflateJSPath = 'lib/inflate.js';
</script>
<script src="lib/jquery.xml2json.js" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js" charset="utf-8"></script>
<script src="social/social.js" charset="utf-8"></script>
<link href="social/social.css" rel="stylesheet">
<link href="themes/default/css/import.css" type="text/css" rel="stylesheet" />
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon">
<link href="favicon.ico" type="image/x-icon" rel="apple-touch-icon-precomposed">
<style>
.kmui-toolbar, #social button#save-btn, #draft-btn, .user-file-menu li:first-child {
display: none;
}
</style>
</head>
<body>
<div id="kityminder" onselectstart="return false"></div>
<div id="share-dialog" >
<h3>URL分享:</h3>
<p>
<input id="share-url" type="url" value="http://naotu.baidu.com/?shareId=kcev3dd" />
<button id="copy-share-url" data-clipboard-target="share-url" type="button">复制</button>
</p>
<h3>社交分享:</h3>
<p id="share-platform" class="bdsharebuttonbox">
<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a>
<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a>
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
</p>
</div>
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdMini":"2","bdMiniList":[],"bdPic":"","bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
</body>
<script>
// create km instance
window.km = KM.getKityMinder('kityminder');
//km.setDisabled();
km.execCommand('hand');
</script>
</html>
\ No newline at end of file
KityMinder.registerModule( 'Zoom', function () { KityMinder.registerModule( 'Zoom', function () {
var MAX_ZOOM = 2,
MIN_ZOOM = kity.Browser.chrome ? 1 : 0.5,
ZOOM_STEP = Math.sqrt( 2 );
function zoom( minder, rate ) { function zoomMinder( minder, zoom ) {
var paper = minder.getPaper(); var paper = minder.getPaper();
var viewbox = paper.getViewBox(); var viewport = paper.getViewPort();
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, 500, 'ease' ); var animator = new kity.Animator( {
minder._zoomValue = zoomValue *= rate; beginValue: viewport.zoom,
} finishValue: zoom,
setter: function ( target, value ) {
viewport.zoom = value;
target.setViewPort( viewport );
}
} );
this.zoom = zoom;
var ZoomInCommand = kity.createClass( 'ZoomInCommand', { animator.start( paper, 500, 'ease' );
base: Command, }
execute: function ( minder ) {
if ( !this.queryState( minder ) ) {
zoom( minder, 1 / ZOOM_STEP );
}
},
queryState: function ( minder ) {
return ( minder._zoomValue > 1 / MAX_ZOOM ) ? 0 : -1;
},
enableReadOnly : false
} );
var ZoomOutCommand = kity.createClass( 'ZoomOutCommand', { var ZoomCommand = kity.createClass( 'Zoom', {
base: Command, base: Command,
execute: function ( minder ) { execute: zoomMinder
if ( !this.queryState( minder ) ) { } );
zoom( minder, ZOOM_STEP );
}
},
queryState: function ( minder ) {
return ( minder._zoomValue < 1 / MIN_ZOOM ) ? 0 : -1;
},
enableReadOnly : false
} );
return { var ZoomInCommand = kity.createClass( 'ZoomInCommand', {
commands: { base: Command,
'zoom-in': ZoomInCommand, execute: function ( minder ) {
'zoom-out': ZoomOutCommand zoomMinder( minder, this.nextValue() );
}, },
queryState: function ( minder ) {
return !!this.nextValue();
},
nextValue: function () {
var stack = this.getOption( 'zoom' ),
i;
for ( i = 0; i < stack.length - 1; i++ ) {
if ( stack[ i ] > this.zoom ) return stack[ i ];
}
return 0;
},
enableReadOnly: falsed
} );
var ZoomOutCommand = kity.createClass( 'ZoomOutCommand', {
base: Command,
execute: function ( minder ) {
zoomMinder( minder, this.nextValue() );
},
queryState: function ( minder ) {
return !!this.nextValue();
},
nextValue: function () {
var stack = this.getOption( 'zoom' ),
i;
for ( i = stack.length - 1; i >= 0l i-- ) {
if ( stack[ i ] < this.zoom ) return stack[ i ];
}
return 0;
},
enableReadOnly: false
} );
events: { return {
'normal.keydown': function ( e ) { commands: {
var me = this; 'zoom-in': ZoomInCommand,
var originEvent = e.originEvent; 'zoom-out': ZoomOutCommand,
var keyCode = originEvent.keyCode || originEvent.which; 'zoom': ZoomCommand
if ( keymap[ '=' ] == keyCode ) { },
me.execCommand( 'zoom-in' ); events: {
} 'normal.keydown': function ( e ) {
if ( keymap[ '-' ] == keyCode ) { var me = this;
me.execCommand( 'zoom-out' ); var originEvent = e.originEvent;
var keyCode = originEvent.keyCode || originEvent.which;
if ( keymap[ '=' ] == keyCode ) {
me.execCommand( 'zoom-in' );
}
if ( keymap[ '-' ] == keyCode ) {
me.execCommand( 'zoom-out' );
} }
}, },
'ready': function () { 'ready': function () {
this._zoomValue = 1; this._zoomValue = 1;
}, },
'normal.mousewheel readonly.mousewheel': function ( e ) { 'normal.mousewheel readonly.mousewheel': function ( e ) {
if ( !e.originEvent.ctrlKey ) return; if ( !e.originEvent.ctrlKey ) return;
var delta = e.originEvent.wheelDelta; var delta = e.originEvent.wheelDelta;
var me = this; var me = this;
if ( !kity.Browser.mac ) { if ( !kity.Browser.mac ) {
delta = -delta; delta = -delta;
} }
// 稀释 // 稀释
if ( Math.abs( delta ) > 100 ) { if ( Math.abs( delta ) > 100 ) {
clearTimeout( this._wheelZoomTimeout ); clearTimeout( this._wheelZoomTimeout );
} else { } else {
return; return;
} }
this._wheelZoomTimeout = setTimeout( function () { this._wheelZoomTimeout = setTimeout( function () {
var value; var value;
var lastValue = me.getPaper()._zoom || 1; var lastValue = me.getPaper()._zoom || 1;
if ( delta < 0 ) { if ( delta < 0 ) {
me.execCommand( 'zoom-in' ); me.execCommand( 'zoom-in' );
} else if ( delta > 0 ) { } else if ( delta > 0 ) {
me.execCommand( 'zoom-out' ); me.execCommand( 'zoom-out' );
} }
}, 100 ); }, 100 );
e.originEvent.preventDefault(); e.originEvent.preventDefault();
} }
} }
}; };
} ); } );
\ 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