Commit 944d01ff authored by techird's avatar techird

bug fixs

parent d3c45fb7
...@@ -3,11 +3,24 @@ ...@@ -3,11 +3,24 @@
## v1.3.0 ## v1.3.0
### 体验优化 ### 功能更新
1. 当在空白处右键时,在菜单项中添加插入节点选项
### BUG修复 1. 全新的 Ribbon 风格 UI 界面
1. 修复在空白节点有时会出现a字符的问题 2. 思维导图模板下,智能选择子节点的布局
3. 文本输入支持软回车(`Shift` + `Enter`)换行
4. 打开和保存文件到网盘支持目录选择和创建
5. 增加了逻辑结构图的模板
6. 增加视野导航控件的支持,并且支持 `Ctrl` + `方向键` 来导航视野
7. 分享的文件支持列出以及取消(登陆后)
8. 移动端分享页面的查看
9. 编辑过程支持自动保存(仅限已保存到网盘过的文件)
10. 点击超链接跳转前提示连接地址
11. 直接搜索节点(右上角搜索框或 `Ctrl` + `F`
12. 增加了「紧凑」系列的皮肤
### BUG 修复
1. 修复文字不能删空的 BUG
## v1.2.1 ## v1.2.1
...@@ -72,6 +85,7 @@ ...@@ -72,6 +85,7 @@
## v1.1.3 ## v1.1.3
### 功能更新 ### 功能更新
1. 保存时可自定义文件名 1. 保存时可自定义文件名
2. 添加/删除超链接,导入第三方格式支持超链接 2. 添加/删除超链接,导入第三方格式支持超链接
3. 选中节点时,按F2直接进入文字编辑状态 3. 选中节点时,按F2直接进入文字编辑状态
...@@ -82,6 +96,7 @@ ...@@ -82,6 +96,7 @@
## 问题修复 ## 问题修复
1. 修复当滚动鼠标滚轮时,光标不跟着移动的问题 1. 修复当滚动鼠标滚轮时,光标不跟着移动的问题
2. 优化了拖拽节点操作体验 2. 优化了拖拽节点操作体验
3. 修复回退操作后所选节点未回选问题 3. 修复回退操作后所选节点未回选问题
......
...@@ -255,7 +255,8 @@ ...@@ -255,7 +255,8 @@
} }
/* jshint browser:true */ /* jshint browser:true */
var src = document.currentScript.src; var script = document.currentScript || document.actualScript();
var src = script.src;
var pack = /pack=([\w-]+)(?:&|$)/.exec(src); var pack = /pack=([\w-]+)(?:&|$)/.exec(src);
if (!pack) return; if (!pack) return;
pack = pack[1]; 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, { ...@@ -96,9 +96,7 @@ kity.extendClass(Minder, {
if (cmd.isContentChanged()) { if (cmd.isContentChanged()) {
this._firePharse(new MinderEvent('contentchange')); this._firePharse(new MinderEvent('contentchange'));
} }
if (cmd.isSelectionChanged()) {
this._firePharse(new MinderEvent('selectionchange'));
}
this._interactChange(); this._interactChange();
} }
this._hasEnterExecCommand = false; this._hasEnterExecCommand = false;
...@@ -106,10 +104,6 @@ kity.extendClass(Minder, { ...@@ -106,10 +104,6 @@ kity.extendClass(Minder, {
result = cmd.execute.apply(cmd, [me].concat(cmdArgs)); result = cmd.execute.apply(cmd, [me].concat(cmdArgs));
if (!this._hasEnterExecCommand) { if (!this._hasEnterExecCommand) {
if (cmd.isSelectionChanged()) {
this._firePharse(new MinderEvent('selectionchange'));
}
this._interactChange(); this._interactChange();
} }
} }
......
...@@ -116,24 +116,15 @@ kity.extendClass(Minder, { ...@@ -116,24 +116,15 @@ kity.extendClass(Minder, {
if (this._fire(preEvent) || if (this._fire(preEvent) ||
this._fire(executeEvent)) this._fire(executeEvent))
this._fire(new MinderEvent('after' + e.type, e, false)); this._fire(new MinderEvent('after' + e.type, e, false));
if (~'mousedown mouseup keydown keyup'.indexOf(e.type)) {
this._interactChange(e);
}
}, },
_interactChange: function(e) { _interactChange: function(e) {
var minder = this; var me = this;
if (me._interactScheduled) return;
var trigger = function trigger() { setTimeout(function() {
var stoped = minder._fire(new MinderEvent('beforeinteractchange')); me._fire(new MinderEvent('interactchange'));
if (stoped) { me._interactScheduled = false;
return; }, 100);
} me._interactScheduled = true;
minder._fire(new MinderEvent('preinteractchange'));
minder._fire(new MinderEvent('interactchange'));
};
this._interactTimeout = setTimeout(trigger, 100);
}, },
_listen: function(type, callback) { _listen: function(type, callback) {
var callbacks = this._eventCallbacks[type] || (this._eventCallbacks[type] = []); var callbacks = this._eventCallbacks[type] || (this._eventCallbacks[type] = []);
......
...@@ -3,16 +3,43 @@ var Renderer = KityMinder.Renderer = kity.createClass('Renderer', { ...@@ -3,16 +3,43 @@ var Renderer = KityMinder.Renderer = kity.createClass('Renderer', {
this.node = node; this.node = node;
}, },
create: function() { create: function(node) {
throw new Error('Not implement: Renderer.create()'); throw new Error('Not implement: Renderer.create()');
}, },
shouldRender: function() { shouldRender: function(node) {
return true; return true;
}, },
update: function() { watchChange: function(data) {
throw new Error('Not implement: Renderer.update()'); 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() { getRenderShape: function() {
...@@ -142,12 +169,7 @@ kity.extendClass(Minder, (function() { ...@@ -142,12 +169,7 @@ kity.extendClass(Minder, (function() {
node: node node: node
}); });
node._contentBox = g.wrapBox({ node._contentBox = new kity.Box();
left: 0,
right: 0,
top: 0,
bottom: 0
});
node._renderers.forEach(function(renderer) { node._renderers.forEach(function(renderer) {
...@@ -174,7 +196,7 @@ kity.extendClass(Minder, (function() { ...@@ -174,7 +196,7 @@ kity.extendClass(Minder, (function() {
// 合并渲染区域 // 合并渲染区域
if (latestBox) { if (latestBox) {
node._contentBox = g.mergeBox(node._contentBox, latestBox); node._contentBox = node._contentBox.merge(latestBox);
} }
} }
......
...@@ -7,10 +7,14 @@ KityMinder.registerModule('basestylemodule', function() { ...@@ -7,10 +7,14 @@ KityMinder.registerModule('basestylemodule', function() {
KityMinder.TextRenderer.registerStyleHook(function(node, textGroup) { 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){ textGroup.eachItem(function(index,item){
item.setFont({ item.setFont({
'weight': getNodeDataOrStyle(node,'font-weight'), 'weight': fontWeight,
'style': getNodeDataOrStyle(node,'font-style') 'style': fontStyle
}); });
}); });
......
...@@ -131,9 +131,9 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -131,9 +131,9 @@ KityMinder.registerModule('TextEditModule', function() {
'inputready.keyup':function(e){ 'inputready.keyup':function(e){
if(sel.isHide()){ if(sel.isHide()){
var me = this; var me = this;
setTimeout(function(){ // setTimeout(function(){
inputStatusReady(me.getSelectedNode()); // inputStatusReady(me.getSelectedNode());
}); // });
} }
}, },
...@@ -149,9 +149,9 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -149,9 +149,9 @@ KityMinder.registerModule('TextEditModule', function() {
!orgEvt.metaKey && !orgEvt.metaKey &&
!orgEvt.shiftKey && !orgEvt.shiftKey &&
!orgEvt.altKey) { !orgEvt.altKey) {
setTimeout(function(){ // setTimeout(function(){
inputStatusReady(node); // inputStatusReady(node);
}) // })
} }
} }
......
...@@ -286,10 +286,10 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){ ...@@ -286,10 +286,10 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
.setEndOffset(this.re.getTxtOfContainer().length) .setEndOffset(this.re.getTxtOfContainer().length)
.setColor( node.getStyle('text-selection-color')); .setColor( node.getStyle('text-selection-color'));
var re = this.re;
this.re setTimeout(function() {
.updateByMinderNode(node) re.updateByMinderNode(node).updateContainerRangeBySel();
.updateContainerRangeBySel(); });
if(browser.ie ){ if(browser.ie ){
var timer = setInterval(function(){ var timer = setInterval(function(){
......
...@@ -109,7 +109,8 @@ Minder.Receiver = kity.createClass('Receiver', { ...@@ -109,7 +109,8 @@ Minder.Receiver = kity.createClass('Receiver', {
return utils.getValueByIndex(this.textData, index !== undefined ? index : this.index); return utils.getValueByIndex(this.textData, index !== undefined ? index : this.index);
}, },
getBaseOffset: function() { getBaseOffset: function() {
return this.textGroup.getRenderBox('screen'); var offset = this.textGroup.getRenderBox('screen');
return offset;
}, },
setContainerStyle: function() { setContainerStyle: function() {
var textGroupBox = this.getBaseOffset(); var textGroupBox = this.getBaseOffset();
......
...@@ -8,14 +8,23 @@ KityMinder.registerModule("fontmodule", function() { ...@@ -8,14 +8,23 @@ KityMinder.registerModule("fontmodule", function() {
var selectedColor = node.getStyle('selected-color'); var selectedColor = node.getStyle('selected-color');
var styleColor = node.getStyle('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){ textGroup.eachItem(function(index,item){
item.setFont({ item.setFont({
'family': getNodeDataOrStyle(node,'font-family'), 'family': fontFamily,
'size': getNodeDataOrStyle(node,'font-size') 'size': fontSize
}); });
}); });
node.setTmpData('font-hash', fontHash);
}); });
return { return {
......
...@@ -38,7 +38,7 @@ var OutlineRenderer = kity.createClass('OutlineRenderer', { ...@@ -38,7 +38,7 @@ var OutlineRenderer = kity.createClass('OutlineRenderer', {
.stroke(node.getStyle(prefix + 'stroke' || node.getStyle('stroke')), .stroke(node.getStyle(prefix + 'stroke' || node.getStyle('stroke')),
node.getStyle(prefix + 'stroke-width')); node.getStyle(prefix + 'stroke-width'));
return outlineBox; return new kity.Box(outlineBox);
} }
}); });
......
...@@ -123,12 +123,12 @@ KityMinder.registerModule('PriorityModule', function() { ...@@ -123,12 +123,12 @@ KityMinder.registerModule('PriorityModule', function() {
icon.setTranslate(x, y); icon.setTranslate(x, y);
return { return new kity.Box({
x: x, x: x,
y: y, y: y,
width: icon.width, width: icon.width,
height: icon.height height: icon.height
}; });
} }
}) })
} }
......
...@@ -124,12 +124,7 @@ KityMinder.registerModule('ProgressModule', function() { ...@@ -124,12 +124,7 @@ KityMinder.registerModule('ProgressModule', function() {
y = -icon.height / 2; y = -icon.height / 2;
icon.setTranslate(x + icon.width / 2, y + icon.height / 2); icon.setTranslate(x + icon.width / 2, y + icon.height / 2);
return { return new kity.Box(x, y, icon.width, icon.height);
x: x,
y: y,
width: icon.width,
height: icon.height
};
} }
}) })
} }
......
...@@ -253,12 +253,12 @@ KityMinder.registerModule('Resource', function() { ...@@ -253,12 +253,12 @@ KityMinder.registerModule('Resource', function() {
container.setTranslate(box.right, 0); container.setTranslate(box.right, 0);
return { return new kity.Box({
x: box.right, x: box.right,
y: Math.round(-overlays[0].height / 2), y: Math.round(-overlays[0].height / 2),
width: x, width: x,
height: overlays[0].height height: overlays[0].height
}; });
} }
}); });
......
/* global Renderer: true */ /* global Renderer: true */
var FONT_ADJUST = {
'微软雅黑,Microsoft YaHei': -0.15,
'arial black,avant garde': -0.17
};
var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', { var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
base: Renderer, base: Renderer,
...@@ -18,10 +23,15 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', { ...@@ -18,10 +23,15 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
var lineHeight = node.getStyle('line-height'); var lineHeight = node.getStyle('line-height');
var fontSize = s('font-size'); var fontSize = s('font-size');
var fontFamily = node.getData('font-family');
var height = (lineHeight * fontSize) * textArr.length - (lineHeight - 1) * fontSize; var height = (lineHeight * fontSize) * textArr.length - (lineHeight - 1) * fontSize;
var yStart = -height / 2; var yStart = -height / 2;
var adjust = FONT_ADJUST[fontFamily] || 0;
textGroup.setTranslate(0, adjust * fontSize);
var rBox = new kity.Box(), var rBox = new kity.Box(),
r = Math.round; r = Math.round;
...@@ -36,7 +46,7 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', { ...@@ -36,7 +46,7 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
} else { } else {
if (text !== undefined && !textShape) { if (text !== undefined && !textShape) {
textShape = new kity.Text() textShape = new kity.Text()
.setVerticalAlign('top') .setAttr('dominant-baseline', 'text-before-edge')
.setAttr('text-rendering', 'inherit'); .setAttr('text-rendering', 'inherit');
textGroup.addItem(textShape); textGroup.addItem(textShape);
} }
...@@ -48,18 +58,18 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', { ...@@ -48,18 +58,18 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
} }
this.setTextStyle(node, textGroup); this.setTextStyle(node, textGroup);
textGroup.eachItem(function(i, textShape) { return function() {
var y = yStart + i * fontSize * lineHeight; 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; node._currentTextGroupBox = nBox;
return function() {
return nBox; return nBox;
}; };
......
...@@ -60,6 +60,7 @@ KityMinder.registerModule('Zoom', function() { ...@@ -60,6 +60,7 @@ KityMinder.registerModule('Zoom', function() {
timeline = animator.start(minder, 300, 'easeInOutSine', function() {}); timeline = animator.start(minder, 300, 'easeInOutSine', function() {});
timeline.on('finish', function() { timeline.on('finish', function() {
minder.fire('viewchange'); minder.fire('viewchange');
minder.fire('zoom', { zoom: value });
}); });
} }
......
...@@ -19,7 +19,7 @@ KityMinder.registerUI('contextmenu', function(minder) { ...@@ -19,7 +19,7 @@ KityMinder.registerUI('contextmenu', function(minder) {
.appendTo('#content-wrapper'); .appendTo('#content-wrapper');
$menu.delegate('li', 'click', function(e, info) { $menu.delegate('li', 'click', function(e, info) {
var item = $(e.target).data('menu'); var item = $(e.target).closest('li').data('menu');
if (item.command) { if (item.command) {
minder.execCommand(item.command); minder.execCommand(item.command);
} }
......
...@@ -48,10 +48,9 @@ KityMinder.registerUI('nav', function(minder) { ...@@ -48,10 +48,9 @@ KityMinder.registerUI('nav', function(minder) {
.appendTo($pan) .appendTo($pan)
.css('top', getHeight(100)); .css('top', getHeight(100));
minder.on('interactchange', function() { minder.on('zoom', function(e) {
var zoom = minder.queryCommandValue('zoom');
$indicator.animate({ $indicator.animate({
'top': getHeight(zoom) 'top': getHeight(e.zoom)
}, 100); }, 100);
}); });
...@@ -105,6 +104,8 @@ KityMinder.registerUI('nav', function(minder) { ...@@ -105,6 +104,8 @@ KityMinder.registerUI('nav', function(minder) {
minder.off('viewchange', updateVisibleView); minder.off('viewchange', updateVisibleView);
} }
window.u = updateContentView;
function navigate() { function navigate() {
function moveView(center, duration) { function moveView(center, duration) {
...@@ -184,6 +185,8 @@ KityMinder.registerUI('nav', function(minder) { ...@@ -184,6 +185,8 @@ KityMinder.registerUI('nav', function(minder) {
} else { } else {
connectionThumb.setPathData(null); connectionThumb.setPathData(null);
} }
updateVisibleView();
} }
function updateVisibleView() { function updateVisibleView() {
......
...@@ -26,6 +26,7 @@ KityMinder.registerUI('ribbon/idea/resource', function(minder) { ...@@ -26,6 +26,7 @@ KityMinder.registerUI('ribbon/idea/resource', function(minder) {
var $resourceDrop = new FUI.DropPanel().appendTo($resourcePanel); var $resourceDrop = new FUI.DropPanel().appendTo($resourcePanel);
var $dropContainer = $($resourceDrop.getPanelElement()); var $dropContainer = $($resourceDrop.getPanelElement());
var $ul = $('<ul></ul>').addClass('resource-list').appendTo($dropContainer); var $ul = $('<ul></ul>').addClass('resource-list').appendTo($dropContainer);
var $list = [];
function addResource() { function addResource() {
var resource = $addInput.getValue(); var resource = $addInput.getValue();
...@@ -58,31 +59,38 @@ KityMinder.registerUI('ribbon/idea/resource', function(minder) { ...@@ -58,31 +59,38 @@ KityMinder.registerUI('ribbon/idea/resource', function(minder) {
function changed(resource, used) { function changed(resource, used) {
var currentHash = hash(resource, used); var currentHash = hash(resource, used);
if (currentHash == changed.lastHash) return true; if (currentHash == changed.lastHash) return false;
changed.lastHash = currentHash; changed.lastHash = currentHash;
return false; return true;
} }
function update() { function update() {
var resource = minder.queryCommandValue('resource'); var resource = minder.queryCommandValue('resource');
var used = minder.getUsedResource(); var used = minder.getUsedResource();
if (!changed(resource, used)) return; if (changed(resource, used)) return;
$ul.empty().append(used.map(function(name) { var delta = used.length - $ul.children().length;
var $li = $('<li></li>'), while (delta--) $ul.append('<li><label><input type="checkbox" /><span></span></label></li>');
$label = $('<label></label>').appendTo($li), while (++delta) $ul.children().first().remove();
$chk = $('<input type="checkbox" />')
.data('resource', name) used.forEach(function(name, index) {
.prop('checked', ~resource.indexOf(name)) var $li = $ul.children().eq(index);
.appendTo($label); var $label = $li.find('label');
$label.append(name); 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); var color = minder.getResourceColor(name);
return $li.css({
$li.css({
color: color.dec('l', 60).toString(), color: color.dec('l', 60).toString(),
backgroundColor: ~resource.indexOf(name) ? color : color.dec('a', 0.85).toRGBA() backgroundColor: ~resource.indexOf(name) ? color : color.dec('a', 0.85).toRGBA()
}); });
})); });
switch (minder.queryCommandState('resource')) { switch (minder.queryCommandState('resource')) {
case 0: case 0:
......
...@@ -50,7 +50,7 @@ KityMinder.registerUI('topbar/search', function(minder) { ...@@ -50,7 +50,7 @@ KityMinder.registerUI('topbar/search', function(minder) {
var startIndex = newSearch ? 0 : doSearch.lastIndex + 1 || 0; var startIndex = newSearch ? 0 : doSearch.lastIndex + 1 || 0;
var endIndex = startIndex + nodeSequence.length - 1; 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 node = nodeSequence[i % nodeSequence.length];
var text = node.getText(); var text = node.getText();
if (text.indexOf(keyword) != -1) { if (text.indexOf(keyword) != -1) {
...@@ -61,8 +61,10 @@ KityMinder.registerUI('topbar/search', function(minder) { ...@@ -61,8 +61,10 @@ KityMinder.registerUI('topbar/search', function(minder) {
} }
function setSearchResult(node) { function setSearchResult(node) {
minder.select(node, true);
minder.execCommand('camera', node, 50); minder.execCommand('camera', node, 50);
setTimeout(function() {
minder.select(node, true);
}, 60);
} }
} }
return $search; 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