From 78f312ef0ad0201bde8631a31986625a1302d264 Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Mon, 15 Aug 2011 09:27:31 -0300 Subject: [PATCH] - Fix problem selecting central node. --- mindplot/src/main/javascript/CentralTopic.js | 12 ++++++++++++ mindplot/src/main/javascript/NodeGraph.js | 6 +----- mindplot/src/main/javascript/Topic.js | 10 ++++++++++ .../main/javascript/layout/OriginalLayoutManager.js | 3 --- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/mindplot/src/main/javascript/CentralTopic.js b/mindplot/src/main/javascript/CentralTopic.js index 6534a9e4..ff594145 100644 --- a/mindplot/src/main/javascript/CentralTopic.js +++ b/mindplot/src/main/javascript/CentralTopic.js @@ -21,6 +21,18 @@ mindplot.CentralTopic = new Class({ Extends:mindplot.Topic, initialize: function(model) { this.parent(model); + this.registerEvents(); + }, + + registerEvents : function() { + // Prevent click on the topics being propagated ... + this.addEventListener('click', function(event) { + event.stopPropagation(); + }); + + this.addEventListener('mousedown', function(event) { + event.stopPropagation(); + }); }, workoutIncomingConnectionPoint : function(sourcePosition) { diff --git a/mindplot/src/main/javascript/NodeGraph.js b/mindplot/src/main/javascript/NodeGraph.js index e46c64eb..fdae6747 100644 --- a/mindplot/src/main/javascript/NodeGraph.js +++ b/mindplot/src/main/javascript/NodeGraph.js @@ -38,7 +38,7 @@ mindplot.NodeGraph = new Class({ }, get2DElement : function() { - $assert(this._elem2d, 'NodeGraph has not been initialized propertly'); + $assert(this._elem2d, 'NodeGraph has not been initialized properly'); return this._elem2d; }, @@ -54,10 +54,6 @@ mindplot.NodeGraph = new Class({ elem.addEventListener(type, listener); }, - isNodeGraph : function() { - return true; - }, - setMouseEventsEnabled : function(isEnabled) { this._mouseEvents = isEnabled; }, diff --git a/mindplot/src/main/javascript/Topic.js b/mindplot/src/main/javascript/Topic.js index 05eb5c4c..facefd09 100644 --- a/mindplot/src/main/javascript/Topic.js +++ b/mindplot/src/main/javascript/Topic.js @@ -35,6 +35,16 @@ mindplot.Topic = new Class({ if (pos != null && model.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) { this.setPosition(pos); } + + this.registerEvents(); + }, + + registerEvents:function () { + + // Prevent click on the topics being propagated ... + this.addEventListener('click', function(event) { + event.stopPropagation(); + }); }, setShapeType : function(type) { diff --git a/mindplot/src/main/javascript/layout/OriginalLayoutManager.js b/mindplot/src/main/javascript/layout/OriginalLayoutManager.js index 8ddd55ef..eaeebdbd 100644 --- a/mindplot/src/main/javascript/layout/OriginalLayoutManager.js +++ b/mindplot/src/main/javascript/layout/OriginalLayoutManager.js @@ -126,9 +126,6 @@ mindplot.layout.OriginalLayoutManager = new Class({ var designer = this.getDesigner(); topic.addEventListener('click', function(event) { designer.onObjectFocusEvent(topic, event); - - // Prevent click on the topics being propagated ... - event.stopPropagation(); }); // Add drag behaviour ...