Commit 22ea87c5 authored by campaign's avatar campaign

修改readonly的实现方式,改为使用 状态判断

parent 93fef115
......@@ -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' ) {
......
......@@ -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.readOnly = false;
this.rollbackStatus();
me.fire('interactchange');
}
......
......@@ -27,7 +27,6 @@ KityMinder.registerModule( "TextEditModule", function () {
},
"events": {
'normal.beforemousedown textedit.beforemousedown':function(e){
if(e.isRightMB()){
e.stopPropagationImmediately();
return;
......
......@@ -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() );
}
......
......@@ -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;
......
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