← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17987: GIS app/plugin fix.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 17987 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-01-14 14:49:54 +0100
message:
  GIS app/plugin fix.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.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/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2014-12-02 16:00:36 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2015-01-14 13:49:18 +0000
@@ -8762,6 +8762,7 @@
 			map: gis.olmap,
 			fullSize: true,
 			cmp: [defaultButton],
+            trash: [],
 			toggleCmp: function(show) {
 				for (var i = 0; i < this.cmp.length; i++) {
 					if (show) {

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js	2015-01-14 13:00:40 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js	2015-01-14 13:49:18 +0000
@@ -1759,14 +1759,15 @@
             });
 
             defaultHoverWindow.show();
+            gis.viewport.centerRegion.trash.push(defaultHoverWindow);
 
             var eastX = gis.viewport.eastRegion.getPosition()[0],
                 centerX = gis.viewport.centerRegion.getPosition()[0],
                 centerRegionCenterX = centerX + ((eastX - centerX) / 2),
-                centerRegionY = gis.viewport.centerRegion.getPosition()[1] + (GIS.app ? 32 : 0),
+                centerRegionY = gis.viewport.centerRegion.getPosition()[1] + (gis.plugin ? 0 : 32),
 
-		x = centerRegionCenterX - (defaultHoverWindow.getWidth() / 2),
-		y = centerRegionY;
+                x = centerRegionCenterX - (defaultHoverWindow.getWidth() / 2),
+                y = centerRegionY;
 
             defaultHoverWindow.setPosition(x, y);
         };
@@ -6935,7 +6936,8 @@
                 eastRegion,
                 centerRegion,
                 el = Ext.get(gis.el),
-                eastWidth = gis.map.hideLegend ? 0 : (gis.plugin ? 120 : 200);
+                eastWidth = gis.map.hideLegend ? 0 : (gis.plugin ? 120 : 200),
+                trash = [];
 
             viewport = Ext.create('Ext.panel.Panel', {
                 renderTo: el,
@@ -7040,6 +7042,17 @@
             viewport.centerRegion = centerRegion;
             viewport.eastRegion = eastRegion;
 
+            viewport.centerRegion.trash = trash;
+            viewport.centerRegion.getEl().on('mouseleave', function() {
+                for (var i = 0, cmp; i < trash.length; i++) {
+                    cmp = viewport.centerRegion.trash[i];
+
+                    if (cmp && cmp.destroy) {
+                        cmp.destroy();
+                    }
+                }
+            });
+
             return viewport;
         };