Fix event registration event capture during drag.

This commit is contained in:
Paulo Gustavo Veiga 2012-03-23 08:43:07 -03:00
parent 56e57cab75
commit 5496b9b076
4 changed files with 20 additions and 11 deletions

View File

@ -28,6 +28,10 @@ mindplot.NodeGraph = new Class({
this._size = {width:50,height:20};
},
isReadOnly : function(){
return this._options.readOnly;
},
getType : function() {
var model = this.getModel();
return model.getType();

View File

@ -34,7 +34,7 @@ mindplot.Topic = new Class({
}
// Register events for the topic ...
if (!options.readOnly) {
if (!this.isReadOnly()) {
this._registerEvents();
}
},
@ -50,7 +50,7 @@ mindplot.Topic = new Class({
this.addEvent('dblclick', function (event) {
this._getTopicEventDispatcher().show(this);
event.stopPropagation(true);
event.stopPropagation();
}.bind(this));
},
@ -134,7 +134,7 @@ mindplot.Topic = new Class({
this._setBorderColor(brColor, false);
// Define the pointer ...
if (this.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
if (this.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE && !this.isReadOnly()) {
this._innerShape.setCursor('move');
} else {
this._innerShape.setCursor('default');
@ -584,6 +584,8 @@ mindplot.Topic = new Class({
// Focus events ...
elem.addEvent('mousedown', function(event) {
if (!this.isReadOnly()) {
// Disable topic selection of readOnly mode ...
var value = true;
if ((event.meta && Browser.Platform.mac) || (event.control && !Browser.Platform.mac)) {
value = !this.isOnFocus();
@ -591,9 +593,12 @@ mindplot.Topic = new Class({
event.preventDefault();
}
topic.setOnFocus(value);
}
var eventDispatcher = this._getTopicEventDispatcher();
eventDispatcher.process(mindplot.TopicEvent.CLICK, this);
event.stopPropagation();
}.bind(this));
},

View File

@ -48,6 +48,7 @@ mindplot.TopicEventDispatcher = new Class({
},
process : function(eventType, topic, options) {
$assert(eventType, "eventType can not be null");
// Close all previous open editor ....
if (this.isVisible()) {

View File

@ -4,8 +4,7 @@
<head>
<base href="../">
<title>WiseMapping - Editor </title>
<meta http-equiv="Content-type" content="text/html; char
set=UTF-8"/>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
<!--[if lt IE 9]>
<meta http-equiv="X-UA-Compatible" content="chrome=1">