The approach to reposition the map overview control I found here on
the
forum does not appear to work after API version 2.92.  Specifically,

1) MSIE-8 beta 2 FAILs to reposition the map overview control with any
known Maps API version. MSIE-7 also does not work, but I only tested
API v2.x

2) Firefox, Safari, Opera, Netscape, and Chrome will only reposition
using older Maps API version 2.92

3) All browsers FAIL to reposition using API version 2.141 or 2.x or
any version higher than 2.92  because the autogenerated
"map_canvas_overview" DIV cannot be accessed by getElementById() which
returns NULL

4) Chrome, MSIE-8, and Safari do not display the repositioned control
properly unless you force a redraw...but that's easily fixed by hide/
show.

Here is an updated example that was adapted from previous group code.
I didn't find any discussions or solutions for API after v2.92.
Has anyone found a solution or workaround using v2.x or v2.141 ?

-----------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title>Map Overview Repositioned</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>

<style type="text/css">
   body {background-color: #00FF00; margin: 10px; 10px 10px 10px;}
   h1 {font-size: 22px; color: blue; margin: 0px; padding: 0px;}
</style>

<script type="text/JavaScript">
   
//--------------------------------------------------------------------------------
   // Credits: This code was adapted from an example at:
   //    http://koti.mbnet.fi/ojalesa/exam/overshwhide.html

   
//--------------------------------------------------------------------------------
   // Substitute your own Google API key here
   //
   var g_sYourKey =
'key=ABQIAAAAYxpy0HiKBWXiyhVrpVqkshTWg_xmhpETXrjHUj59zHLsinrq_xSAmA
GIHF6kJpo3mJn5WnKDztG7kw';

   
//--------------------------------------------------------------------------------------
   // Only MSIE cannot reposition the map overview control correctly
with any known API
   //
   var g_bAttemptReposition = true;
   var g_sAgent = navigator.userAgent.toLowerCase();
   if (g_sAgent.indexOf('msie') >= 0)
   {
      // Display modal dialog with [Ok] and [Cancel] buttons
      g_bAttemptReposition = confirm('WARNING:'
                                    + ' The MSIE browser has problems
when trying to reposition the map overview control.'
                                    + ' Press [Ok] to see how MSIE
fails using Google Maps v2.x or press [Cancel]'
                                    + ' to disable map overview
control repositioning for MSIE.');
   }

   
//--------------------------------------------------------------------------------------
   // Select Google API version to load
   //
   var sVersion = '2.x';
   if (g_bAttemptReposition)
   {
      var sMessage;
      var sVersion;
      if (g_sAgent.indexOf('msie') >= 0)
      {
         sMessage = 'Since MSIE-8 fails to reposition the map overview
control with any version of the'
                  + ' Google Maps API, we default to using 2.x but you
can specify a different API version.';
         sVersion = '2.x';
      }
      else
      {
         sMessage = 'Google Maps API 2.92 is required for non-MSIE
browsers. Using version 2.93 thru 2.141'
                  + ' or version 2.x will NOT correctly reposition the
map overview control. Please specify'
                  + ' the API version you wish to use.';
         sVersion = '2.92';
      }

      // Display modal dialog with INPUT field
      sVersion = prompt(sMessage,sVersion);
   }

   
//--------------------------------------------------------------------------------------
   // Load the desired Google API version
   document.write('<scr'+'ipt src="http://maps.google.com/maps?
file=api&v='
                + sVersion
                + '&'
                + g_sYourKey
                + '" type="text/javascript"\></script\>');

   
//--------------------------------------------------------------------------------------
   // Global variables
   var g_oMapCanvasDiv = null;
   var g_oOverviewCtrl = null;

   
//--------------------------------------------------------------------------------------
   // Firefox, Opera, Netscape don't need this function to redraw the
map overview control
   // because the control is already correctly displayed. However,
MSIE, Chrome, and Safari
   // do not display properly until the repositioned map overview
control is refreshed.
   //
   function RedrawOverview()
   {
      g_oOverviewCtrl.hide();
      g_oOverviewCtrl.show();
   }

   
//--------------------------------------------------------------------------------------
   // Sometimes, you may want to have the map overview control
positioned outside of the
   // primary map, rather than at the default BOTTOM-RIGHT position
inside the primary.
   // But repositioning the overview control exposes a problem with
the arrow placement.
   //
   // Move the map overview control into a separate container. This is
necessary to fix
   // the problem where the "overexpand.gif" arrow is incorrectly
displayed in the UPPER-LEFT
   // corner when the overview is collapsed (minimized). The
"overcontract.gif" arrow is
   // always displayed in the BOTTOM-RIGHT corner.
   //
   function RepositionOverview()
   {
      var oOverviewElement = document.getElementById
("map_canvas_overview");
      if (oOverviewElement)
      {
         // Reposition the map overview control
         var oElement = g_oMapCanvasDiv.removeChild(oOverviewElement);
         document.getElementById("overview_container").appendChild
(oElement);

         // Redraw the map overview control now that it has been moved
         setTimeout("RedrawOverview()", 1);     // 4000
      }
      else
      {
         alert('ERROR: Unable to get the "map_canvas_overview" DIV
element, but using the'
             + ' MSIE-8 developer tools we can clearly see that the
DIV exists.'
             + ' Why does this DIV have the "unselectable="on"
attribute? Using Firefox'
             + ' this problem also occurs with API version 2.141 and
with Firebug we'
             + ' can observe the DIV exists but has "-moz-user-select:
none" styleattribute.');
      }
   }

   
//--------------------------------------------------------------------------------------
   function MapInit()
   {
      // Construct the Map
      g_oMapCanvasDiv = document.getElementById("map_canvas");
      var oPrimaryMap = new GMap2(g_oMapCanvasDiv);
      oPrimaryMap.addControl(new GMapTypeControl());
      oPrimaryMap.addControl(new GLargeMapControl());
      oPrimaryMap.setCenter(new GLatLng(34.007810995105984,
-118.48304271697998),14,G_HYBRID_MAP);

      // Add the Map Overview Control
      g_oOverviewCtrl = new GOverviewMapControl(new GSize(200, 200));
      oPrimaryMap.addControl(g_oOverviewCtrl);

      if (g_bAttemptReposition)
      {
         setTimeout("RepositionOverview()", 1);       // or 2000
      }
   }
</script>
</head>

<body onload="MapInit()" onunload="GUnload()">

<h1>Description:</h1>
<p>This example attempts to reposition the <b>Map Overview Control</b>
window outside of
the primary map. Using the optional GControlPosition parameter to
reposition outside the
primary map causes the "overexpand.gif" <img src="http://
maps.google.com/intl/en_ALL/mapfiles/overcontract.gif">
arrow to be placed at the TOP-LEFT corner when the control is
minimized. Using a separate DIV
container seems to fix that problem but expose others.</p>

<h1>Notes:</h1>
<ul>
   <li><b>MSIE-8 beta 2 FAILs</b> to reposition the map overview
control with any known Maps API version</li>
   <li>Firefox, Safari, Opera, Netscape, and Chrome will <b>only</b>
reposition using older Maps API version 2.92</li>
   <li><b>All browsers FAIL to reposition using API version 2.141 or
2.x or any version higher than 2.92</b>
       because the autogenerated "map_canvas_overview" DIV cannot be
accessed by getElementById() which returns NULL</li>
   <li>Chrome, MSIE-8, and Safari do not display the repositioned
control properly unless you
       force a redraw.</li>
</ul>

<div id="map_canvas" style="position: absolute; top:300px; left:300px;
width: 500px; height: 400px; border:1px solid blue;">Map loading...</
div>

<div id="overview_container" style="position: absolute; top:300px;left:
50px; width:206px; height:206px; border:1px solid blue;"></div>

<div style="position: absolute; top:520px; left:50px; width:280px;
text-align:left">
   <h1>Current Maps API:</h1>
   <script type="text/JavaScript">
      document.write('<p>' + sVersion + '</p>');
   </script>
   <h1>Browsers Tested:</h1>
   <p>
   Firefox 3.0.5<br>
   Safari 3.1.2 (525.21)<br>
   Opera 9.62<br>
   Netscape 9.0.0.5<br>
   Chrome 1.0.154.36<br>
   MSIE-7.<br>
   MSIE-8 beta 2 (8.0.6001.18241)
   </p>
   <h1>Platform Used:</h1>
   <p>Windows XP Pro SP2</p>
</div>

</body>
</html>
html>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to