Commit 944d01ff authored by techird's avatar techird

bug fixs

parent d3c45fb7
......@@ -3,11 +3,24 @@
## v1.3.0
### 体验优化
1. 当在空白处右键时,在菜单项中添加插入节点选项
### 功能更新
### BUG修复
1. 修复在空白节点有时会出现a字符的问题
1. 全新的 Ribbon 风格 UI 界面
2. 思维导图模板下,智能选择子节点的布局
3. 文本输入支持软回车(`Shift` + `Enter`)换行
4. 打开和保存文件到网盘支持目录选择和创建
5. 增加了逻辑结构图的模板
6. 增加视野导航控件的支持,并且支持 `Ctrl` + `方向键` 来导航视野
7. 分享的文件支持列出以及取消(登陆后)
8. 移动端分享页面的查看
9. 编辑过程支持自动保存(仅限已保存到网盘过的文件)
10. 点击超链接跳转前提示连接地址
11. 直接搜索节点(右上角搜索框或 `Ctrl` + `F`
12. 增加了「紧凑」系列的皮肤
### BUG 修复
1. 修复文字不能删空的 BUG
## v1.2.1
......@@ -72,6 +85,7 @@
## v1.1.3
### 功能更新
1. 保存时可自定义文件名
2. 添加/删除超链接,导入第三方格式支持超链接
3. 选中节点时,按F2直接进入文字编辑状态
......@@ -82,6 +96,7 @@
## 问题修复
1. 修复当滚动鼠标滚轮时,光标不跟着移动的问题
2. 优化了拖拽节点操作体验
3. 修复回退操作后所选节点未回选问题
......
......@@ -255,7 +255,8 @@
}
/* jshint browser:true */
var src = document.currentScript.src;
var script = document.currentScript || document.actualScript();
var src = script.src;
var pack = /pack=([\w-]+)(?:&|$)/.exec(src);
if (!pack) return;
pack = pack[1];
......
Subproject commit 041d47f13cbf19a60baee2a6640b06851e44761f
Subproject commit 27c52cd1549a85fc859e86098e87f4ec55db385d
snap.png

84.7 KB | W: | H:

snap.png

169 KB | W: | H:

snap.png
snap.png
snap.png
snap.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -96,9 +96,7 @@ kity.extendClass(Minder, {
if (cmd.isContentChanged()) {
this._firePharse(new MinderEvent('contentchange'));
}
if (cmd.isSelectionChanged()) {
this._firePharse(new MinderEvent('selectionchange'));
}
this._interactChange();
}
this._hasEnterExecCommand = false;
......@@ -106,10 +104,6 @@ kity.extendClass(Minder, {
result = cmd.execute.apply(cmd, [me].concat(cmdArgs));
if (!this._hasEnterExecCommand) {
if (cmd.isSelectionChanged()) {
this._firePharse(new MinderEvent('selectionchange'));
}
this._interactChange();
}
}
......
......@@ -116,24 +116,15 @@ kity.extendClass(Minder, {
if (this._fire(preEvent) ||
this._fire(executeEvent))
this._fire(new MinderEvent('after' + e.type, e, false));
if (~'mousedown mouseup keydown keyup'.indexOf(e.type)) {
this._interactChange(e);
}
},
_interactChange: function(e) {
var minder = this;
var trigger = function trigger() {
var stoped = minder._fire(new MinderEvent('beforeinteractchange'));
if (stoped) {
return;
}
minder._fire(new MinderEvent('preinteractchange'));
minder._fire(new MinderEvent('interactchange'));
};
this._interactTimeout = setTimeout(trigger, 100);
var me = this;
if (me._interactScheduled) return;
setTimeout(function() {
me._fire(new MinderEvent('interactchange'));
me._interactScheduled = false;
}, 100);
me._interactScheduled = true;
},
_listen: function(type, callback) {
var callbacks = this._eventCallbacks[type] || (this._eventCallbacks[type] = []);
......
......@@ -3,16 +3,43 @@ var Renderer = KityMinder.Renderer = kity.createClass('Renderer', {
this.node = node;
},
create: function() {
create: function(node) {
throw new Error('Not implement: Renderer.create()');
},
shouldRender: function() {
shouldRender: function(node) {
return true;
},
update: function() {
throw new Error('Not implement: Renderer.update()');
watchChange: function(data) {
var changed;
if (this.watchingData === undefined) {
changed = true;
} else if (this.watchingData != data) {
changed = true;
} else {
changed = false;
}
this.watchingData = data;
},
shouldDraw: function(node) {
return true;
},
update: function(shape, node, box) {
if (this.shouldDraw()) this.draw(shape, node);
return this.place(shape, node, box);
},
draw: function(shape, node) {
throw new Error('Not implement: Renderer.draw()');
},
place: function(shape, node, box) {
throw new Error('Not implement: Renderer.place()');
},
getRenderShape: function() {
......@@ -142,12 +169,7 @@ kity.extendClass(Minder, (function() {
node: node
});
node._contentBox = g.wrapBox({
left: 0,
right: 0,
top: 0,
bottom: 0
});
node._contentBox = new kity.Box();
node._renderers.forEach(function(renderer) {
......@@ -174,7 +196,7 @@ kity.extendClass(Minder, (function() {
// 合并渲染区域
if (latestBox) {
node._contentBox = g.mergeBox(node._contentBox, latestBox);
node._contentBox = node._contentBox.merge(latestBox);
}
}
......
......@@ -7,10 +7,14 @@ KityMinder.registerModule('basestylemodule', function() {
KityMinder.TextRenderer.registerStyleHook(function(node, textGroup) {
var fontWeight = getNodeDataOrStyle(node,'font-weight');
var fontStyle = getNodeDataOrStyle(node, 'font-style');
var styleHash = [fontWeight, fontStyle].join('/');
textGroup.eachItem(function(index,item){
item.setFont({
'weight': getNodeDataOrStyle(node,'font-weight'),
'style': getNodeDataOrStyle(node,'font-style')
'weight': fontWeight,
'style': fontStyle
});
});
......
......@@ -131,9 +131,9 @@ KityMinder.registerModule('TextEditModule', function() {
'inputready.keyup':function(e){
if(sel.isHide()){
var me = this;
setTimeout(function(){
inputStatusReady(me.getSelectedNode());
});
// setTimeout(function(){
// inputStatusReady(me.getSelectedNode());
// });
}
},
......@@ -149,9 +149,9 @@ KityMinder.registerModule('TextEditModule', function() {
!orgEvt.metaKey &&
!orgEvt.shiftKey &&
!orgEvt.altKey) {
setTimeout(function(){
inputStatusReady(node);
})
// setTimeout(function(){
// inputStatusReady(node);
// })
}
}
......
......@@ -286,10 +286,10 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
.setEndOffset(this.re.getTxtOfContainer().length)
.setColor( node.getStyle('text-selection-color'));
this.re
.updateByMinderNode(node)
.updateContainerRangeBySel();
var re = this.re;
setTimeout(function() {
re.updateByMinderNode(node).updateContainerRangeBySel();
});
if(browser.ie ){
var timer = setInterval(function(){
......
......@@ -109,7 +109,8 @@ Minder.Receiver = kity.createClass('Receiver', {
return utils.getValueByIndex(this.textData, index !== undefined ? index : this.index);
},
getBaseOffset: function() {
return this.textGroup.getRenderBox('screen');
var offset = this.textGroup.getRenderBox('screen');
return offset;
},
setContainerStyle: function() {
var textGroupBox = this.getBaseOffset();
......
......@@ -8,14 +8,23 @@ KityMinder.registerModule("fontmodule", function() {
var selectedColor = node.getStyle('selected-color');
var styleColor = node.getStyle('color');
textGroup.fill(dataColor || (node.isSelected() && selectedColor ? selectedColor : styleColor));
var foreColor = dataColor || (node.isSelected() && selectedColor ? selectedColor : styleColor);
var fontFamily = getNodeDataOrStyle(node, 'font-family');
var fontSize = getNodeDataOrStyle(node, 'font-size');
var fontHash = [fontFamily, fontSize].join('/');
if (foreColor.toString() != node.getTmpData('fore-color')) {
textGroup.fill(foreColor);
node.setTmpData('fore-color', foreColor.toString());
}
textGroup.eachItem(function(index,item){
item.setFont({
'family': getNodeDataOrStyle(node,'font-family'),
'size': getNodeDataOrStyle(node,'font-size')
'family': fontFamily,
'size': fontSize
});
});
node.setTmpData('font-hash', fontHash);
});
return {
......
......@@ -38,7 +38,7 @@ var OutlineRenderer = kity.createClass('OutlineRenderer', {
.stroke(node.getStyle(prefix + 'stroke' || node.getStyle('stroke')),
node.getStyle(prefix + 'stroke-width'));
return outlineBox;
return new kity.Box(outlineBox);
}
});
......
......@@ -123,12 +123,12 @@ KityMinder.registerModule('PriorityModule', function() {
icon.setTranslate(x, y);
return {
return new kity.Box({
x: x,
y: y,
width: icon.width,
height: icon.height
};
});
}
})
}
......
......@@ -124,12 +124,7 @@ KityMinder.registerModule('ProgressModule', function() {
y = -icon.height / 2;
icon.setTranslate(x + icon.width / 2, y + icon.height / 2);
return {
x: x,
y: y,
width: icon.width,
height: icon.height
};
return new kity.Box(x, y, icon.width, icon.height);
}
})
}
......
......@@ -253,12 +253,12 @@ KityMinder.registerModule('Resource', function() {
container.setTranslate(box.right, 0);
return {
return new kity.Box({
x: box.right,
y: Math.round(-overlays[0].height / 2),
width: x,
height: overlays[0].height
};
});
}
});
......
/* global Renderer: true */
var FONT_ADJUST = {
'微软雅黑,Microsoft YaHei': -0.15,
'arial black,avant garde': -0.17
};
var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
base: Renderer,
......@@ -18,10 +23,15 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
var lineHeight = node.getStyle('line-height');
var fontSize = s('font-size');
var fontFamily = node.getData('font-family');
var height = (lineHeight * fontSize) * textArr.length - (lineHeight - 1) * fontSize;
var yStart = -height / 2;
var adjust = FONT_ADJUST[fontFamily] || 0;
textGroup.setTranslate(0, adjust * fontSize);
var rBox = new kity.Box(),
r = Math.round;
......@@ -36,7 +46,7 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
} else {
if (text !== undefined && !textShape) {
textShape = new kity.Text()
.setVerticalAlign('top')
.setAttr('dominant-baseline', 'text-before-edge')
.setAttr('text-rendering', 'inherit');
textGroup.addItem(textShape);
}
......@@ -48,18 +58,18 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
}
this.setTextStyle(node, textGroup);
textGroup.eachItem(function(i, textShape) {
var y = yStart + i * fontSize * lineHeight;
return function() {
textGroup.eachItem(function(i, textShape) {
var y = yStart + i * fontSize * lineHeight;
textShape.setY(y);
textShape.setY(y);
rBox = rBox.merge(new kity.Box(0, y, textShape.getBoundaryBox().width, fontSize));
});
rBox = rBox.merge(new kity.Box(0, y, textShape.getBoundaryBox().width || 1, fontSize));
});
var nBox = new kity.Box(r(rBox.x), r(rBox.y), r(rBox.width), r(rBox.height));
var nBox = new kity.Box(r(rBox.x), r(rBox.y), r(rBox.width), r(rBox.height));
node._currentTextGroupBox = nBox;
return function() {
node._currentTextGroupBox = nBox;
return nBox;
};
......
......@@ -60,6 +60,7 @@ KityMinder.registerModule('Zoom', function() {
timeline = animator.start(minder, 300, 'easeInOutSine', function() {});
timeline.on('finish', function() {
minder.fire('viewchange');
minder.fire('zoom', { zoom: value });
});
}
......
......@@ -19,7 +19,7 @@ KityMinder.registerUI('contextmenu', function(minder) {
.appendTo('#content-wrapper');
$menu.delegate('li', 'click', function(e, info) {
var item = $(e.target).data('menu');
var item = $(e.target).closest('li').data('menu');
if (item.command) {
minder.execCommand(item.command);
}
......
......@@ -48,10 +48,9 @@ KityMinder.registerUI('nav', function(minder) {
.appendTo($pan)
.css('top', getHeight(100));
minder.on('interactchange', function() {
var zoom = minder.queryCommandValue('zoom');
minder.on('zoom', function(e) {
$indicator.animate({
'top': getHeight(zoom)
'top': getHeight(e.zoom)
}, 100);
});
......@@ -105,6 +104,8 @@ KityMinder.registerUI('nav', function(minder) {
minder.off('viewchange', updateVisibleView);
}
window.u = updateContentView;
function navigate() {
function moveView(center, duration) {
......@@ -184,6 +185,8 @@ KityMinder.registerUI('nav', function(minder) {
} else {
connectionThumb.setPathData(null);
}
updateVisibleView();
}
function updateVisibleView() {
......
......@@ -26,6 +26,7 @@ KityMinder.registerUI('ribbon/idea/resource', function(minder) {
var $resourceDrop = new FUI.DropPanel().appendTo($resourcePanel);
var $dropContainer = $($resourceDrop.getPanelElement());
var $ul = $('<ul></ul>').addClass('resource-list').appendTo($dropContainer);
var $list = [];
function addResource() {
var resource = $addInput.getValue();
......@@ -58,31 +59,38 @@ KityMinder.registerUI('ribbon/idea/resource', function(minder) {
function changed(resource, used) {
var currentHash = hash(resource, used);
if (currentHash == changed.lastHash) return true;
if (currentHash == changed.lastHash) return false;
changed.lastHash = currentHash;
return false;
return true;
}
function update() {
var resource = minder.queryCommandValue('resource');
var used = minder.getUsedResource();
if (!changed(resource, used)) return;
if (changed(resource, used)) return;
$ul.empty().append(used.map(function(name) {
var $li = $('<li></li>'),
$label = $('<label></label>').appendTo($li),
$chk = $('<input type="checkbox" />')
.data('resource', name)
.prop('checked', ~resource.indexOf(name))
.appendTo($label);
$label.append(name);
var delta = used.length - $ul.children().length;
while (delta--) $ul.append('<li><label><input type="checkbox" /><span></span></label></li>');
while (++delta) $ul.children().first().remove();
used.forEach(function(name, index) {
var $li = $ul.children().eq(index);
var $label = $li.find('label');
var $chk = $label.find('input');
var $span = $label.find('span');
$chk.data('resource', name);
$chk.prop('checked', ~resource.indexOf(name));
$span.text(name);
var color = minder.getResourceColor(name);
return $li.css({
$li.css({
color: color.dec('l', 60).toString(),
backgroundColor: ~resource.indexOf(name) ? color : color.dec('a', 0.85).toRGBA()
});
}));
});
switch (minder.queryCommandState('resource')) {
case 0:
......
......@@ -50,7 +50,7 @@ KityMinder.registerUI('topbar/search', function(minder) {
var startIndex = newSearch ? 0 : doSearch.lastIndex + 1 || 0;
var endIndex = startIndex + nodeSequence.length - 1;
for (var i = startIndex; i < endIndex; i++) {
for (var i = startIndex; i <= endIndex; i++) {
var node = nodeSequence[i % nodeSequence.length];
var text = node.getText();
if (text.indexOf(keyword) != -1) {
......@@ -61,8 +61,10 @@ KityMinder.registerUI('topbar/search', function(minder) {
}
function setSearchResult(node) {
minder.select(node, true);
minder.execCommand('camera', node, 50);
setTimeout(function() {
minder.select(node, true);
}, 60);
}
}
return $search;
......
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