Commit 8bcb3716 authored by techird's avatar techird

merge from dev

parents dfcf899e 613463da
...@@ -14,9 +14,22 @@ KM是基于SVG技术实现,使用JavaScript+html实现。支持绝大多数的 ...@@ -14,9 +14,22 @@ KM是基于SVG技术实现,使用JavaScript+html实现。支持绝大多数的
3. Safari 3. Safari
4. IE9+ 4. IE9+
## 线上版本
[http://fex-team.baidu.com/kityminder/dist](http://fex-team.baidu.com/kityminder/dist)
## 项目链接 ## 依赖说明
[直接使用链接](http://fex-team.github.io/kityminder/dist/)
KityMinder 依赖 Kity 库。刚下载的压缩包或者刚从 github 拉下来的代码会有一个空的 kity 目录。要运行调试,必须加载 Kity 的依赖:
1. 如果你下载的是 KityMinder 的压缩包,那么需要手动下载 [Kity](http://kitygraph.github.io/kityminder/kity/dist/kitygraph.all.js) 库到 kity/dist/kitygraph.all.js
2. 如果你是从 github 上拉源代码下来的,那么可以更新一下子模块:
```bash
cd YOUR_KITYMINDER_PATH
git submodule init
git submodule update
```
## 联系我们 ## 联系我们
邮件: kity@baidu.com 邮件: kity@baidu.com
......
...@@ -27,6 +27,6 @@ ...@@ -27,6 +27,6 @@
<body> <body>
<div id="kityminder" onselectstart="return false"></div> <div id="kityminder" onselectstart="return false"></div>
<body> </body>
</html> </html>
\ No newline at end of file
...@@ -27,6 +27,6 @@ ...@@ -27,6 +27,6 @@
<body> <body>
<div id="kityminder" onselectstart="return false"></div> <div id="kityminder" onselectstart="return false"></div>
<body> </body>
</html> </html>
\ No newline at end of file
...@@ -237,7 +237,8 @@ $( function () { ...@@ -237,7 +237,8 @@ $( function () {
var data = window.km.exportData( 'json' ); var data = window.km.exportData( 'json' );
$share_btn.loading( '正在分享...' ); $share_btn.loading( '正在分享...' );
var shareUrl = baseUrl + 'index.html?share_id=' + share_id; var currentUrl = window.location.origin + window.location.pathname;
var shareUrl = currentUrl + '?share_id=' + share_id;
share( data, share_id, function ( success ) { share( data, share_id, function ( success ) {
if ( success ) { if ( success ) {
var $popup = $( '<div></div>' ).addClass( 'popup' ).appendTo( 'body' ); var $popup = $( '<div></div>' ).addClass( 'popup' ).appendTo( 'body' );
......
...@@ -113,6 +113,7 @@ KityMinder.registerModule( 'Hand', function () { ...@@ -113,6 +113,7 @@ KityMinder.registerModule( 'Hand', function () {
mousewheel: function ( e ) { mousewheel: function ( e ) {
var dx, dy; var dx, dy;
e = e.originEvent; e = e.originEvent;
if(e.ctrlKey || e.shiftKey) return;
if ( 'wheelDeltaX' in e ) { if ( 'wheelDeltaX' in e ) {
...@@ -133,7 +134,7 @@ KityMinder.registerModule( 'Hand', function () { ...@@ -133,7 +134,7 @@ KityMinder.registerModule( 'Hand', function () {
e.preventDefault(); e.preventDefault();
}, },
dblclick: function ( e ) { 'normal.dblclick': function ( e ) {
if ( e.getTargetNode() ) return; if ( e.getTargetNode() ) return;
var viewport = this.getPaper().getViewPort(); var viewport = this.getPaper().getViewPort();
......
KityMinder.registerModule( 'Zoom', function () { KityMinder.registerModule( 'Zoom', function () {
var MAX_ZOOM = 2, var MAX_ZOOM = 2,
MIN_ZOOM = 0.5, MIN_ZOOM = kity.Browser.chrome ? 1 : 0.5,
ZOOM_STEP = Math.sqrt( 2 ); ZOOM_STEP = Math.sqrt( 2 );
function zoom( minder, rate ) { function zoom( minder, rate ) {
...@@ -28,31 +28,31 @@ KityMinder.registerModule( 'Zoom', function () { ...@@ -28,31 +28,31 @@ KityMinder.registerModule( 'Zoom', function () {
} }
} ); } );
animator.start( paper, 100, 'ease' ); animator.start( paper, 500, 'ease' );
minder._zoomValue = zoomValue *= rate; minder._zoomValue = zoomValue *= rate;
} }
var ZoomInCommand = kity.createClass( 'ZoomInCommand', { var ZoomInCommand = kity.createClass( 'ZoomInCommand', {
base: Command, base: Command,
execute: function ( minder ) { execute: function ( minder ) {
if( !this.queryState( minder ) ) { if ( !this.queryState( minder ) ) {
zoom( minder, 1 / ZOOM_STEP ); zoom( minder, 1 / ZOOM_STEP );
} }
}, },
queryState: function ( minder ) { queryState: function ( minder ) {
return (minder._zoomValue > MIN_ZOOM) ? 0 : -1; return ( minder._zoomValue > 1 / MAX_ZOOM ) ? 0 : -1;
} }
} ); } );
var ZoomOutCommand = kity.createClass( 'ZoomOutCommand', { var ZoomOutCommand = kity.createClass( 'ZoomOutCommand', {
base: Command, base: Command,
execute: function ( minder ) { execute: function ( minder ) {
if( !this.queryState( minder ) ) { if ( !this.queryState( minder ) ) {
zoom( minder, ZOOM_STEP ); zoom( minder, ZOOM_STEP );
} }
}, },
queryState: function ( minder ) { queryState: function ( minder ) {
return (minder._zoomValue < MAX_ZOOM) ? 0 : -1; return ( minder._zoomValue < 1 / MIN_ZOOM ) ? 0 : -1;
} }
} ); } );
...@@ -64,26 +64,30 @@ KityMinder.registerModule( 'Zoom', function () { ...@@ -64,26 +64,30 @@ KityMinder.registerModule( 'Zoom', function () {
events: { events: {
'normal.keydown':function(e){ 'normal.keydown': function ( e ) {
var me = this; var me = this;
var originEvent = e.originEvent; var originEvent = e.originEvent;
var keyCode = originEvent.keyCode || originEvent.which; var keyCode = originEvent.keyCode || originEvent.which;
if(keymap['='] == keyCode){ if ( keymap[ '=' ] == keyCode ) {
me.execCommand('zoom-in'); me.execCommand( 'zoom-in' );
} }
if(keymap['-'] == keyCode){ if ( keymap[ '-' ] == keyCode ) {
me.execCommand('zoom-out'); me.execCommand( 'zoom-out' );
} }
}, },
'ready': function () { 'ready': function () {
this._zoomValue = 1; this._zoomValue = 1;
}, },
// disable mouse wheel 'normal.mousewheel': function ( e ) {
'mousewheel_': function ( e ) { 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 ) {
delta = -delta;
}
// 稀释 // 稀释
if ( Math.abs( delta ) > 100 ) { if ( Math.abs( delta ) > 100 ) {
clearTimeout( this._wheelZoomTimeout ); clearTimeout( this._wheelZoomTimeout );
...@@ -95,9 +99,9 @@ KityMinder.registerModule( 'Zoom', function () { ...@@ -95,9 +99,9 @@ KityMinder.registerModule( 'Zoom', 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 );
......
...@@ -3,7 +3,7 @@ html, body, div { ...@@ -3,7 +3,7 @@ html, body, div {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
html, body, #kity-minder, div.kmui-editor-body { html, body, #kityminder, div.kmui-editor-body {
height: 100%; height: 100%;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment