Commit 85de68e6 authored by techird's avatar techird

merge from dev

parents 510a8dc0 a7073527
......@@ -15,7 +15,14 @@ KM是基于SVG技术实现,使用JavaScript+html实现。支持绝大多数的
4. IE9+
## 线上版本
[http://fex-team.baidu.com/kityminder/dist](http://fex-team.baidu.com/kityminder/dist)
[http://fex.baidu.com/kityminder/dist](http://fex.baidu.com/kityminder/dist)
注意:由于历史原因,有两个发布过的公开地址:
1. [~~http://fex-team.baidu.com/kityminder/dist~~](http://fex-team.baidu.com/kityminder/dist)
2. [~~http://kitygraph.github.io/kityminder/dist~~](http://kitygraph.github.io/kityminder/dist)
第一个地址已经失效,第二个地址不再维护更新,不便之处,请原谅。新地址已经稳定,请大家放心使用。
## 依赖说明
......
......@@ -23,7 +23,7 @@ $dependency = Array(
,'src/module/layout.default.js'
,'src/module/layout.bottom.js'
,'src/core/minder.select.js'
,'src/module/hand.js'
,'src/module/view.js'
,'src/module/dragtree.js'
,'src/module/dropfile.js'
,'src/module/keyboard.js'
......
#github-url{position:absolute;width:130px;height:130px;right:-90px;top:60px;background-color:#fff;border-radius:65px;box-shadow:-3px 1px 10px rgba(0,0,0,0.3);-webkit-transition:all .2s ease;-moz-transition:all .2s ease;-ms-transition:all .2s ease;transition:all .2s ease;opacity:.3}#github-url:hover{-webkit-transform:translate(-280px);-moz-transform:translate(-280px);-ms-transform:translate(-280px);transform:translate(-280px);opacity:1}
#github-url:before{content:' ';display:block;position:absolute;width:300px;height:130px;left:65px;top:0;background:rgba(0,0,0,0.001)}
#github-url:after{content:' ';display:block;position:absolute;width:130px;height:130px;background:url(../img/Github-Mark-120px-plus.png) no-repeat 5px 4px}
#github-url a{display:block;position:absolute;top:40px;font-size:18px;width:300px;height:40px;padding:10px 0 10px 20px;line-height:40px;color:#000;left:120px;border-radius:0 25px 25px 0;background-color:#fff}
@bg: #FFF;
#github-url {
position: absolute;
width: 130px;
height: 130px;
right: -90px;
top: 60px;
background-color: @bg;
border-radius: 65px;
box-shadow: -3px 1px 10px rgba(0,0,0,.3);
-webkit-transition: all .2s ease;
-moz-transition: all .2s ease;
-ms-transition: all .2s ease;
transition: all .2s ease;
opacity: .3;
&:hover {
-webkit-transform: translate(-280px);
-moz-transform: translate(-280px);
-ms-transform: translate(-280px);
transform: translate(-280px);
opacity: 1;
}
&:before {
content: ' ';
display: block;
position: absolute;
width: 300px;
height: 130px;
left: 65px;
top: 0;
background: rgba(0,0,0,0.001);
}
&:after {
content: ' ';
display: block;
position: absolute;
width: 130px;
height: 130px;
background: url(../img/Github-Mark-120px-plus.png) no-repeat 5px 4px;
}
a {
display: block;
position: absolute;
top: 40px;
font-size: 18px;
width: 300px;
height: 40px;
padding: 10px 0 10px 20px;
line-height: 40px;
color: black;
left: 120px;
border-radius: 0 25px 25px 0;
background-color: @bg;
}
}
\ No newline at end of file
......@@ -17,6 +17,8 @@
<link href="../themes/default/css/import.css" type="text/css" rel="stylesheet" />
<link href="../dialogs/dialogs.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/github.css" />
<script>
$(function () {
// create km instance
......@@ -27,6 +29,9 @@
<body>
<div id="kityminder" onselectstart="return false"></div>
<div id="github-url">
<a href="https://github.com/fex-team/kityminder.git" target="_blank">Fork me on Github</a>
</div>
</body>
</html>
\ No newline at end of file
......@@ -189,6 +189,7 @@ $( function () {
function newFile() {
thisMapFilename = null;
window.km.importData( '新建脑图', 'plain' );
window.km.execCommand( 'camera', window.km.getRoot() );
$user_btn.text( '<新建脑图>' );
}
......
......@@ -13,7 +13,7 @@ kity.extendClass( Minder, {
},
// TODO: mousemove lazy bind
_bindPaperEvents: function () {
this._paper.on( 'click dblclick mousedown contextmenu mouseup mousemove mousewheel touchstart touchmove touchend', this._firePharse.bind( this ) );
this._paper.on( 'click dblclick mousedown contextmenu mouseup mousemove mousewheel DOMMouseScroll touchstart touchmove touchend', this._firePharse.bind( this ) );
if ( window ) {
window.addEventListener( 'resize', this._firePharse.bind( this ) );
}
......@@ -27,6 +27,10 @@ kity.extendClass( Minder, {
_firePharse: function ( e ) {
var beforeEvent, preEvent, executeEvent;
if ( e.type == 'DOMMouseScroll' ) {
e.type = 'mousewheel';
e.wheelDelta = e.originEvent.wheelDelta = e.originEvent.detail * 120;
}
beforeEvent = new MinderEvent( 'before' + e.type, e, true );
if ( this._fire( beforeEvent ) ) {
......@@ -67,17 +71,17 @@ kity.extendClass( Minder, {
var callbacks = this._eventCallbacks[ e.type.toLowerCase() ] || [];
if(status){
if ( status ) {
callbacks = callbacks.concat(this._eventCallbacks[ status + '.' + e.type.toLowerCase() ] || []);
callbacks = callbacks.concat( this._eventCallbacks[ status + '.' + e.type.toLowerCase() ] || [] );
}
if(callbacks.length == 0){
if ( callbacks.length === 0 ) {
return;
}
var lastStatus = this.getStatus();
var lastStatus = this.getStatus();
for ( var i = 0; i < callbacks.length; i++ ) {
......@@ -92,18 +96,18 @@ kity.extendClass( Minder, {
},
on: function ( name, callback ) {
var km = this;
utils.each(name.split(/\s+/),function(i,n){
utils.each( name.split( /\s+/ ), function ( i, n ) {
km._listen( n.toLowerCase(), callback );
});
} );
return this;
},
off: function ( name, callback ) {
var types = name.split( /\s+/);
var types = name.split( /\s+/ );
var i, j, callbacks, removeIndex;
for ( i = 0; i < types.length; i++ ) {
callbacks = this._eventCallbacks[ types[ i ].toLowerCase() ];
callbacks = this._eventCallbacks[ types[ i ].toLowerCase() ];
if ( callbacks ) {
removeIndex = null;
for ( j = 0; j < callbacks.length; j++ ) {
......
......@@ -39,9 +39,9 @@ var ViewDragger = kity.createClass( "ViewDragger", {
me.setStatus( 'hand' );
}, 1 );
}
} );
} )
this._minder.on( 'hand.beforemousedown', function ( e ) {
.on( 'hand.beforemousedown', function ( e ) {
// 已经被用户打开拖放模式
if ( dragger.isEnabled() ) {
lastPosition = e.getPosition();
......@@ -75,7 +75,7 @@ var ViewDragger = kity.createClass( "ViewDragger", {
}
} );
KityMinder.registerModule( 'Hand', function () {
KityMinder.registerModule( 'View', function () {
var km = this;
......@@ -96,12 +96,24 @@ KityMinder.registerModule( 'Hand', function () {
}
} );
var CameraCommand = kity.createClass( "CameraCommand", {
base: Command,
execute: function ( km, focusNode ) {
var viewport = km.getPaper().getViewPort();
var offset = focusNode.getRenderContainer().getRenderBox( km.getRenderContainer() );
var dx = viewport.center.x - offset.x - offset.width / 2,
dy = viewport.center.y - offset.y;
km.getRenderContainer().fxTranslate( dx, dy, 1000, "easeOutQuint" );
}
} );
return {
init: function () {
this._viewDragger = new ViewDragger( this );
},
commands: {
'hand': ToggleHandCommand
'hand': ToggleHandCommand,
'camera': CameraCommand
},
events: {
keyup: function ( e ) {
......@@ -113,7 +125,7 @@ KityMinder.registerModule( 'Hand', function () {
mousewheel: function ( e ) {
var dx, dy;
e = e.originEvent;
if(e.ctrlKey || e.shiftKey) return;
if ( e.ctrlKey || e.shiftKey ) return;
if ( 'wheelDeltaX' in e ) {
......@@ -136,12 +148,7 @@ KityMinder.registerModule( 'Hand', function () {
},
'normal.dblclick': function ( e ) {
if ( e.getTargetNode() ) return;
var viewport = this.getPaper().getViewPort();
var offset = this.getRoot().getRenderContainer().getRenderBox( this.getRenderContainer() );
var dx = viewport.center.x - offset.x - offset.width / 2,
dy = viewport.center.y - offset.y;
this.getRenderContainer().fxTranslate( dx, dy, 1000, "easeOutQuint" );
this.execCommand( 'camera', this.getRoot() );
}
}
};
......
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