[mapguide-commits] r6246 - in trunk/MgDev/Oem/fusionMG/templates/mapguide: aqua limegold maroon slate turquoiseyellow

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Nov 22 21:58:47 EST 2011


Author: sparkliu
Date: 2011-11-22 18:58:47 -0800 (Tue, 22 Nov 2011)
New Revision: 6246

Modified:
   trunk/MgDev/Oem/fusionMG/templates/mapguide/aqua/index.html
   trunk/MgDev/Oem/fusionMG/templates/mapguide/limegold/index.html
   trunk/MgDev/Oem/fusionMG/templates/mapguide/maroon/index.html
   trunk/MgDev/Oem/fusionMG/templates/mapguide/slate/index.html
   trunk/MgDev/Oem/fusionMG/templates/mapguide/turquoiseyellow/index.html
Log:
Fix ticket #1865 - showTaskPane is called multiple times when switching maps

showTaskPane will be called multiple times for loading a map after a map has been switching for several times.

This is because index page register MAP_LOAD event to register TASK_PANE_LOADED event. After MAP_LOAD event is triggered several times, the same function is registered to TASK_PANE_LOADED event with exactly same number. This is not as expected. We just want showTaskPane be called once when TASK_PANE_LOADED is triggered for one time.

We should remove the MAP_LOAD event registering after TASK_PANE_LOADED is registered.

It seems registering TASK_PANE_LOADED directly when fusion is initialized is a better way. But there is a slice difference between fusion loaded and map loaded. If registering in fusion loaded, task pane will always show when map loaded. But if registering in map loaded, task pane will show AFTER map is loaded for the first time. Maybe the original submission wants the latter way. So we don't change this thing.

Modified: trunk/MgDev/Oem/fusionMG/templates/mapguide/aqua/index.html
===================================================================
--- trunk/MgDev/Oem/fusionMG/templates/mapguide/aqua/index.html	2011-11-22 15:11:53 UTC (rev 6245)
+++ trunk/MgDev/Oem/fusionMG/templates/mapguide/aqua/index.html	2011-11-23 02:58:47 UTC (rev 6246)
@@ -180,6 +180,11 @@
 var initPanelHandler = function() {
     //register this with MAP_LOADED so that the initial layout will remain
     Fusion.registerForEvent(Fusion.Event.TASK_PANE_LOADED, showTaskPane);
+
+    // The initPanelHandler is used to register task pane, which only needs once.
+    // So we should remove the register to avoid initPanelHandler to be called multiple times.
+    var mapWidget = Fusion.getMapById('Map');
+    mapWidget.deregisterForEvent(Fusion.Event.MAP_LOADED, initPanelHandler);
 }
 
 var showOverviewMap = function() {

Modified: trunk/MgDev/Oem/fusionMG/templates/mapguide/limegold/index.html
===================================================================
--- trunk/MgDev/Oem/fusionMG/templates/mapguide/limegold/index.html	2011-11-22 15:11:53 UTC (rev 6245)
+++ trunk/MgDev/Oem/fusionMG/templates/mapguide/limegold/index.html	2011-11-23 02:58:47 UTC (rev 6246)
@@ -167,6 +167,11 @@
 var initPanelHandler = function() {
     //register this with MAP_LOADED so that the initial layout will remain
     Fusion.registerForEvent(Fusion.Event.TASK_PANE_LOADED, showTaskPane);
+
+    // The initPanelHandler is used to register task pane, which only needs once.
+    // So we should remove the register to avoid initPanelHandler to be called multiple times.
+    var mapWidget = Fusion.getMapById('Map');
+    mapWidget.deregisterForEvent(Fusion.Event.MAP_LOADED, initPanelHandler);
 }
 
 var showOverviewMap = function() {

Modified: trunk/MgDev/Oem/fusionMG/templates/mapguide/maroon/index.html
===================================================================
--- trunk/MgDev/Oem/fusionMG/templates/mapguide/maroon/index.html	2011-11-22 15:11:53 UTC (rev 6245)
+++ trunk/MgDev/Oem/fusionMG/templates/mapguide/maroon/index.html	2011-11-23 02:58:47 UTC (rev 6246)
@@ -189,6 +189,11 @@
 var initPanelHandler = function() {
     //register this with MAP_LOADED so that the initial layout will remain
     Fusion.registerForEvent(Fusion.Event.TASK_PANE_LOADED, showTaskPane);
+
+    // The initPanelHandler is used to register task pane, which only needs once.
+    // So we should remove the register to avoid initPanelHandler to be called multiple times.
+    var mapWidget = Fusion.getMapById('Map');
+    mapWidget.deregisterForEvent(Fusion.Event.MAP_LOADED, initPanelHandler);
 }
 
 var showOverviewMap = function() {

Modified: trunk/MgDev/Oem/fusionMG/templates/mapguide/slate/index.html
===================================================================
--- trunk/MgDev/Oem/fusionMG/templates/mapguide/slate/index.html	2011-11-22 15:11:53 UTC (rev 6245)
+++ trunk/MgDev/Oem/fusionMG/templates/mapguide/slate/index.html	2011-11-23 02:58:47 UTC (rev 6246)
@@ -170,6 +170,11 @@
 var initPanelHandler = function() {
     //register this with MAP_LOADED so that the initial layout will remain
     Fusion.registerForEvent(Fusion.Event.TASK_PANE_LOADED, showTaskPane);
+
+    // The initPanelHandler is used to register task pane, which only needs once.
+    // So we should remove the register to avoid initPanelHandler to be called multiple times.
+    var mapWidget = Fusion.getMapById('Map');
+    mapWidget.deregisterForEvent(Fusion.Event.MAP_LOADED, initPanelHandler);
 }
 
 var showOverviewMap = function() {

Modified: trunk/MgDev/Oem/fusionMG/templates/mapguide/turquoiseyellow/index.html
===================================================================
--- trunk/MgDev/Oem/fusionMG/templates/mapguide/turquoiseyellow/index.html	2011-11-22 15:11:53 UTC (rev 6245)
+++ trunk/MgDev/Oem/fusionMG/templates/mapguide/turquoiseyellow/index.html	2011-11-23 02:58:47 UTC (rev 6246)
@@ -155,6 +155,11 @@
 var initPanelHandler = function() {
     //register this with MAP_LOADED so that the initial layout will remain
     Fusion.registerForEvent(Fusion.Event.TASK_PANE_LOADED, showTaskPane);
+
+    // The initPanelHandler is used to register task pane, which only needs once.
+    // So we should remove the register to avoid initPanelHandler to be called multiple times.
+    var mapWidget = Fusion.getMapById('Map');
+    mapWidget.deregisterForEvent(Fusion.Event.MAP_LOADED, initPanelHandler);
 }
 
 var showOverviewMap = function() {



More information about the mapguide-commits mailing list