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
132599f0
Commit
132599f0
authored
Jul 01, 2014
by
campaign
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
4c84b523
e90c76ea
Changes
15
Expand all
Hide 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 @
132599f0
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
var
content
=
'<div class="hyperlink-content" style="padding:20px;width:360px;">'
;
var
content
=
'<div class="hyperlink-content" style="padding:20px;width:360px;">'
;
content
+=
'<style>'
;
content
+=
'<style>'
;
content
+=
'.kmui-dialog-<%= container %> input{'
;
content
+=
'.kmui-dialog-<%= container %> input{'
;
content
+=
'width: 7
5
%;'
;
content
+=
'width: 7
4
%;'
;
content
+=
'padding: 6px 12px;'
;
content
+=
'padding: 6px 12px;'
;
content
+=
'font-size: 14px;'
;
content
+=
'font-size: 14px;'
;
content
+=
'line-height: 1.42857143;'
;
content
+=
'line-height: 1.42857143;'
;
...
...
dialogs/image/image.js
View file @
132599f0
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
var
content
=
'<div class="image-content" style="padding:20px;width:360px;">'
;
var
content
=
'<div class="image-content" style="padding:20px;width:360px;">'
;
content
+=
'<style>'
;
content
+=
'<style>'
;
content
+=
'.kmui-dialog-<%= container %> input{'
;
content
+=
'.kmui-dialog-<%= container %> input{'
;
content
+=
'width: 7
5
%;'
;
content
+=
'width: 7
4
%;'
;
content
+=
'padding: 6px 12px;'
;
content
+=
'padding: 6px 12px;'
;
content
+=
'font-size: 14px;'
;
content
+=
'font-size: 14px;'
;
content
+=
'line-height: 1.42857143;'
;
content
+=
'line-height: 1.42857143;'
;
...
...
dist/social/social.js
View file @
132599f0
...
@@ -100,7 +100,6 @@ $( function () {
...
@@ -100,7 +100,6 @@ $( function () {
bindShortCuts
();
bindShortCuts
();
bindDraft
();
bindDraft
();
if
(
draftManager
)
watchChanges
();
if
(
draftManager
)
watchChanges
();
if
(
draftManager
&&
!
loadPath
()
&&
!
isShareLink
)
loadDraft
(
0
);
}
}
// 创建 UI
// 创建 UI
...
...
kity
@
5a3fc442
Subproject commit
17b221165e51ee1f69358d4d5bacfe4fe4c7d22c
Subproject commit
5a3fc4422c0d3f1c2d812dd810d8ae7693fa3c93
social/draftmanager.js
View file @
132599f0
...
@@ -38,7 +38,6 @@ function DraftManager( minder ) {
...
@@ -38,7 +38,6 @@ function DraftManager( minder ) {
function
load
()
{
function
load
()
{
if
(
current
)
{
if
(
current
)
{
minder
.
importData
(
current
.
data
,
'json'
);
minder
.
importData
(
current
.
data
,
'json'
);
minder
.
execCommand
(
'camera'
);
}
}
return
current
;
return
current
;
}
}
...
...
social/social.css
View file @
132599f0
This diff is collapsed.
Click to expand it.
social/social.js
View file @
132599f0
...
@@ -52,7 +52,7 @@ $.extend($.fn, {
...
@@ -52,7 +52,7 @@ $.extend($.fn, {
$
(
function
()
{
$
(
function
()
{
// UI 元素
// 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
,
$draft_btn
,
$draft_menu
,
$share_dialog
,
$share_url
,
$copy_url_btn
,
// 当前文件的远端路径
// 当前文件的远端路径
...
@@ -100,6 +100,7 @@ $(function() {
...
@@ -100,6 +100,7 @@ $(function() {
bindShortCuts
();
bindShortCuts
();
bindDraft
();
bindDraft
();
if
(
draftManager
)
watchChanges
();
if
(
draftManager
)
watchChanges
();
if
(
draftManager
&&
!
loadPath
()
&&
!
isShareLink
)
loadDraft
(
0
);
}
}
// 创建 UI
// 创建 UI
...
@@ -111,6 +112,19 @@ $(function() {
...
@@ -111,6 +112,19 @@ $(function() {
$title
=
$
(
'<h2>百度脑图</h2>'
).
appendTo
(
$panel
);
$title
=
$
(
'<h2>百度脑图</h2>'
).
appendTo
(
$panel
);
$file_btn
=
$
(
'<button>文件</button>'
).
addClass
(
'file-button'
).
appendTo
(
$menu
);
$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
({
$file_menu
=
$
.
kmuidropmenu
({
data
:
[{
data
:
[{
...
@@ -124,7 +138,10 @@ $(function() {
...
@@ -124,7 +138,10 @@ $(function() {
id
:
'share-button'
id
:
'share-button'
},
{
},
{
divider
:
true
,
divider
:
true
,
id
:
'cloud-divider'
},
{
label
:
'登陆到网盘...'
,
click
:
login
,
id
:
'net-hint-buttom'
},
{
},
{
label
:
'保存到百度云 (Ctrl + S)'
,
label
:
'保存到百度云 (Ctrl + S)'
,
click
:
save
,
click
:
save
,
...
@@ -583,7 +600,7 @@ $(function() {
...
@@ -583,7 +600,7 @@ $(function() {
draftManager
.
sync
();
draftManager
.
sync
();
}
}
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
());
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
()
,
300
);
$title
.
loading
(
false
).
text
(
getFileName
(
remotePath
));
$title
.
loading
(
false
).
text
(
getFileName
(
remotePath
));
watchingChanges
=
true
;
watchingChanges
=
true
;
...
@@ -638,7 +655,7 @@ $(function() {
...
@@ -638,7 +655,7 @@ $(function() {
setRemotePath
(
null
,
true
);
setRemotePath
(
null
,
true
);
draftManager
.
create
();
draftManager
.
create
();
minder
.
importData
(
'新建脑图'
,
'plain'
);
minder
.
importData
(
'新建脑图'
,
'plain'
);
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
());
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
()
,
300
);
}
}
function
generateRemotePath
()
{
function
generateRemotePath
()
{
...
@@ -810,8 +827,8 @@ $(function() {
...
@@ -810,8 +827,8 @@ $(function() {
draft
=
list
.
shift
();
draft
=
list
.
shift
();
$draft_menu
.
append
(
'<li disabled="disabled" class="current-draft kmui-combobox-item kmui-combobox-item-disabled kmui-combobox-checked">'
+
$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>'
+
'<span class="kmui-combobox-icon"></span>'
+
'<label class="kmui-combobox-item-label">'
+
draft
.
name
+
'<label class="kmui-combobox-item-label">'
+
'<span class="update-time">'
+
getFriendlyTimeSpan
(
+
new
Date
(
draft
.
update
),
+
new
Date
())
+
'</span>'
+
'<span class="update-time">'
+
getFriendlyTimeSpan
(
+
new
Date
(
draft
.
update
),
+
new
Date
())
+
'</span>'
+
draft
.
name
+
'</label>'
+
'</label>'
+
'</li>'
);
'</li>'
);
$draft_menu
.
append
(
'<li class="kmui-divider"></li>'
);
$draft_menu
.
append
(
'<li class="kmui-divider"></li>'
);
...
@@ -823,7 +840,7 @@ $(function() {
...
@@ -823,7 +840,7 @@ $(function() {
while
(
list
.
length
)
{
while
(
list
.
length
)
{
draft
=
list
.
shift
();
draft
=
list
.
shift
();
$draft
=
$
(
'<li class="draft-item">'
+
$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
.
data
(
'draft-index'
,
index
++
);
$draft
.
appendTo
(
$draft_menu
);
$draft
.
appendTo
(
$draft_menu
);
}
}
...
@@ -873,10 +890,6 @@ $(function() {
...
@@ -873,10 +890,6 @@ $(function() {
function
loadDraft
(
index
)
{
function
loadDraft
(
index
)
{
var
draft
=
draftManager
.
open
(
index
),
var
draft
=
draftManager
.
open
(
index
),
isRemote
;
isRemote
;
if
(
!
draft
)
{
minder
.
initStyle
();
return
;
}
isRemote
=
draft
.
path
.
indexOf
(
'/apps/kityminder'
)
===
0
;
isRemote
=
draft
.
path
.
indexOf
(
'/apps/kityminder'
)
===
0
;
if
(
isRemote
)
{
if
(
isRemote
)
{
...
@@ -888,6 +901,7 @@ $(function() {
...
@@ -888,6 +901,7 @@ $(function() {
if
(
!
isRemote
)
{
if
(
!
isRemote
)
{
setRemotePath
(
null
,
false
);
setRemotePath
(
null
,
false
);
}
}
minder
.
execCommand
(
'camera'
,
null
,
300
);
}
}
function
getFriendlyTimeSpan
(
t1_in_ms
,
t2_in_ms
)
{
function
getFriendlyTimeSpan
(
t1_in_ms
,
t2_in_ms
)
{
...
...
social/social.less
View file @
132599f0
#social {
#social {
position: absolute;
position: absolute;
height:
3
0px;
height:
4
0px;
left: 0;
left: 0;
right: 0;
right: 0;
top: 0;
top: 0;
line-height:
3
0px;
line-height:
4
0px;
overflow:
hidden
;
overflow:
visible
;
background: #fafafa;
background: #fafafa;
border-bottom: 1px solid #fff;
z-index: 999999;
box-shadow: inset 0 -1px #f0f0f0;
padding-left: 5px;
z-index: 1000;
border-bottom: 1px solid #f0f0f0;
background: #fafafa url(../themes/default/images/kmcat.png) no-repeat 180px 15px;
h2 {
h2 {
margin: 0
200px
;
margin: 0;
padding: 0;
padding: 0;
color: #999;
color: #999;
text-shadow: 0 1px white;
text-shadow: 0 1px white;
...
@@ -55,6 +56,33 @@
...
@@ -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 {
.niceblue {
...
@@ -71,6 +99,47 @@
...
@@ -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 {
.dropdown {
padding-right: 28px;
padding-right: 28px;
position: relative;
position: relative;
...
@@ -93,6 +162,19 @@
...
@@ -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 {
button {
font-family: Arial, "Heiti SC", "Microsoft Yahei";
font-family: Arial, "Heiti SC", "Microsoft Yahei";
outline: none;
outline: none;
...
@@ -110,9 +192,6 @@ button {
...
@@ -110,9 +192,6 @@ button {
background: none;
background: none;
border-radius: 2px;
border-radius: 2px;
&:hover, &.hover {
}
&:active, &.active {
&:active, &.active {
box-shadow: inset 0 1px 3px rgba(0,0,0,.2);
box-shadow: inset 0 1px 3px rgba(0,0,0,.2);
background: #ccc;
background: #ccc;
...
@@ -145,17 +224,13 @@ button {
...
@@ -145,17 +224,13 @@ button {
}
}
&.file-button {
&.file-button {
.dropdown;
.dropdown;
.
niceblue
;
.
ribbon
;
border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
margin-left: 5px;
margin-left: 5px;
vertical-align: bottom;
&:hover, &.hover {
background: #009fff;
}
&:active, &.active {
&:active, &.active {
background: darken(#009fff, 10%);
box-shadow: inset 0 2px 3px rgba(0,0,0, .2);
box-shadow: inset 0 2px 3px rgba(0,0,0, .2);
}
}
...
@@ -199,14 +274,12 @@ button {
...
@@ -199,14 +274,12 @@ button {
}
}
#draft-btn {
#draft-btn {
.dropdown;
.dropdown;
border-radius: 5px 5px 0 0;
float: left;
float: left;
margin-left:
0;
border-radius: 5px 5px 0
0;
}
}
.draft-menu.kmui-dropdown-menu {
.draft-menu.kmui-dropdown-menu {
margin-top: 14px;
margin-top: 14px;
margin-left: -1px;
margin-left: -1px;
box-shadow: 0px 1px 5px rgba(0,0,0, .3);
span.update-time {
span.update-time {
float: right;
float: right;
color: #CCC;
color: #CCC;
...
@@ -276,18 +349,22 @@ button {
...
@@ -276,18 +349,22 @@ button {
}
}
}
}
.file-menu.kmui-dropdown-menu {
.file-menu.kmui-dropdown-menu {
margin-top: 1
4
px;
margin-top: 1
5
px;
margin-left: 1px;
margin-left: 1px;
border-radius: 0 0 4px 4px;
box-shadow: 0px 1px 5px rgba(0,0,0, .3);
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;
display: none;
}
}
&.logined {
&.logined {
#save-button, #manage-file-button
, #share-button + .kmui-divider
{
#save-button, #manage-file-button{
display: block;
display: block;
}
}
#net-hint-buttom {
display: none;
}
}
}
}
}
...
...
src/adapter/saveto.js
View file @
132599f0
...
@@ -60,7 +60,7 @@ KM.registerToolbarUI('saveto', function(name) {
...
@@ -60,7 +60,7 @@ KM.registerToolbarUI('saveto', function(name) {
}
}
function
doDownload
(
url
,
filename
,
type
)
{
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
);
return
doProxyDownload
(
url
,
filename
,
type
);
}
}
var
a
=
document
.
createElement
(
'a'
);
var
a
=
document
.
createElement
(
'a'
);
...
...
src/core/minder.event.js
View file @
132599f0
// 事件机制
// 事件机制
kity
.
extendClass
(
Minder
,
{
kity
.
extendClass
(
Minder
,
{
_initEvents
:
function
()
{
_initEvents
:
function
()
{
this
.
_eventCallbacks
=
{};
this
.
_eventCallbacks
=
{};
},
},
_bindEvents
:
function
()
{
_bindEvents
:
function
()
{
this
.
_bindPaperEvents
();
this
.
_bindPaperEvents
();
this
.
_bindKeyboardEvents
();
this
.
_bindKeyboardEvents
();
},
},
_resetEvents
:
function
()
{
_resetEvents
:
function
()
{
this
.
_initEvents
();
this
.
_initEvents
();
this
.
_bindEvents
();
this
.
_bindEvents
();
},
},
// TODO: mousemove lazy bind
// TODO: mousemove lazy bind
_bindPaperEvents
:
function
()
{
_bindPaperEvents
:
function
()
{
this
.
_paper
.
on
(
'click dblclick mousedown contextmenu mouseup mousemove mousewheel DOMMouseScroll touchstart touchmove touchend dragenter dragleave drop'
,
this
.
_firePharse
.
bind
(
this
)
);
this
.
_paper
.
on
(
'click dblclick mousedown contextmenu mouseup mousemove mousewheel DOMMouseScroll touchstart touchmove touchend dragenter dragleave drop'
,
this
.
_firePharse
.
bind
(
this
)
);
if
(
window
)
{
if
(
window
)
{
window
.
addEventListener
(
'resize'
,
this
.
_firePharse
.
bind
(
this
)
);
window
.
addEventListener
(
'resize'
,
this
.
_firePharse
.
bind
(
this
)
);
window
.
addEventListener
(
'blur'
,
this
.
_firePharse
.
bind
(
this
)
);
window
.
addEventListener
(
'blur'
,
this
.
_firePharse
.
bind
(
this
)
);
}
}
},
},
_bindKeyboardEvents
:
function
()
{
_bindKeyboardEvents
:
function
()
{
if
(
(
navigator
.
userAgent
.
indexOf
(
'iPhone'
)
==
-
1
)
&&
(
navigator
.
userAgent
.
indexOf
(
'iPod'
)
==
-
1
)
&&
(
navigator
.
userAgent
.
indexOf
(
'iPad'
)
==
-
1
)
)
{
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
)
{
_firePharse
:
function
(
e
)
{
// //只读模式下强了所有的事件操作
// //只读模式下强了所有的事件操作
// if(this.readOnly === true){
// if(this.readOnly === true){
// return false;
// return false;
// }
// }
var
beforeEvent
,
preEvent
,
executeEvent
;
var
beforeEvent
,
preEvent
,
executeEvent
;
if
(
e
.
type
==
'DOMMouseScroll'
)
{
if
(
e
.
type
==
'DOMMouseScroll'
)
{
e
.
type
=
'mousewheel'
;
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
);
beforeEvent
=
new
MinderEvent
(
'before'
+
e
.
type
,
e
,
true
);
if
(
this
.
_fire
(
beforeEvent
)
)
{
if
(
this
.
_fire
(
beforeEvent
)
)
{
return
;
return
;
}
}
preEvent
=
new
MinderEvent
(
'pre'
+
e
.
type
,
e
,
false
);
preEvent
=
new
MinderEvent
(
'pre'
+
e
.
type
,
e
,
false
);
executeEvent
=
new
MinderEvent
(
e
.
type
,
e
,
false
);
executeEvent
=
new
MinderEvent
(
e
.
type
,
e
,
false
);
this
.
_fire
(
preEvent
);
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
)
)
{
if
(
~
'mousedown mouseup keydown keyup'
.
indexOf
(
e
.
type
)
)
{
this
.
_interactChange
(
e
);
this
.
_interactChange
(
e
);
}
}
},
},
_interactChange
:
function
(
e
)
{
_interactChange
:
function
(
e
)
{
var
minder
=
this
;
var
minder
=
this
;
clearTimeout
(
this
.
_interactTimeout
);
clearTimeout
(
this
.
_interactTimeout
);
this
.
_interactTimeout
=
setTimeout
(
function
()
{
this
.
_interactTimeout
=
setTimeout
(
function
()
{
var
stoped
=
minder
.
_fire
(
new
MinderEvent
(
'beforeinteractchange'
)
);
var
stoped
=
minder
.
_fire
(
new
MinderEvent
(
'beforeinteractchange'
)
);
if
(
stoped
)
{
if
(
stoped
)
{
return
;
return
;
}
}
minder
.
_fire
(
new
MinderEvent
(
'preinteractchange'
)
);
minder
.
_fire
(
new
MinderEvent
(
'preinteractchange'
)
);
minder
.
_fire
(
new
MinderEvent
(
'interactchange'
)
);
minder
.
_fire
(
new
MinderEvent
(
'interactchange'
)
);
},
20
);
},
20
);
},
},
_listen
:
function
(
type
,
callback
)
{
_listen
:
function
(
type
,
callback
)
{
var
callbacks
=
this
.
_eventCallbacks
[
type
]
||
(
this
.
_eventCallbacks
[
type
]
=
[]
);
var
callbacks
=
this
.
_eventCallbacks
[
type
]
||
(
this
.
_eventCallbacks
[
type
]
=
[]
);
callbacks
.
push
(
callback
);
callbacks
.
push
(
callback
);
},
},
_fire
:
function
(
e
)
{
_fire
:
function
(
e
)
{
var
status
=
this
.
getStatus
();
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
;
return
;
}
}
var
lastStatus
=
this
.
getStatus
();
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
;
break
;
}
}
}
}
return
e
.
shouldStopPropagation
();
return
e
.
shouldStopPropagation
();
},
},
on
:
function
(
name
,
callback
)
{
on
:
function
(
name
,
callback
)
{
var
km
=
this
;
var
km
=
this
;
utils
.
each
(
name
.
split
(
/
\s
+/
),
function
(
i
,
n
)
{
utils
.
each
(
name
.
split
(
/
\s
+/
),
function
(
i
,
n
)
{
km
.
_listen
(
n
.
toLowerCase
(),
callback
);
km
.
_listen
(
n
.
toLowerCase
(),
callback
);
}
);
});
return
this
;
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
;
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
()
];
callbacks
=
this
.
_eventCallbacks
[
types
[
i
].
toLowerCase
()
];
if
(
callbacks
)
{
if
(
callbacks
)
{
removeIndex
=
null
;
removeIndex
=
null
;
for
(
j
=
0
;
j
<
callbacks
.
length
;
j
++
)
{
for
(
j
=
0
;
j
<
callbacks
.
length
;
j
++
)
{
if
(
callbacks
[
j
]
==
callback
)
{
if
(
callbacks
[
j
]
==
callback
)
{
removeIndex
=
j
;
removeIndex
=
j
;
}
}
}
}
if
(
removeIndex
!==
null
)
{
if
(
removeIndex
!==
null
)
{
callbacks
.
splice
(
removeIndex
,
1
);
callbacks
.
splice
(
removeIndex
,
1
);
}
}
}
}
}
}
},
},
fire
:
function
(
type
,
params
)
{
fire
:
function
(
type
,
params
)
{
var
e
=
new
MinderEvent
(
type
,
params
);
var
e
=
new
MinderEvent
(
type
,
params
);
this
.
_fire
(
e
);
this
.
_fire
(
e
);
return
this
;
return
this
;
}
}
}
);
});
\ No newline at end of file
\ No newline at end of file
src/module/view.js
View file @
132599f0
...
@@ -17,8 +17,13 @@ var ViewDragger = kity.createClass("ViewDragger", {
...
@@ -17,8 +17,13 @@ var ViewDragger = kity.createClass("ViewDragger", {
paper
.
setStyle
(
'cursor'
,
value
?
'-webkit-grab'
:
'default'
);
paper
.
setStyle
(
'cursor'
,
value
?
'-webkit-grab'
:
'default'
);
this
.
_enabled
=
value
;
this
.
_enabled
=
value
;
},
},
move
:
function
(
offset
)
{
move
:
function
(
offset
,
duration
)
{
this
.
_minder
.
getRenderContainer
().
translate
(
offset
.
x
|
0
,
offset
.
y
|
0
);
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
()
{
_bind
:
function
()
{
...
@@ -81,7 +86,7 @@ KityMinder.registerModule('View', function() {
...
@@ -81,7 +86,7 @@ KityMinder.registerModule('View', function() {
var
km
=
this
;
var
km
=
this
;
var
ToggleHandCommand
=
kity
.
createClass
(
"ToggleHandCommand"
,
{
var
ToggleHandCommand
=
kity
.
createClass
(
'ToggleHandCommand'
,
{
base
:
Command
,
base
:
Command
,
execute
:
function
(
minder
)
{
execute
:
function
(
minder
)
{
...
@@ -102,30 +107,51 @@ KityMinder.registerModule('View', function() {
...
@@ -102,30 +107,51 @@ KityMinder.registerModule('View', function() {
var
CameraCommand
=
kity
.
createClass
(
'CameraCommand'
,
{
var
CameraCommand
=
kity
.
createClass
(
'CameraCommand'
,
{
base
:
Command
,
base
:
Command
,
execute
:
function
(
km
,
focusNode
,
noAnimate
)
{
execute
:
function
(
km
,
focusNode
,
duration
)
{
focusNode
=
focusNode
||
km
.
getRoot
();
focusNode
=
focusNode
||
km
.
getRoot
();
var
viewport
=
km
.
getPaper
().
getViewPort
();
var
viewport
=
km
.
getPaper
().
getViewPort
();
var
offset
=
focusNode
.
getRenderContainer
().
getRenderBox
(
'view'
);
var
offset
=
focusNode
.
getRenderContainer
().
getRenderBox
(
'view'
);
var
dx
=
viewport
.
center
.
x
-
offset
.
x
-
offset
.
width
/
2
,
var
dx
=
viewport
.
center
.
x
-
offset
.
x
-
offset
.
width
/
2
,
dy
=
viewport
.
center
.
y
-
offset
.
y
;
dy
=
viewport
.
center
.
y
-
offset
.
y
;
var
dragger
=
km
.
_viewDragger
;
if
(
noAnimate
)
{
dragger
.
move
(
new
kity
.
Point
(
dx
,
dy
),
duration
);
km
.
getRenderContainer
().
translate
(
dx
,
dy
);
}
else
{
km
.
getRenderContainer
().
fxTranslate
(
dx
,
dy
,
1000
,
'easeOutQuint'
);
}
this
.
setContentChanged
(
false
);
this
.
setContentChanged
(
false
);
},
},
enableReadOnly
:
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
{
return
{
init
:
function
()
{
init
:
function
()
{
this
.
_viewDragger
=
new
ViewDragger
(
this
);
this
.
_viewDragger
=
new
ViewDragger
(
this
);
},
},
commands
:
{
commands
:
{
'hand'
:
ToggleHandCommand
,
'hand'
:
ToggleHandCommand
,
'camera'
:
CameraCommand
'camera'
:
CameraCommand
,
'move'
:
MoveCommand
},
},
events
:
{
events
:
{
keyup
:
function
(
e
)
{
keyup
:
function
(
e
)
{
...
@@ -160,11 +186,11 @@ KityMinder.registerModule('View', function() {
...
@@ -160,11 +186,11 @@ KityMinder.registerModule('View', function() {
},
},
'normal.dblclick readonly.dblclick'
:
function
(
e
)
{
'normal.dblclick readonly.dblclick'
:
function
(
e
)
{
if
(
e
.
kityEvent
.
targetShape
instanceof
kity
.
Paper
)
{
if
(
e
.
kityEvent
.
targetShape
instanceof
kity
.
Paper
)
{
this
.
execCommand
(
'camera'
,
this
.
getRoot
());
this
.
execCommand
(
'camera'
,
this
.
getRoot
()
,
800
);
}
}
},
},
ready
:
function
()
{
ready
:
function
()
{
this
.
execCommand
(
'camera'
,
null
,
true
);
this
.
execCommand
(
'camera'
,
null
,
0
);
this
.
_lastClientSize
=
{
this
.
_lastClientSize
=
{
width
:
this
.
getRenderTarget
().
clientWidth
,
width
:
this
.
getRenderTarget
().
clientWidth
,
height
:
this
.
getRenderTarget
().
clientHeight
height
:
this
.
getRenderTarget
().
clientHeight
...
...
themes/default/css/dialog.css
View file @
132599f0
.kmui-modal
{
.kmui-modal
{
position
:
fixed
;
position
:
fixed
;
top
:
9
0px
;
top
:
10
0px
;
right
:
10px
;
right
:
10px
;
background-color
:
#f
afafa
;
background-color
:
#f
ff
;
outline
:
0
;
outline
:
0
;
border-radius
:
5px
;
border-radius
:
5px
;
box-shadow
:
3px
3px
8px
rgba
(
0
,
0
,
0
,
.5
);
box-shadow
:
3px
3px
8px
rgba
(
0
,
0
,
0
,
.5
);
...
...
themes/default/css/dropmenu.css
View file @
132599f0
.kmui-dropdown-menu
{
.kmui-dropdown-menu
{
position
:
absolute
;
position
:
absolute
;
z-index
:
1000
;
z-index
:
99999999999
;
display
:
none
;
display
:
none
;
min-width
:
160px
;
min-width
:
160px
;
padding
:
5px
0
;
padding
:
5px
0
;
...
...
themes/default/css/kityminder.css
View file @
132599f0
...
@@ -22,7 +22,7 @@ html, body, #kityminder, div.kmui-editor-body {
...
@@ -22,7 +22,7 @@ html, body, #kityminder, div.kmui-editor-body {
.kmui-container
{
.kmui-container
{
}
}
.kmui-container
.kmui-toolbar
{
.kmui-container
.kmui-toolbar
{
background-color
:
#f
afafa
;
background-color
:
#f
ff
;
z-index
:
999
;
z-index
:
999
;
}
}
.kmui-toolbar
.kmui-btn-toolbar
{
.kmui-toolbar
.kmui-btn-toolbar
{
...
@@ -32,7 +32,7 @@ html, body, #kityminder, div.kmui-editor-body {
...
@@ -32,7 +32,7 @@ html, body, #kityminder, div.kmui-editor-body {
position
:
absolute
;
position
:
absolute
;
left
:
0
;
left
:
0
;
right
:
0
;
right
:
0
;
top
:
3
0px
;
top
:
4
0px
;
border-bottom
:
1px
solid
#f0f0f0
;
border-bottom
:
1px
solid
#f0f0f0
;
}
}
.kmui-container
.kmui-editor-body
{
.kmui-container
.kmui-editor-body
{
...
@@ -59,6 +59,7 @@ svg, body {
...
@@ -59,6 +59,7 @@ svg, body {
text-align
:
right
;
text-align
:
right
;
padding
:
0
15px
;
padding
:
0
15px
;
border-top
:
1px
solid
#f0f0f0
;
border-top
:
1px
solid
#f0f0f0
;
padding-left
:
5px
;
}
}
#about
a
{
#about
a
{
color
:
#333
;
color
:
#333
;
...
...
themes/default/images/kmcat.png
0 → 100644
View file @
132599f0
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