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
e90c76ea
Commit
e90c76ea
authored
Jul 01, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.2.0 preview
parent
7acf1d8b
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
257 additions
and
131 deletions
+257
-131
hyperlink.js
dialogs/hyperlink/hyperlink.js
+1
-1
image.js
dialogs/image/image.js
+1
-1
social.js
dist/social/social.js
+0
-1
kity
kity
+1
-1
draftmanager.js
social/draftmanager.js
+0
-1
social.css
social/social.css
+19
-11
social.js
social/social.js
+25
-11
social.less
social/social.less
+99
-22
saveto.js
src/adapter/saveto.js
+1
-1
minder.event.js
src/core/minder.event.js
+66
-64
view.js
src/module/view.js
+38
-12
dialog.css
themes/default/css/dialog.css
+2
-2
dropmenu.css
themes/default/css/dropmenu.css
+1
-1
kityminder.css
themes/default/css/kityminder.css
+3
-2
kmcat.png
themes/default/images/kmcat.png
+0
-0
No files found.
dialogs/hyperlink/hyperlink.js
View file @
e90c76ea
...
...
@@ -3,7 +3,7 @@
var
content
=
'<div class="hyperlink-content" style="padding:20px;width:360px;">'
;
content
+=
'<style>'
;
content
+=
'.kmui-dialog-<%= container %> input{'
;
content
+=
'width: 7
5
%;'
;
content
+=
'width: 7
4
%;'
;
content
+=
'padding: 6px 12px;'
;
content
+=
'font-size: 14px;'
;
content
+=
'line-height: 1.42857143;'
;
...
...
dialogs/image/image.js
View file @
e90c76ea
...
...
@@ -2,7 +2,7 @@
var
content
=
'<div class="image-content" style="padding:20px;width:360px;">'
;
content
+=
'<style>'
;
content
+=
'.kmui-dialog-<%= container %> input{'
;
content
+=
'width: 7
5
%;'
;
content
+=
'width: 7
4
%;'
;
content
+=
'padding: 6px 12px;'
;
content
+=
'font-size: 14px;'
;
content
+=
'line-height: 1.42857143;'
;
...
...
dist/social/social.js
View file @
e90c76ea
...
...
@@ -100,7 +100,6 @@ $( function () {
bindShortCuts
();
bindDraft
();
if
(
draftManager
)
watchChanges
();
if
(
draftManager
&&
!
loadPath
()
&&
!
isShareLink
)
loadDraft
(
0
);
}
// 创建 UI
...
...
kity
@
5a3fc442
Subproject commit
17b221165e51ee1f69358d4d5bacfe4fe4c7d22c
Subproject commit
5a3fc4422c0d3f1c2d812dd810d8ae7693fa3c93
social/draftmanager.js
View file @
e90c76ea
...
...
@@ -38,7 +38,6 @@ function DraftManager( minder ) {
function
load
()
{
if
(
current
)
{
minder
.
importData
(
current
.
data
,
'json'
);
minder
.
execCommand
(
'camera'
);
}
return
current
;
}
...
...
social/social.css
View file @
e90c76ea
This diff is collapsed.
Click to expand it.
social/social.js
View file @
e90c76ea
...
...
@@ -52,7 +52,7 @@ $.extend($.fn, {
$
(
function
()
{
// UI 元素
var
$panel
,
$title
,
$menu
,
$user
,
$share_btn
,
$save_btn
,
$file_btn
,
$file_menu
,
$login_btn
,
$user_btn
,
$logout_btn
,
var
$panel
,
$title
,
$menu
,
$user
,
$share_btn
,
$save_btn
,
$file_btn
,
$
tool_btn
,
$
file_menu
,
$login_btn
,
$user_btn
,
$logout_btn
,
$draft_btn
,
$draft_menu
,
$share_dialog
,
$share_url
,
$copy_url_btn
,
// 当前文件的远端路径
...
...
@@ -100,6 +100,7 @@ $(function() {
bindShortCuts
();
bindDraft
();
if
(
draftManager
)
watchChanges
();
if
(
draftManager
&&
!
loadPath
()
&&
!
isShareLink
)
loadDraft
(
0
);
}
// 创建 UI
...
...
@@ -111,6 +112,19 @@ $(function() {
$title
=
$
(
'<h2>百度脑图</h2>'
).
appendTo
(
$panel
);
$file_btn
=
$
(
'<button>文件</button>'
).
addClass
(
'file-button'
).
appendTo
(
$menu
);
$tool_btn
=
$
(
'<button>工具箱</button>'
).
addClass
(
'tool-button'
).
appendTo
(
$menu
);
$tool_btn
.
click
(
function
()
{
var
hide
=
!
localStorage
.
hide_toolbar
;
$
(
'#kityminder div.kmui-btn-toolbar'
).
css
(
'display'
,
hide
?
'none'
:
'block'
);
if
(
hide
)
{
$tool_btn
.
removeClass
(
'selected'
);
localStorage
.
hide_toolbar
=
true
;
}
else
{
$tool_btn
.
addClass
(
'selected'
);
delete
localStorage
.
hide_toolbar
;
}
}).
click
().
click
();
$file_menu
=
$
.
kmuidropmenu
({
data
:
[{
...
...
@@ -124,7 +138,10 @@ $(function() {
id
:
'share-button'
},
{
divider
:
true
,
id
:
'cloud-divider'
},
{
label
:
'登陆到网盘...'
,
click
:
login
,
id
:
'net-hint-buttom'
},
{
label
:
'保存到百度云 (Ctrl + S)'
,
click
:
save
,
...
...
@@ -583,7 +600,7 @@ $(function() {
draftManager
.
sync
();
}
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
());
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
()
,
300
);
$title
.
loading
(
false
).
text
(
getFileName
(
remotePath
));
watchingChanges
=
true
;
...
...
@@ -638,7 +655,7 @@ $(function() {
setRemotePath
(
null
,
true
);
draftManager
.
create
();
minder
.
importData
(
'新建脑图'
,
'plain'
);
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
());
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
()
,
300
);
}
function
generateRemotePath
()
{
...
...
@@ -810,8 +827,8 @@ $(function() {
draft
=
list
.
shift
();
$draft_menu
.
append
(
'<li disabled="disabled" class="current-draft kmui-combobox-item kmui-combobox-item-disabled kmui-combobox-checked">'
+
'<span class="kmui-combobox-icon"></span>'
+
'<label class="kmui-combobox-item-label">'
+
draft
.
name
+
'<span class="update-time">'
+
getFriendlyTimeSpan
(
+
new
Date
(
draft
.
update
),
+
new
Date
())
+
'</span>'
+
'<label class="kmui-combobox-item-label">'
+
'<span class="update-time">'
+
getFriendlyTimeSpan
(
+
new
Date
(
draft
.
update
),
+
new
Date
())
+
'</span>'
+
draft
.
name
+
'</label>'
+
'</li>'
);
$draft_menu
.
append
(
'<li class="kmui-divider"></li>'
);
...
...
@@ -823,7 +840,7 @@ $(function() {
while
(
list
.
length
)
{
draft
=
list
.
shift
();
$draft
=
$
(
'<li class="draft-item">'
+
'<a href="#">'
+
draft
.
name
+
'<span class="update-time">'
+
getFriendlyTimeSpan
(
+
new
Date
(
draft
.
update
),
+
new
Date
())
+
'</span>
</a><a class="delete" title="删除该草稿"></a></li>'
);
'<a href="#">'
+
'<span class="update-time">'
+
getFriendlyTimeSpan
(
+
new
Date
(
draft
.
update
),
+
new
Date
())
+
'</span>'
+
draft
.
name
+
'
</a><a class="delete" title="删除该草稿"></a></li>'
);
$draft
.
data
(
'draft-index'
,
index
++
);
$draft
.
appendTo
(
$draft_menu
);
}
...
...
@@ -873,10 +890,6 @@ $(function() {
function
loadDraft
(
index
)
{
var
draft
=
draftManager
.
open
(
index
),
isRemote
;
if
(
!
draft
)
{
minder
.
initStyle
();
return
;
}
isRemote
=
draft
.
path
.
indexOf
(
'/apps/kityminder'
)
===
0
;
if
(
isRemote
)
{
...
...
@@ -888,6 +901,7 @@ $(function() {
if
(
!
isRemote
)
{
setRemotePath
(
null
,
false
);
}
minder
.
execCommand
(
'camera'
,
null
,
300
);
}
function
getFriendlyTimeSpan
(
t1_in_ms
,
t2_in_ms
)
{
...
...
social/social.less
View file @
e90c76ea
#social {
position: absolute;
height:
3
0px;
height:
4
0px;
left: 0;
right: 0;
top: 0;
line-height:
3
0px;
overflow:
hidden
;
line-height:
4
0px;
overflow:
visible
;
background: #fafafa;
border-bottom: 1px solid #fff;
box-shadow: inset 0 -1px #f0f0f0;
z-index: 1000;
z-index: 999999;
padding-left: 5px;
border-bottom: 1px solid #f0f0f0;
background: #fafafa url(../themes/default/images/kmcat.png) no-repeat 180px 15px;
h2 {
margin: 0
200px
;
margin: 0;
padding: 0;
color: #999;
text-shadow: 0 1px white;
...
...
@@ -55,6 +56,33 @@
}
}
}
.tool-button {
vertical-align: bottom;
border: 1px solid transparent;
height: 31px;
z-index: 999999;
position: relative;
top: 1px;
color: #333;
border-radius: 4px 4px 0 0;
&:hover {
background: rgba(255,255,255, .8);
border-color: #f0f0f0 #f0f0f0 white #f0f0f0;
}
&:active, .active {
background: none;
color: black;
}
&.selected {
background: white;
border-color: #f0f0f0 #f0f0f0 white #f0f0f0;
}
}
}
.niceblue {
...
...
@@ -71,6 +99,47 @@
}
}
.ribbon {
background: #4584c2; /* Old browsers */
background: -moz-linear-gradient(top, #4584c2 0%, #295caa 50%, #194188 51%, #4168ce 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4584c2), color-stop(50%,#295caa), color-stop(51%,#194188), color-stop(100%,#4168ce)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #4584c2 0%,#295caa 50%,#194188 51%,#4168ce 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #4584c2 0%,#295caa 50%,#194188 51%,#4168ce 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #4584c2 0%,#295caa 50%,#194188 51%,#4168ce 100%); /* IE10+ */
background: linear-gradient(to bottom, #4584c2 0%,#295caa 50%,#194188 51%,#4168ce 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4584c2', endColorstr='#4168ce',GradientType=0 ); /* IE6-9 */
box-shadow: inset 0 1px 0 rgb(125,172,215);
border: 1px solid rgb(65,106,189);
color: white;
&:hover, &.hover {
background: #598fc1; /* Old browsers */
background: -moz-linear-gradient(top, #598fc1 0%, #3764a8 50%, #194188 51%, #5577cc 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#598fc1), color-stop(50%,#3764a8), color-stop(51%,#194188), color-stop(100%,#5577cc)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #598fc1 0%,#3764a8 50%,#194188 51%,#5577cc 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #598fc1 0%,#3764a8 50%,#194188 51%,#5577cc 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #598fc1 0%,#3764a8 50%,#194188 51%,#5577cc 100%); /* IE10+ */
background: linear-gradient(to bottom, #598fc1 0%,#3764a8 50%,#194188 51%,#5577cc 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#598fc1', endColorstr='#5577cc',GradientType=0 ); /* IE6-9 */
}
padding-right: 28px;
position: relative;
&:after {
content: ' ';
display: block;
position: absolute;
right: 10px;
top: 12px;
width: 0;
height: 0;
border: solid;
border-width: 4px 5px;
border-color: #fff transparent transparent transparent;
}
}
.dropdown {
padding-right: 28px;
position: relative;
...
...
@@ -93,6 +162,19 @@
}
}
.kmui-modal button {
.niceblue;
&:hover, &.hover {
background: #009fff;
}
&:active, &.active {
background: darken(#009fff, 10%);
box-shadow: inset 0 2px 3px rgba(0,0,0, .2);
}
}
button {
font-family: Arial, "Heiti SC", "Microsoft Yahei";
outline: none;
...
...
@@ -110,9 +192,6 @@ button {
background: none;
border-radius: 2px;
&:hover, &.hover {
}
&:active, &.active {
box-shadow: inset 0 1px 3px rgba(0,0,0,.2);
background: #ccc;
...
...
@@ -145,17 +224,13 @@ button {
}
&.file-button {
.dropdown;
.
niceblue
;
.
ribbon
;
border-radius: 5px 5px 0 0;
margin-left: 5px;
&:hover, &.hover {
background: #009fff;
}
vertical-align: bottom;
&:active, &.active {
background: darken(#009fff, 10%);
box-shadow: inset 0 2px 3px rgba(0,0,0, .2);
}
...
...
@@ -199,14 +274,12 @@ button {
}
#draft-btn {
.dropdown;
border-radius: 5px 5px 0 0;
float: left;
margin-left:
0;
border-radius: 5px 5px 0
0;
}
.draft-menu.kmui-dropdown-menu {
margin-top: 14px;
margin-left: -1px;
box-shadow: 0px 1px 5px rgba(0,0,0, .3);
span.update-time {
float: right;
color: #CCC;
...
...
@@ -276,18 +349,22 @@ button {
}
}
.file-menu.kmui-dropdown-menu {
margin-top: 1
4
px;
margin-top: 1
5
px;
margin-left: 1px;
border-radius: 0 0 4px 4px;
box-shadow: 0px 1px 5px rgba(0,0,0, .3);
#save-button, #manage-file-button
, #share-button + .kmui-divider
{
#save-button, #manage-file-button {
display: none;
}
&.logined {
#save-button, #manage-file-button
, #share-button + .kmui-divider
{
#save-button, #manage-file-button{
display: block;
}
#net-hint-buttom {
display: none;
}
}
}
...
...
src/adapter/saveto.js
View file @
e90c76ea
...
...
@@ -60,7 +60,7 @@ KM.registerToolbarUI('saveto', function(name) {
}
function
doDownload
(
url
,
filename
,
type
)
{
if
(
kity
.
Browser
.
i
e
||
~
window
.
location
.
href
.
indexOf
(
'naotu.baidu.com'
))
{
if
(
!
kity
.
Browser
.
chrom
e
||
~
window
.
location
.
href
.
indexOf
(
'naotu.baidu.com'
))
{
return
doProxyDownload
(
url
,
filename
,
type
);
}
var
a
=
document
.
createElement
(
'a'
);
...
...
src/core/minder.event.js
View file @
e90c76ea
// 事件机制
kity
.
extendClass
(
Minder
,
{
_initEvents
:
function
()
{
kity
.
extendClass
(
Minder
,
{
_initEvents
:
function
()
{
this
.
_eventCallbacks
=
{};
},
_bindEvents
:
function
()
{
_bindEvents
:
function
()
{
this
.
_bindPaperEvents
();
this
.
_bindKeyboardEvents
();
},
_resetEvents
:
function
()
{
_resetEvents
:
function
()
{
this
.
_initEvents
();
this
.
_bindEvents
();
},
// TODO: mousemove lazy bind
_bindPaperEvents
:
function
()
{
this
.
_paper
.
on
(
'click dblclick mousedown contextmenu mouseup mousemove mousewheel DOMMouseScroll touchstart touchmove touchend dragenter dragleave drop'
,
this
.
_firePharse
.
bind
(
this
)
);
if
(
window
)
{
window
.
addEventListener
(
'resize'
,
this
.
_firePharse
.
bind
(
this
)
);
window
.
addEventListener
(
'blur'
,
this
.
_firePharse
.
bind
(
this
)
);
_bindPaperEvents
:
function
()
{
this
.
_paper
.
on
(
'click dblclick mousedown contextmenu mouseup mousemove mousewheel DOMMouseScroll touchstart touchmove touchend dragenter dragleave drop'
,
this
.
_firePharse
.
bind
(
this
)
);
if
(
window
)
{
window
.
addEventListener
(
'resize'
,
this
.
_firePharse
.
bind
(
this
)
);
window
.
addEventListener
(
'blur'
,
this
.
_firePharse
.
bind
(
this
)
);
}
},
_bindKeyboardEvents
:
function
()
{
if
(
(
navigator
.
userAgent
.
indexOf
(
'iPhone'
)
==
-
1
)
&&
(
navigator
.
userAgent
.
indexOf
(
'iPod'
)
==
-
1
)
&&
(
navigator
.
userAgent
.
indexOf
(
'iPad'
)
==
-
1
)
)
{
_bindKeyboardEvents
:
function
()
{
if
(
(
navigator
.
userAgent
.
indexOf
(
'iPhone'
)
==
-
1
)
&&
(
navigator
.
userAgent
.
indexOf
(
'iPod'
)
==
-
1
)
&&
(
navigator
.
userAgent
.
indexOf
(
'iPad'
)
==
-
1
)
)
{
//只能在这里做,要不无法触发
Utils
.
listen
(
document
.
body
,
'keydown keyup keypress paste'
,
this
.
_firePharse
.
bind
(
this
)
);
Utils
.
listen
(
document
.
body
,
'keydown keyup keypress paste'
,
this
.
_firePharse
.
bind
(
this
)
);
}
},
_firePharse
:
function
(
e
)
{
// //只读模式下强了所有的事件操作
// if(this.readOnly === true){
// return false;
// }
_firePharse
:
function
(
e
)
{
// //只读模式下强了所有的事件操作
// if(this.readOnly === true){
// return false;
// }
var
beforeEvent
,
preEvent
,
executeEvent
;
if
(
e
.
type
==
'DOMMouseScroll'
)
{
if
(
e
.
type
==
'DOMMouseScroll'
)
{
e
.
type
=
'mousewheel'
;
e
.
wheelDelta
=
e
.
originEvent
.
wheelDelta
=
e
.
originEvent
.
detail
*
120
;
e
.
wheelDelta
=
e
.
originEvent
.
wheelDelta
=
e
.
originEvent
.
detail
*
-
10
;
e
.
wheelDeltaX
=
e
.
originEvent
.
mozMovementX
;
e
.
wheelDeltaY
=
e
.
originEvent
.
mozMovementY
;
}
beforeEvent
=
new
MinderEvent
(
'before'
+
e
.
type
,
e
,
true
);
if
(
this
.
_fire
(
beforeEvent
)
)
{
beforeEvent
=
new
MinderEvent
(
'before'
+
e
.
type
,
e
,
true
);
if
(
this
.
_fire
(
beforeEvent
)
)
{
return
;
}
preEvent
=
new
MinderEvent
(
'pre'
+
e
.
type
,
e
,
false
);
executeEvent
=
new
MinderEvent
(
e
.
type
,
e
,
false
);
preEvent
=
new
MinderEvent
(
'pre'
+
e
.
type
,
e
,
false
);
executeEvent
=
new
MinderEvent
(
e
.
type
,
e
,
false
);
this
.
_fire
(
preEvent
);
this
.
_fire
(
executeEvent
);
this
.
_fire
(
new
MinderEvent
(
'after'
+
e
.
type
,
e
,
false
)
);
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
);
if
(
~
'mousedown mouseup keydown keyup'
.
indexOf
(
e
.
type
)
)
{
this
.
_interactChange
(
e
);
}
},
_interactChange
:
function
(
e
)
{
_interactChange
:
function
(
e
)
{
var
minder
=
this
;
clearTimeout
(
this
.
_interactTimeout
);
this
.
_interactTimeout
=
setTimeout
(
function
()
{
var
stoped
=
minder
.
_fire
(
new
MinderEvent
(
'beforeinteractchange'
)
);
if
(
stoped
)
{
clearTimeout
(
this
.
_interactTimeout
);
this
.
_interactTimeout
=
setTimeout
(
function
()
{
var
stoped
=
minder
.
_fire
(
new
MinderEvent
(
'beforeinteractchange'
)
);
if
(
stoped
)
{
return
;
}
minder
.
_fire
(
new
MinderEvent
(
'preinteractchange'
)
);
minder
.
_fire
(
new
MinderEvent
(
'interactchange'
)
);
},
20
);
minder
.
_fire
(
new
MinderEvent
(
'preinteractchange'
)
);
minder
.
_fire
(
new
MinderEvent
(
'interactchange'
)
);
},
20
);
},
_listen
:
function
(
type
,
callback
)
{
var
callbacks
=
this
.
_eventCallbacks
[
type
]
||
(
this
.
_eventCallbacks
[
type
]
=
[]
);
callbacks
.
push
(
callback
);
_listen
:
function
(
type
,
callback
)
{
var
callbacks
=
this
.
_eventCallbacks
[
type
]
||
(
this
.
_eventCallbacks
[
type
]
=
[]
);
callbacks
.
push
(
callback
);
},
_fire
:
function
(
e
)
{
_fire
:
function
(
e
)
{
var
status
=
this
.
getStatus
();
var
callbacks
=
this
.
_eventCallbacks
[
e
.
type
.
toLowerCase
()
]
||
[];
var
callbacks
=
this
.
_eventCallbacks
[
e
.
type
.
toLowerCase
()
]
||
[];
if
(
status
)
{
if
(
status
)
{
callbacks
=
callbacks
.
concat
(
this
.
_eventCallbacks
[
status
+
'.'
+
e
.
type
.
toLowerCase
()
]
||
[]
);
callbacks
=
callbacks
.
concat
(
this
.
_eventCallbacks
[
status
+
'.'
+
e
.
type
.
toLowerCase
()]
||
[]
);
}
if
(
callbacks
.
length
===
0
)
{
if
(
callbacks
.
length
===
0
)
{
return
;
}
var
lastStatus
=
this
.
getStatus
();
for
(
var
i
=
0
;
i
<
callbacks
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
callbacks
.
length
;
i
++
)
{
callbacks
[
i
].
call
(
this
,
e
);
callbacks
[
i
].
call
(
this
,
e
);
if
(
this
.
getStatus
()
!=
lastStatus
||
e
.
shouldStopPropagationImmediately
()
)
{
if
(
this
.
getStatus
()
!=
lastStatus
||
e
.
shouldStopPropagationImmediately
()
)
{
break
;
}
}
return
e
.
shouldStopPropagation
();
},
on
:
function
(
name
,
callback
)
{
on
:
function
(
name
,
callback
)
{
var
km
=
this
;
utils
.
each
(
name
.
split
(
/
\s
+/
),
function
(
i
,
n
)
{
km
.
_listen
(
n
.
toLowerCase
(),
callback
);
}
);
utils
.
each
(
name
.
split
(
/
\s
+/
),
function
(
i
,
n
)
{
km
.
_listen
(
n
.
toLowerCase
(),
callback
);
});
return
this
;
},
off
:
function
(
name
,
callback
)
{
off
:
function
(
name
,
callback
)
{
var
types
=
name
.
split
(
/
\s
+/
);
var
types
=
name
.
split
(
/
\s
+/
);
var
i
,
j
,
callbacks
,
removeIndex
;
for
(
i
=
0
;
i
<
types
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
types
.
length
;
i
++
)
{
callbacks
=
this
.
_eventCallbacks
[
types
[
i
].
toLowerCase
()
];
if
(
callbacks
)
{
callbacks
=
this
.
_eventCallbacks
[
types
[
i
].
toLowerCase
()
];
if
(
callbacks
)
{
removeIndex
=
null
;
for
(
j
=
0
;
j
<
callbacks
.
length
;
j
++
)
{
if
(
callbacks
[
j
]
==
callback
)
{
for
(
j
=
0
;
j
<
callbacks
.
length
;
j
++
)
{
if
(
callbacks
[
j
]
==
callback
)
{
removeIndex
=
j
;
}
}
if
(
removeIndex
!==
null
)
{
callbacks
.
splice
(
removeIndex
,
1
);
if
(
removeIndex
!==
null
)
{
callbacks
.
splice
(
removeIndex
,
1
);
}
}
}
},
fire
:
function
(
type
,
params
)
{
var
e
=
new
MinderEvent
(
type
,
params
);
this
.
_fire
(
e
);
fire
:
function
(
type
,
params
)
{
var
e
=
new
MinderEvent
(
type
,
params
);
this
.
_fire
(
e
);
return
this
;
}
}
);
\ No newline at end of file
});
\ No newline at end of file
src/module/view.js
View file @
e90c76ea
...
...
@@ -17,8 +17,13 @@ var ViewDragger = kity.createClass("ViewDragger", {
paper
.
setStyle
(
'cursor'
,
value
?
'-webkit-grab'
:
'default'
);
this
.
_enabled
=
value
;
},
move
:
function
(
offset
)
{
move
:
function
(
offset
,
duration
)
{
if
(
!
duration
)
{
this
.
_minder
.
getRenderContainer
().
translate
(
offset
.
x
|
0
,
offset
.
y
|
0
);
}
else
{
this
.
_minder
.
getRenderContainer
().
fxTranslate
(
offset
.
x
|
0
,
offset
.
y
|
0
,
duration
,
'easeOutCubic'
);
}
},
_bind
:
function
()
{
...
...
@@ -81,7 +86,7 @@ KityMinder.registerModule('View', function() {
var
km
=
this
;
var
ToggleHandCommand
=
kity
.
createClass
(
"ToggleHandCommand"
,
{
var
ToggleHandCommand
=
kity
.
createClass
(
'ToggleHandCommand'
,
{
base
:
Command
,
execute
:
function
(
minder
)
{
...
...
@@ -102,30 +107,51 @@ KityMinder.registerModule('View', function() {
var
CameraCommand
=
kity
.
createClass
(
'CameraCommand'
,
{
base
:
Command
,
execute
:
function
(
km
,
focusNode
,
noAnimate
)
{
execute
:
function
(
km
,
focusNode
,
duration
)
{
focusNode
=
focusNode
||
km
.
getRoot
();
var
viewport
=
km
.
getPaper
().
getViewPort
();
var
offset
=
focusNode
.
getRenderContainer
().
getRenderBox
(
'view'
);
var
dx
=
viewport
.
center
.
x
-
offset
.
x
-
offset
.
width
/
2
,
dy
=
viewport
.
center
.
y
-
offset
.
y
;
var
dragger
=
km
.
_viewDragger
;
if
(
noAnimate
)
{
km
.
getRenderContainer
().
translate
(
dx
,
dy
);
}
else
{
km
.
getRenderContainer
().
fxTranslate
(
dx
,
dy
,
1000
,
'easeOutQuint'
);
}
dragger
.
move
(
new
kity
.
Point
(
dx
,
dy
),
duration
);
this
.
setContentChanged
(
false
);
},
enableReadOnly
:
false
});
var
MoveCommand
=
kity
.
createClass
(
'MoveCommand'
,
{
base
:
Command
,
execute
:
function
(
km
,
dir
)
{
var
dragger
=
this
.
_viewDragger
;
var
size
=
km
.
_lastClientSize
;
switch
(
dir
)
{
case
'up'
:
dragger
.
move
(
new
kity
.
Point
(
0
,
-
size
.
height
/
2
));
break
;
case
'down'
:
dragger
.
move
(
new
kity
.
Point
(
0
,
size
.
height
/
2
));
break
;
case
'left'
:
dragger
.
move
(
new
kity
.
Point
(
-
size
.
width
/
2
,
0
));
break
;
case
'right'
:
dragger
.
move
(
new
kity
.
Point
(
size
.
width
/
2
,
0
));
break
;
}
}
});
return
{
init
:
function
()
{
this
.
_viewDragger
=
new
ViewDragger
(
this
);
},
commands
:
{
'hand'
:
ToggleHandCommand
,
'camera'
:
CameraCommand
'camera'
:
CameraCommand
,
'move'
:
MoveCommand
},
events
:
{
keyup
:
function
(
e
)
{
...
...
@@ -160,11 +186,11 @@ KityMinder.registerModule('View', function() {
},
'normal.dblclick readonly.dblclick'
:
function
(
e
)
{
if
(
e
.
kityEvent
.
targetShape
instanceof
kity
.
Paper
)
{
this
.
execCommand
(
'camera'
,
this
.
getRoot
());
this
.
execCommand
(
'camera'
,
this
.
getRoot
()
,
800
);
}
},
ready
:
function
()
{
this
.
execCommand
(
'camera'
,
null
,
true
);
this
.
execCommand
(
'camera'
,
null
,
0
);
this
.
_lastClientSize
=
{
width
:
this
.
getRenderTarget
().
clientWidth
,
height
:
this
.
getRenderTarget
().
clientHeight
...
...
themes/default/css/dialog.css
View file @
e90c76ea
.kmui-modal
{
position
:
fixed
;
top
:
9
0px
;
top
:
10
0px
;
right
:
10px
;
background-color
:
#f
afafa
;
background-color
:
#f
ff
;
outline
:
0
;
border-radius
:
5px
;
box-shadow
:
3px
3px
8px
rgba
(
0
,
0
,
0
,
.5
);
...
...
themes/default/css/dropmenu.css
View file @
e90c76ea
.kmui-dropdown-menu
{
position
:
absolute
;
z-index
:
1000
;
z-index
:
99999999999
;
display
:
none
;
min-width
:
160px
;
padding
:
5px
0
;
...
...
themes/default/css/kityminder.css
View file @
e90c76ea
...
...
@@ -22,7 +22,7 @@ html, body, #kityminder, div.kmui-editor-body {
.kmui-container
{
}
.kmui-container
.kmui-toolbar
{
background-color
:
#f
afafa
;
background-color
:
#f
ff
;
z-index
:
999
;
}
.kmui-toolbar
.kmui-btn-toolbar
{
...
...
@@ -32,7 +32,7 @@ html, body, #kityminder, div.kmui-editor-body {
position
:
absolute
;
left
:
0
;
right
:
0
;
top
:
3
0px
;
top
:
4
0px
;
border-bottom
:
1px
solid
#f0f0f0
;
}
.kmui-container
.kmui-editor-body
{
...
...
@@ -59,6 +59,7 @@ svg, body {
text-align
:
right
;
padding
:
0
15px
;
border-top
:
1px
solid
#f0f0f0
;
padding-left
:
5px
;
}
#about
a
{
color
:
#333
;
...
...
themes/default/images/kmcat.png
0 → 100644
View file @
e90c76ea
1.26 KB
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