← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18392: GIS mouse event handler bug fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 18392 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-02-24 17:07:31 +0100
message:
  GIS mouse event handler bug fixed.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js	2015-02-24 15:35:20 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js	2015-02-24 16:06:51 +0000
@@ -222,13 +222,15 @@
         };
 
         layer.registerMouseDownEvent = function() {
+
+            // clear mousedown listeners
+            if (layer.events && layer.events.listeners && Ext.isArray(layer.events.listeners.mousedown)) {
+                layer.events.listeners.mousedown = [];
+            }
+
             layer.events.register('mousedown', null, layer.onMouseDown);
         };
 
-        layer.unregisterMouseDownEvent = function() {
-            layer.events.unregister('mousedown', null, layer.onMouseDown);
-        };
-
 		defaultHoverSelect = function fn(feature) {
             if (isBoundary) {
                 var style = layer.core.getDefaultFeatureStyle();
@@ -272,15 +274,13 @@
 
 		defaultHoverUnselect = function fn(feature) {
 			defaultHoverWindow.destroy();
-
-            // remove mouse click event
-            layer.unregisterMouseDownEvent();
-
-            // destroy popups
-            //destroyDataPopups();
 		};
 
         defaultLeftClickSelect = function fn(feature, e) {
+            if (!feature) {
+                return;
+            }
+
             var generator = gis.init.periodGenerator,
                 periodType = gis.init.systemSettings.infrastructuralPeriodType.name,
                 attr = feature.attributes,