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}; this._size = {width:50,height:20};
}, },
isReadOnly : function(){
return this._options.readOnly;
},
getType : function() { getType : function() {
var model = this.getModel(); var model = this.getModel();
return model.getType(); return model.getType();

View File

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

View File

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

View File

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