Commit a3b39ce9 authored by campaign's avatar campaign

Merge remote-tracking branch 'origin/release-1.2.0' into release-1.2.0

parents 87e22a53 08f6a8dd
......@@ -40,7 +40,7 @@
<div id="kityminder" onselectstart="return false"></div>
<div id="share-dialog" >
<div id="share-dialog">
<h3>URL分享:</h3>
<p>
<input id="share-url" type="url" value="http://naotu.baidu.com/?shareId=kcev3dd" />
......
......@@ -35,8 +35,8 @@ KityMinder.LANG['zh-cn'] = {
'image': '插入图片',
'hyperlink': '插入链接',
'unhyperlink': '删除链接',
'expandnode': '展开节点',
'collapsenode': '收起节点',
'expandnode': '展开到叶子',
'collapsenode': '收起到一级节点',
'template': '模板',
'theme': '皮肤'
},
......
......@@ -38,6 +38,7 @@ var DropHinter = kity.createClass('DropHinter', {
target.getStyle('drop-hint-color') || 'yellow',
target.getStyle('drop-hint-width') || 2
);
this.bringTop();
}
}
});
......@@ -299,7 +300,12 @@ var TreeDragger = kity.createClass('TreeDragger', {
function area(box) {
return box.width * box.height;
}
return intersectBox && area(intersectBox) > 0.5 * Math.min(area(sourceBox), area(targetBox));
if (!intersectBox) return false;
// 面积判断
if (area(intersectBox) > 0.5 * Math.min(area(sourceBox), area(targetBox))) return true;
if (intersectBox.width + 1 >= Math.min(sourceBox.width, targetBox.width)) return true;
if (intersectBox.height + 1 >= Math.min(sourceBox.height, targetBox.height)) return true;
return false;
});
this._renderDropHint(this._dropSucceedTarget);
return !!this._dropSucceedTarget;
......@@ -320,7 +326,7 @@ var TreeDragger = kity.createClass('TreeDragger', {
_renderOrderHint: function(hint) {
this._orderHinter.render(hint);
},
preventDragMove:function(){
preventDragMove: function() {
this._startPosition = null;
}
});
......@@ -348,8 +354,8 @@ KityMinder.registerModule('DragTree', function() {
e.stopPropagation();
this.fire('contentchange');
},
'statuschange':function(e){
if(e.lastStatus == 'textedit' && e.currentStatus == 'normal'){
'statuschange': function(e) {
if (e.lastStatus == 'textedit' && e.currentStatus == 'normal') {
dragger.preventDragMove();
}
}
......
......@@ -117,8 +117,7 @@ KityMinder.registerModule('Expand', function() {
var ExpandNodeCommand = kity.createClass('ExpandNodeCommand', {
base: Command,
execute: function(km) {
var nodes = km.getSelectedNodes();
if (!nodes.length) nodes.push(km.getRoot());
var nodes = km.getRoot().getChildren();
nodes.forEach(function(node) {
node.expand(EXPAND_POLICY.DEEP_TO_LEAF);
});
......@@ -218,10 +217,6 @@ KityMinder.registerModule('Expand', function() {
}
});
return {
addShortcutKeys: {
'ExpandNode': 'ctrl+/', //expand
'CollapseNode': 'ctrl+.' //collapse
},
commands: {
'ExpandNode': ExpandNodeCommand,
'CollapseNode': CollapseNodeCommand
......@@ -241,6 +236,17 @@ KityMinder.registerModule('Expand', function() {
var visible = !node.parent || node.parent.isExpanded();
node.getRenderContainer().setVisible(visible);
if (!visible) e.stopPropagation();
},
'beforekeydown': function(e) {
if (e.originEvent.keyCode == keymap['/']) {
var expanded = this.getSelectedNode().isExpanded();
this.getSelectedNodes().forEach(function(node) {
if (expanded) node.collapse();
else node.expand();
});
e.preventDefault();
e.stopPropagationImmediately();
}
}
},
renderers: {
......
......@@ -183,8 +183,8 @@ KityMinder.registerModule("KeyboardModule", function() {
}
},
'normal.keyup':function(e){
if(browser.ipad){
'normal.keyup': function(e) {
if (browser.ipad) {
var keys = KityMinder.keymap;
var node = e.getTargetNode();
var lang = this.getLang();
......
......@@ -41,9 +41,7 @@ KityMinder.registerTheme('snow', {
'marquee-stroke': 'white',
'drop-hint-color': 'yellow',
'sub-drop-hint-width': 2,
'main-drop-hint-width': 4,
'root-drop-hint-width': 4,
'drop-hint-width': 4,
'order-hint-area-color': 'rgba(0, 255, 0, .5)',
'order-hint-path-color': '#0f0',
......
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