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
22ea87c5
Commit
22ea87c5
authored
Apr 09, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改readonly的实现方式,改为使用 状态判断
parent
93fef115
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
16 deletions
+27
-16
minder.event.js
src/core/minder.event.js
+4
-4
minder.js
src/core/minder.js
+12
-4
editor.js
src/module/editor.js
+0
-1
view.js
src/module/view.js
+6
-4
zoom.js
src/module/zoom.js
+5
-3
No files found.
src/core/minder.event.js
View file @
22ea87c5
...
...
@@ -25,10 +25,10 @@ kity.extendClass( Minder, {
}
},
_firePharse
:
function
(
e
)
{
//只读模式下强了所有的事件操作
if
(
this
.
readOnly
===
true
){
return
false
;
}
//
//只读模式下强了所有的事件操作
//
if(this.readOnly === true){
//
return false;
//
}
var
beforeEvent
,
preEvent
,
executeEvent
;
if
(
e
.
type
==
'DOMMouseScroll'
)
{
...
...
src/core/minder.js
View file @
22ea87c5
...
...
@@ -175,14 +175,22 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
//禁用命令
me
.
bkqueryCommandState
=
me
.
queryCommandState
;
me
.
bkqueryCommandValue
=
me
.
queryCommandValue
;
me
.
queryCommandState
=
function
()
{
me
.
queryCommandState
=
function
(
type
)
{
var
cmd
=
this
.
_getCommand
(
type
);
if
(
cmd
&&
cmd
.
enableReadOnly
===
false
){
return
me
.
bkqueryCommandState
.
apply
(
me
,
arguments
);
}
return
-
1
;
};
me
.
queryCommandValue
=
function
()
{
me
.
queryCommandValue
=
function
(
type
)
{
var
cmd
=
this
.
_getCommand
(
type
);
if
(
cmd
&&
cmd
.
enableReadOnly
===
false
){
return
me
.
bkqueryCommandValue
.
apply
(
me
,
arguments
);
}
return
null
;
};
this
.
setStatus
(
'readonly'
);
this
.
readOnly
=
true
;
me
.
fire
(
'interactchange'
);
},
...
...
@@ -198,7 +206,7 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
delete
me
.
bkqueryCommandValue
;
}
this
.
r
eadOnly
=
false
;
this
.
r
ollbackStatus
()
;
me
.
fire
(
'interactchange'
);
}
...
...
src/module/editor.js
View file @
22ea87c5
...
...
@@ -27,7 +27,6 @@ KityMinder.registerModule( "TextEditModule", function () {
},
"events"
:
{
'normal.beforemousedown textedit.beforemousedown'
:
function
(
e
){
if
(
e
.
isRightMB
()){
e
.
stopPropagationImmediately
();
return
;
...
...
src/module/view.js
View file @
22ea87c5
...
...
@@ -27,7 +27,7 @@ var ViewDragger = kity.createClass( "ViewDragger", {
lastPosition
=
null
,
currentPosition
=
null
;
this
.
_minder
.
on
(
'normal.beforemousedown'
,
function
(
e
)
{
this
.
_minder
.
on
(
'normal.beforemousedown
readonly.beforemousedown
'
,
function
(
e
)
{
// 点击未选中的根节点临时开启
if
(
e
.
getTargetNode
()
==
this
.
getRoot
()
&&
(
!
this
.
getRoot
().
isSelected
()
||
!
this
.
isSingleSelect
()
)
)
{
...
...
@@ -94,7 +94,8 @@ KityMinder.registerModule( 'View', function () {
},
queryState
:
function
(
minder
)
{
return
minder
.
_viewDragger
.
isEnabled
()
?
1
:
0
;
}
},
enableReadOnly
:
false
}
);
var
CameraCommand
=
kity
.
createClass
(
"CameraCommand"
,
{
...
...
@@ -106,7 +107,8 @@ KityMinder.registerModule( 'View', function () {
dy
=
viewport
.
center
.
y
-
offset
.
y
;
km
.
getRenderContainer
().
fxTranslate
(
dx
,
dy
,
1000
,
"easeOutQuint"
);
this
.
setContentChanged
(
false
);
}
},
enableReadOnly
:
false
}
);
return
{
...
...
@@ -148,7 +150,7 @@ KityMinder.registerModule( 'View', function () {
e
.
preventDefault
();
},
'normal.dblclick'
:
function
(
e
)
{
'normal.dblclick
readonly.dblclick
'
:
function
(
e
)
{
if
(
e
.
getTargetNode
()
)
return
;
this
.
execCommand
(
'camera'
,
this
.
getRoot
()
);
}
...
...
src/module/zoom.js
View file @
22ea87c5
...
...
@@ -41,7 +41,8 @@ KityMinder.registerModule( 'Zoom', function () {
},
queryState
:
function
(
minder
)
{
return
(
minder
.
_zoomValue
>
1
/
MAX_ZOOM
)
?
0
:
-
1
;
}
},
enableReadOnly
:
false
}
);
var
ZoomOutCommand
=
kity
.
createClass
(
'ZoomOutCommand'
,
{
...
...
@@ -53,7 +54,8 @@ KityMinder.registerModule( 'Zoom', function () {
},
queryState
:
function
(
minder
)
{
return
(
minder
.
_zoomValue
<
1
/
MIN_ZOOM
)
?
0
:
-
1
;
}
},
enableReadOnly
:
false
}
);
return
{
...
...
@@ -79,7 +81,7 @@ KityMinder.registerModule( 'Zoom', function () {
'ready'
:
function
()
{
this
.
_zoomValue
=
1
;
},
'normal.mousewheel'
:
function
(
e
)
{
'normal.mousewheel
readonly.mousewheel
'
:
function
(
e
)
{
if
(
!
e
.
originEvent
.
ctrlKey
)
return
;
var
delta
=
e
.
originEvent
.
wheelDelta
;
var
me
=
this
;
...
...
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