Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
944d01ff
Commit
944d01ff
authored
Sep 24, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixs
parent
d3c45fb7
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
151 additions
and
95 deletions
+151
-95
CHANGELOG.md
CHANGELOG.md
+19
-4
import.js
import.js
+2
-1
kity
lib/kity
+1
-1
snap.png
snap.png
+0
-0
command.js
src/core/command.js
+1
-7
event.js
src/core/event.js
+7
-16
render.js
src/core/render.js
+33
-11
basestyle.js
src/module/basestyle.js
+6
-2
editor.js
src/module/editor.js
+6
-6
editor.keyboard.js
src/module/editor.keyboard.js
+4
-4
editor.receiver.js
src/module/editor.receiver.js
+2
-1
font.js
src/module/font.js
+12
-3
outline.js
src/module/outline.js
+1
-1
priority.js
src/module/priority.js
+2
-2
progress.js
src/module/progress.js
+1
-6
resource.js
src/module/resource.js
+2
-2
text.js
src/module/text.js
+19
-9
zoom.js
src/module/zoom.js
+1
-0
contextmenu.js
ui/contextmenu.js
+1
-1
nav.js
ui/nav.js
+6
-3
resource.js
ui/ribbon/idea/resource.js
+21
-13
search.js
ui/topbar/search.js
+4
-2
No files found.
CHANGELOG.md
View file @
944d01ff
...
...
@@ -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.
修复回退操作后所选节点未回选问题
...
...
import.js
View file @
944d01ff
...
...
@@ -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
];
...
...
kity
@
27c52cd1
Subproject commit
041d47f13cbf19a60baee2a6640b06851e44761f
Subproject commit
27c52cd1549a85fc859e86098e87f4ec55db385d
snap.png
View replaced file @
d3c45fb7
View file @
944d01ff
84.7 KB
|
W:
|
H:
169 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/core/command.js
View file @
944d01ff
...
...
@@ -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
();
}
}
...
...
src/core/event.js
View file @
944d01ff
...
...
@@ -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
]
=
[]);
...
...
src/core/render.js
View file @
944d01ff
...
...
@@ -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
);
}
}
...
...
src/module/basestyle.js
View file @
944d01ff
...
...
@@ -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
});
});
...
...
src/module/editor.js
View file @
944d01ff
...
...
@@ -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);
//
})
}
}
...
...
src/module/editor.keyboard.js
View file @
944d01ff
...
...
@@ -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
(){
...
...
src/module/editor.receiver.js
View file @
944d01ff
...
...
@@ -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
();
...
...
src/module/font.js
View file @
944d01ff
...
...
@@ -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
{
...
...
src/module/outline.js
View file @
944d01ff
...
...
@@ -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
)
;
}
});
...
...
src/module/priority.js
View file @
944d01ff
...
...
@@ -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
};
}
)
;
}
})
}
...
...
src/module/progress.js
View file @
944d01ff
...
...
@@ -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
);
}
})
}
...
...
src/module/resource.js
View file @
944d01ff
...
...
@@ -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
};
}
)
;
}
});
...
...
src/module/text.js
View file @
944d01ff
/* 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
()
.
set
VerticalAlign
(
'top
'
)
.
set
Attr
(
'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
;
};
...
...
src/module/zoom.js
View file @
944d01ff
...
...
@@ -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
});
});
}
...
...
ui/contextmenu.js
View file @
944d01ff
...
...
@@ -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
);
}
...
...
ui/nav.js
View file @
944d01ff
...
...
@@ -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
()
{
...
...
ui/ribbon/idea/resource.js
View file @
944d01ff
...
...
@@ -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
tru
e
;
if
(
currentHash
==
changed
.
lastHash
)
return
fals
e
;
changed
.
lastHash
=
currentHash
;
return
fals
e
;
return
tru
e
;
}
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
:
...
...
ui/topbar/search.js
View file @
944d01ff
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment