Commit 71ba1683 authored by techird's avatar techird

merge dev changes

parents d2519600 838632b3
.idea
*.sublime-project
*.sublime-workspace
\ No newline at end of file
*.sublime-workspace
node_modules/
\ No newline at end of file
/*-----------------------------------------------------
* livereload Default Setting
*-----------------------------------------------------*/
'use strict';
var path = require( 'path' );
var lrSnippet = require( 'grunt-contrib-livereload/lib/utils' ).livereloadSnippet;
/*-----------------------------------------------------
* Module Setting
*-----------------------------------------------------*/
module.exports = function ( grunt ) {
var banner = '/*!\n' +
' * ====================================================\n' +
' * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
' * GitHub: <%= pkg.repository.url %> \n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' +
' * ====================================================\n' +
' */\n\n',
buildPath = 'dev/import.php';
var getPath = function ( readFile ) {
var sources = require( "fs" ).readFileSync( readFile );
sources = /Array\(([^)]+)\)/.exec( sources );
sources = sources[ 1 ].replace( /\/\/.*\n/g, '\n' ).replace( /'|"|\n|\t|\s/g, '' );
sources = sources.split( "," );
sources.forEach( function ( filepath, index ) {
sources[ index ] = filepath;
} );
return sources;
};
// Project configuration.
grunt.initConfig( {
// Metadata.
pkg: grunt.file.readJSON( 'package.json' ),
concat: {
js: {
options: {
banner: banner + '(function(kity, window) {\n\n',
footer: '\n\n})(kity, window)',
process: function ( src, filepath ) {
return src + "\n";
}
},
src: getPath( buildPath ),
dest: 'dist/kityminder.all.js'
}
},
uglify: {
minimize: {
options: {
banner: banner
},
files: {
'dist/kityminder.all.min.js': 'dist/kityminder.all.js'
}
}
},
/* Start [Task liverload] ------------------------------------*/
livereload: {
port: 35729 // Default livereload listening port.
},
connect: {
livereload: {
options: {
hostname: '*',
port: 9001,
base: '.',
middleware: function ( connect, options, middlewares ) {
return [
lrSnippet,
connect.static( options.base.toString() ),
connect.directory( options.base.toString() )
];
}
}
}
},
regarde: {
js: {
files: 'src/**/*.js',
tasks: [ 'default', 'livereload' ]
}
}
/* End [Task liverload] ------------------------------------*/
} );
// These plugins provide necessary tasks.
/* [Build plugin & task ] ------------------------------------*/
grunt.loadNpmTasks( 'grunt-contrib-concat' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
// Build task(s).
grunt.registerTask( 'default', [ 'concat:js', 'uglify:minimize' ] );
/* [liverload plugin & task ] ------------------------------------*/
grunt.loadNpmTasks( 'grunt-regarde' );
grunt.loadNpmTasks( 'grunt-contrib-connect' );
grunt.loadNpmTasks( 'grunt-contrib-livereload' );
grunt.registerTask( 'live', [ 'livereload-start', 'connect', 'regarde' ] );
};
\ No newline at end of file
Kity Minder
==========
##简介
KityMinder是百度F³团队(原UEditor团队)的又一力作。作为一款在线的脑图编辑工具,它有着不输给Native编辑工具(如xMind,MindManager等)的最佳用户体验。同时,它充分发挥了Web云存储的优势,可以直接将编辑中的脑图同步到云端。 此外,借由独创的“云盘分享”功能,用户可以一键将当前编辑的脑图直接生成在线链接共享给其他用户,实现无缝沟通。
## 简介
KityMinder 是百度 FEX 团队的 f-cube 小组(原UEditor小组)的又一力作。作为一款在线的脑图编辑工具,它有着很多Native编辑工具的交互体验。KM与UE有着一样的宗旨,就是注重最终用户的使用体验。同时,它充分发挥了Web云存储的优势,可以直接将编辑中的脑图同步到云端。此外,借由独创的 “云盘分享”功能,用户可以一键将当前编辑的脑图直接生成在线链接共享给其他用户,实现无缝沟通。
![Alt text](summary.jpg "简介图")
KM是基于SVG技术实现,使用JavaScript+html实现。支持绝大多数的主流浏览器。
支持列表如下
1. chrome
2. firefox
3. safari
4. ie9-11
1. Chrome
2. Firefox
3. Safari
4. IE9+
##项目链接
[直接使用链接](http://kitygraph.github.io/kityminder/dist/)
## 项目链接
[直接使用链接](http://fex-team.github.io/kityminder/dist/)
##联系我们
邮件:kity@baidu.com
讨论群:374918234
## 联系我们
邮件: kity@baidu.com
讨论群: 374918234
var fs = require('fs');
var dependience = [
'src/core/km.js',
'src/core/command.js',
'src/core/mindernode.js',
'src/core/minderevent.js',
'src/core/kityminder.js'
];
var buildPath = 'dist/kityminder.js';
var contents = [], content;
while(dependience.length) {
contents.push(fs.readFileSync(dependience.shift()));
}
content = contents.join('\n\n');
content = '(function(kity, window) {\n\n' + content + '\n\n})(kity, window);';
fs.writeFileSync(buildPath, content);
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<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="../dev/import.php" 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/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="../dialogs/dialogs.css" rel="stylesheet" type="text/css" />
<script>
$(function () {
// create km instance
window.km = KM.getKityMinder('kityminder');
});
</script>
</head>
<body>
<div id="kityminder" onselectstart="return false"></div>
<body>
</html>
\ No newline at end of file
.priority .icon {background:url(../dialogs/icons/iconpriority.png) 0 0}
.progress .icon{background:url(../dialogs/icons/iconprogress.png) 0 0}
.icon.p2{background-position: -20px 0}
.icon.p3{background-position: -40px 0}
.icon.p4{background-position: -60px 0}
.icon.p5{background-position: -80px 0}
\ No newline at end of file
( function () {
var utils = KM.utils;
KM.registerWidget( 'markers', {
tpl: "<ul class='icon-list'>" +
"<li value='1' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) 0 0'></span><span><%= priority %>1</span></li>" +
"<li value='2' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) -20px 0'></span><span><%= priority %>2</span></li>" +
"<li value='3' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) -40px 0'></span><span><%= priority %>3</span></li>" +
"<li value='4' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) -60px 0'></span><span><%= priority %>4</span></li>" +
"<li value='5' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) -80px 0'></span><span><%= priority %>5</span></li>" +
tpl: "<ul class='icon-list priority'>" +
"<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='3' type='priority'><span class='icon p3'></span><span><%= priority %>3</span></li>" +
"<li value='4' type='priority'><span class='icon p4'></span><span><%= priority %>4</span></li>" +
"<li value='5' type='priority'><span class='icon p5'></span><span><%= priority %>5</span></li>" +
"</ul>" +
"<ul class='icon-list'>" +
"<li value='1' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) 0 0'></span><span><%= progress.notdone %></span></li>" +
"<li value='2' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) -20px 0'></span><span><%= progress.quarterdone %></span></li>" +
"<li value='3' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) -40px 0'></span><span><%= progress.halfdone %></span></li>" +
"<li value='4' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) -60px 0'></span><span><%= progress.threequartersdone %></span></li>" +
"<li value='5' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) -80px 0'></span><span><%= progress.done %></span></li>" +
"<ul class='icon-list progress'>" +
"<li value='1' type='progress'><span class='icon p1'></span><span><%= progress.notdone %></span></li>" +
"<li value='2' type='progress'><span class='icon p2'></span><span><%= progress.quarterdone %></span></li>" +
"<li value='3' type='progress'><span class='icon p3'></span><span><%= progress.halfdone %></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>" +
"</ul>",
initContent: function ( km ) {
var lang = km.getLang( 'dialogs.markers' );
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="jquery-2.1.0.min.js" charset="utf-8"></script>
<script src="baidu-frontia-js-full-1.0.0.js" charset="utf-8"></script>
<script src="social.js" charset="utf-8"></script>
<script src="../kity/dist/kitygraph.all.js" charset="utf-8"></script>
<script src="../configure.js" charset="utf-8"></script>
<script src="../dist/dev.js" charset="utf-8"></script>
<script src="../lib/jquery-2.1.0.min.js" charset="utf-8"></script>
<script src="../kity/dist/kitygraph.all.min.js" charset="utf-8"></script>
<script src="../dist/kityminder.all.min.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>
<link href="../themes/default/css/import.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" href="social.css">
<style>
.km_receiver{
width:0;
height:0;
}
.km-minderNode{
cursor:default;
}
.kmui-container {
height: 100%;
}
html, body, div {
margin: 0;
padding: 0;
}
html, body, div.kmui-editor-body {
height: 100%;
-moz-user-select: none;
}
</style>
<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="../dialogs/dialogs.css" rel="stylesheet" type="text/css" />
<script>
$(function () {
// create km instance
window.km = KM.getKityMinder('kityminder');
});
</script>
</head>
<body >
<div id="kityminder" style="height:100%;width:100%" onselectstart="return false">
</div>
<div id="social"></div>
</body>
<script>
window.km = KM.getKityMinder('kityminder');
</script>
<body>
<div id="kityminder" onselectstart="return false"></div>
<body>
</html>
\ No newline at end of file
/*!
* ====================================================
* kityminder - v1.0.0 - 2014-03-07
* https://github.com/fex-team/kityminder
* GitHub: https://github.com/fex-team/kityminder.git
* Copyright (c) 2014 f-cube @ FEX; Licensed MIT
* ====================================================
*/
(function(kity, window) {
var KityMinder = window.KM = window.KityMinder = function () {
var instanceMap = {}, instanceId = 0;
return {
......@@ -1142,10 +1153,14 @@ kity.extendClass( Minder, {
if(callbacks.length == 0){
return;
}
var lastStatus = this.getStatus();
for ( var i = 0; i < callbacks.length; i++ ) {
callbacks[ i ].call( this, e );
if ( e.shouldStopPropagationImmediately() ) {
if ( this.getStatus() != lastStatus || e.shouldStopPropagationImmediately() ) {
break;
}
}
......@@ -2335,8 +2350,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
prt = prt.getParent();
}
//自顶向下更新受影响一侧的y值
var sideList = root.getLayout()[ appendside + "List" ];
}
//自顶向下更新受影响一侧的y值
var updateSide = function ( appendside ) {
var _buffer = [ root ];
while ( _buffer.length > 0 ) {
var _buffer0Layout = _buffer[ 0 ].getLayout();
......@@ -2351,6 +2367,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
if ( _buffer[ 0 ] !== root ) effectSet.push( _buffer[ 0 ] );
_buffer.shift();
}
};
var sideList;
if ( appendside ) {
updateSide( appendside );
} else {
updateSide( "left" );
updateSide( "right" );
}
return effectSet;
};
......@@ -4114,186 +4137,6 @@ KityMinder.registerModule( "Select", function () {
};
} );
KityMinder.registerModule( "HistoryModule", function () {
var km = this;
var Scene = kity.createClass( 'Scene', {
constructor: function ( root ) {
this.data = root.clone();
},
getData: function () {
return this.data;
},
cloneData: function () {
return this.getData().clone();
},
equals: function ( scene ) {
return this.getData().equals( scene.getData() )
}
} );
var HistoryManager = kity.createClass( 'HistoryManager', {
constructor: function ( km ) {
this.list = [];
this.index = 0;
this.hasUndo = false;
this.hasRedo = false;
this.km = km;
},
undo: function () {
if ( this.hasUndo ) {
if ( !this.list[ this.index - 1 ] && this.list.length == 1 ) {
this.reset();
return;
}
while ( this.list[ this.index ].equals( this.list[ this.index - 1 ] ) ) {
this.index--;
if ( this.index == 0 ) {
return this.restore( 0 );
}
}
this.restore( --this.index );
}
},
redo: function () {
if ( this.hasRedo ) {
while ( this.list[ this.index ].equals( this.list[ this.index + 1 ] ) ) {
this.index++;
if ( this.index == this.list.length - 1 ) {
return this.restore( this.index );
}
}
this.restore( ++this.index );
}
},
restore: function () {
var scene = this.list[ this.index ];
this.km.setRoot( scene.cloneData() );
this.km.removeAllSelectedNodes();
this.km.initStyle();
this.update();
this.km.fire('restoreScene');
this.km.fire('contentChange');
},
getScene: function () {
return new Scene( this.km.getRoot() )
},
saveScene: function () {
var currentScene = this.getScene();
var lastScene = this.list[ this.index ];
if ( lastScene && lastScene.equals( currentScene ) ) {
return
}
this.list = this.list.slice( 0, this.index + 1 );
this.list.push( currentScene );
//如果大于最大数量了,就把最前的剔除
if ( this.list.length > this.km.getOptions( 'maxUndoCount' ) ) {
this.list.shift();
}
this.index = this.list.length - 1;
//跟新undo/redo状态
this.update();
},
update: function () {
this.hasRedo = !! this.list[ this.index + 1 ];
this.hasUndo = !! this.list[ this.index - 1 ];
},
reset: function () {
this.list = [];
this.index = 0;
this.hasUndo = false;
this.hasRedo = false;
}
} );
//为km实例添加history管理
this.historyManager = new HistoryManager( this );
var keys = {
/*Shift*/ 16:1, /*Ctrl*/ 17:1, /*Alt*/ 18:1,/*Command*/91:1,
37:1, 38:1, 39:1, 40:1
},
keycont = 0,
lastKeyCode,
saveSceneTimer;
return {
defaultOptions: {
maxUndoCount: 20,
maxInputCount:20
},
"commands": {
"undo": kity.createClass( "UndoCommand", {
base: Command,
execute: function ( km ) {
km.historyManager.undo()
},
queryState: function ( km ) {
return km.historyManager.hasUndo ? 0 : -1;
},
isNeedUndo: function () {
return false;
}
} ),
"redo": kity.createClass( "RedoCommand", {
base: Command,
execute: function ( km ) {
km.historyManager.redo()
},
queryState: function ( km ) {
return km.historyManager.hasRedo ? 0 : -1;
},
isNeedUndo: function () {
return false;
}
} )
},
addShortcutKeys: {
"Undo": "ctrl+z", //undo
"Redo": "ctrl+y" //redo
},
"events": {
"saveScene": function ( e ) {
this.historyManager.saveScene();
},
"renderNode":function(e){
var node = e.node;
if(node.isHighlight()){
km.select(node);
}
},
"keydown":function(e){
var orgEvt = e.originEvent;
var keyCode = orgEvt.keyCode || orgEvt.which;
if (!keys[keyCode] && !orgEvt.ctrlKey && !orgEvt.metaKey && !orgEvt.shiftKey && !orgEvt.altKey) {
if (km.historyManager.list.length == 0) {
km.historyManager.saveScene();
}
clearTimeout(saveSceneTimer);
saveSceneTimer = setTimeout(function(){
km.historyManager.saveScene();
},200);
lastKeyCode = keyCode;
keycont++;
if (keycont >= km.getOptions('maxInputCount') ) {
km.historyManager.saveScene()
}
}
}
}
};
} );
KityMinder.registerModule( "TextEditModule", function () {
var km = this;
var sel = new Minder.Selection();
......@@ -5230,11 +5073,21 @@ KityMinder.registerModule( 'Zoom', function () {
'zoom-in': ZoomInCommand,
'zoom-out': ZoomOutCommand
},
addShortcutKeys: {
"zoom-in": "=", //=
"zoom-out": "-" //-
},
events: {
'normal.keydown':function(e){
var me = this;
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 () {
this._zoomValue = 1;
},
......@@ -6851,172 +6704,6 @@ KM.ui.define('separator', {
}
});
//scale 类
KM.ui.define('scale', {
tpl: '<div class="kmui-scale" unselectable="on">' +
'<span class="kmui-scale-hand0"></span>' +
'<span class="kmui-scale-hand1"></span>' +
'<span class="kmui-scale-hand2"></span>' +
'<span class="kmui-scale-hand3"></span>' +
'<span class="kmui-scale-hand4"></span>' +
'<span class="kmui-scale-hand5"></span>' +
'<span class="kmui-scale-hand6"></span>' +
'<span class="kmui-scale-hand7"></span>' +
'</div>',
defaultOpt: {
$doc: $(document),
$wrap: $(document)
},
init: function (options) {
if(options.$doc) this.defaultOpt.$doc = options.$doc;
if(options.$wrap) this.defaultOpt.$wrap = options.$wrap;
this.root($($.parseTmpl(this.tpl, options)));
this.initStyle();
this.startPos = this.prePos = {x: 0, y: 0};
this.dragId = -1;
return this;
},
initStyle: function () {
utils.cssRule('kmui-style-scale', '.kmui-scale{display:none;position:absolute;border:1px solid #38B2CE;cursor:hand;}' +
'.kmui-scale span{position:absolute;left:0;top:0;width:7px;height:7px;overflow:hidden;font-size:0px;display:block;background-color:#3C9DD0;}'
+ '.kmui-scale .kmui-scale-hand0{cursor:nw-resize;top:0;margin-top:-4px;left:0;margin-left:-4px;}'
+ '.kmui-scale .kmui-scale-hand1{cursor:n-resize;top:0;margin-top:-4px;left:50%;margin-left:-4px;}'
+ '.kmui-scale .kmui-scale-hand2{cursor:ne-resize;top:0;margin-top:-4px;left:100%;margin-left:-3px;}'
+ '.kmui-scale .kmui-scale-hand3{cursor:w-resize;top:50%;margin-top:-4px;left:0;margin-left:-4px;}'
+ '.kmui-scale .kmui-scale-hand4{cursor:e-resize;top:50%;margin-top:-4px;left:100%;margin-left:-3px;}'
+ '.kmui-scale .kmui-scale-hand5{cursor:sw-resize;top:100%;margin-top:-3px;left:0;margin-left:-4px;}'
+ '.kmui-scale .kmui-scale-hand6{cursor:s-resize;top:100%;margin-top:-3px;left:50%;margin-left:-4px;}'
+ '.kmui-scale .kmui-scale-hand7{cursor:se-resize;top:100%;margin-top:-3px;left:100%;margin-left:-3px;}');
},
_eventHandler: function (e) {
var me = this,
$doc = me.defaultOpt.$doc;
switch (e.type) {
case 'mousedown':
var hand = e.target || e.srcElement, hand;
if (hand.className.indexOf('kmui-scale-hand') != -1) {
me.dragId = hand.className.slice(-1);
me.startPos.x = me.prePos.x = e.clientX;
me.startPos.y = me.prePos.y = e.clientY;
$doc.bind('mousemove', $.proxy(me._eventHandler, me));
}
break;
case 'mousemove':
if (me.dragId != -1) {
me.updateContainerStyle(me.dragId, {x: e.clientX - me.prePos.x, y: e.clientY - me.prePos.y});
me.prePos.x = e.clientX;
me.prePos.y = e.clientY;
me.updateTargetElement();
}
break;
case 'mouseup':
if (me.dragId != -1) {
me.dragId = -1;
me.updateTargetElement();
var $target = me.data('$scaleTarget');
if ($target.parent()) me.attachTo(me.data('$scaleTarget'));
}
$doc.unbind('mousemove', $.proxy(me._eventHandler, me));
break;
default:
break;
}
},
updateTargetElement: function () {
var me = this,
$root = me.root(),
$target = me.data('$scaleTarget');
$target.css({width: $root.width(), height: $root.height()});
me.attachTo($target);
},
updateContainerStyle: function (dir, offset) {
var me = this,
$dom = me.root(),
tmp,
rect = [
//[left, top, width, height]
[0, 0, -1, -1],
[0, 0, 0, -1],
[0, 0, 1, -1],
[0, 0, -1, 0],
[0, 0, 1, 0],
[0, 0, -1, 1],
[0, 0, 0, 1],
[0, 0, 1, 1]
];
if (rect[dir][0] != 0) {
tmp = parseInt($dom.offset().left) + offset.x;
$dom.css('left', me._validScaledProp('left', tmp));
}
if (rect[dir][1] != 0) {
tmp = parseInt($dom.offset().top) + offset.y;
$dom.css('top', me._validScaledProp('top', tmp));
}
if (rect[dir][2] != 0) {
tmp = $dom.width() + rect[dir][2] * offset.x;
$dom.css('width', me._validScaledProp('width', tmp));
}
if (rect[dir][3] != 0) {
tmp = $dom.height() + rect[dir][3] * offset.y;
$dom.css('height', me._validScaledProp('height', tmp));
}
},
_validScaledProp: function (prop, value) {
var $ele = this.root(),
$wrap = this.defaultOpt.$doc,
calc = function(val, a, b){
return (val + a) > b ? b - a : value;
};
value = isNaN(value) ? 0 : value;
switch (prop) {
case 'left':
return value < 0 ? 0 : calc(value, $ele.width(), $wrap.width());
case 'top':
return value < 0 ? 0 : calc(value, $ele.height(),$wrap.height());
case 'width':
return value <= 0 ? 1 : calc(value, $ele.offset().left, $wrap.width());
case 'height':
return value <= 0 ? 1 : calc(value, $ele.offset().top, $wrap.height());
}
},
show: function ($obj) {
var me = this;
if ($obj) me.attachTo($obj);
me.root().bind('mousedown', $.proxy(me._eventHandler, me));
me.defaultOpt.$doc.bind('mouseup', $.proxy(me._eventHandler, me));
me.root().show();
me.trigger("aftershow");
},
hide: function () {
var me = this;
me.root().unbind('mousedown', $.proxy(me._eventHandler, me));
me.defaultOpt.$doc.unbind('mouseup', $.proxy(me._eventHandler, me));
me.root().hide();
me.trigger('afterhide')
},
attachTo: function ($obj) {
var me = this,
imgPos = $obj.offset(),
$root = me.root(),
$wrap = me.defaultOpt.$wrap,
posObj = $wrap.offset();
me.data('$scaleTarget', $obj);
me.root().css({
position: 'absolute',
width: $obj.width(),
height: $obj.height(),
left: imgPos.left - posObj.left - parseInt($wrap.css('border-left-width')) - parseInt($root.css('border-left-width')),
top: imgPos.top - posObj.top - parseInt($wrap.css('border-top-width')) - parseInt($root.css('border-top-width'))
});
},
getScaleTarget: function () {
return this.data('$scaleTarget')[0];
}
});
/**
* 宽度自适应工具函数
* @param word 单词内容
......@@ -7417,7 +7104,7 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
var renderBox = me.getRenderContainer().getRenderBox( "top" );
var renderContainer = me.getRenderContainer();
var transform = renderContainer.getTransform();
renderContainer.setTransform( new kity.Matrix().translate( -renderBox.x, -renderBox.y ) );
renderContainer.clearTransform();
var loop = 0;
var svg = $( svghtml ).attr( {
width: renderBox.width,
......@@ -8127,3 +7814,5 @@ KityMinder.registerProtocal( "svg", function () {
};
} );
})(kity, window)
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "kityminder",
"title": "kityminder",
"description": "Kity Minder",
"version": "1.0.0",
"homepage": "https://github.com/fex-team/kityminder",
"author": {
"name": "f-cube @ FEX",
"url": "http://fex.baidu.com"
},
"repository": {
"type": "git",
"url": "https://github.com/fex-team/kityminder.git"
},
"keywords": [
"kityminder",
"kity",
"minder",
"svg",
"graphic",
"javascript"
],
"bugs": {
"url": "https://github.com/fex-team/kityminder/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/fex-team/kityminder/blob/dev/LICENSE"
}
],
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.2.6",
"grunt-regarde": "latest",
"grunt-contrib-connect": "latest",
"grunt-contrib-livereload": "latest"
}
}
\ No newline at end of file
......@@ -36,7 +36,7 @@ $.extend( $.fn, {
} );
$( function () {
var $panel = $( '#social' );
var $panel = $( '<div id="social"></div>' ).appendTo( 'body' );
var $login_btn, $save_btn, $share_btn, $user_btn, $user_menu;
var baseUrl = ( function () {
......@@ -322,7 +322,7 @@ $( function () {
if ( currentUser ) {
setCurrentUser( currentUser );
loadPath();
if(thisMapFilename) {
if ( thisMapFilename ) {
loadPersonal( thisMapFilename );
}
} else {
......
......@@ -37,7 +37,7 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
var renderBox = me.getRenderContainer().getRenderBox( "top" );
var renderContainer = me.getRenderContainer();
var transform = renderContainer.getTransform();
renderContainer.setTransform( new kity.Matrix().translate( -renderBox.x, -renderBox.y ) );
renderContainer.clearTransform();
var loop = 0;
var svg = $( svghtml ).attr( {
width: renderBox.width,
......
......@@ -77,10 +77,14 @@ kity.extendClass( Minder, {
if(callbacks.length == 0){
return;
}
var lastStatus = this.getStatus();
for ( var i = 0; i < callbacks.length; i++ ) {
callbacks[ i ].call( this, e );
if ( e.shouldStopPropagationImmediately() ) {
if ( this.getStatus() != lastStatus || e.shouldStopPropagationImmediately() ) {
break;
}
}
......
......@@ -236,8 +236,9 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
prt = prt.getParent();
}
//自顶向下更新受影响一侧的y值
var sideList = root.getLayout()[ appendside + "List" ];
}
//自顶向下更新受影响一侧的y值
var updateSide = function ( appendside ) {
var _buffer = [ root ];
while ( _buffer.length > 0 ) {
var _buffer0Layout = _buffer[ 0 ].getLayout();
......@@ -252,6 +253,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
if ( _buffer[ 0 ] !== root ) effectSet.push( _buffer[ 0 ] );
_buffer.shift();
}
};
var sideList;
if ( appendside ) {
updateSide( appendside );
} else {
updateSide( "left" );
updateSide( "right" );
}
return effectSet;
};
......
......@@ -61,11 +61,21 @@ KityMinder.registerModule( 'Zoom', function () {
'zoom-in': ZoomInCommand,
'zoom-out': ZoomOutCommand
},
addShortcutKeys: {
"zoom-in": "=", //=
"zoom-out": "-" //-
},
events: {
'normal.keydown':function(e){
var me = this;
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 () {
this._zoomValue = 1;
},
......
html, body, div {
margin: 0;
padding: 0;
}
html, body, #kity-minder, div.kmui-editor-body {
height:100%;
width:100%
-moz-user-select: none;
}
.km_receiver{
width:0;
height:0;
}
.km-minderNode{
cursor:default;
}
.kmui-container {
height: 100%;
}
.kmui-container {
}
.kmui-container .kmui-toolbar{
......
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