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