Ticket #2659 (new bug)

Opened 3 years ago

Last modified 3 years ago

Seems 2414 not fixed

Reported by: ol Owned by:
Priority: major Milestone: Future
Component: Map Version: SVN
Keywords: Cc:
State:

Description

Apparently bug #2414 is still not fixed. Loading a map into this div

<div style="position:relative; width:768px; margin-left:auto; margin-right:auto;">
   <div id="map" style="position:absolute; height:576px; left:0px; top:0px; bottom:0px; right:0px; display:none; background-color:#C8C8C8"></div>
   <a href="P1170444.html" id="imagelink">
      <IMG id="image" SRC="P1170442.jpg" width="768" height="576" border="0">
   </a>
</div>
<br>
<FONT face="Verdana, Arial, Helvetica, Sans-Serif" size="-1">15.11.2008 17:13 - Würzburg - Augustinerkirche &ndash; </font>
<input type="submit" value="Karte" id="maptoggle" onclick="makemap(49.7960944444444,9.931275);" >
<br>

I get this trace back in Opera and similar in IE8

message: Statement on line 1441: Cannot convert undefined or null to Object
stacktrace:   Line 1441 of linked script http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/op/openlayers/lib/OpenLayers/Map.js
                var w_deg = size.w * resolution;
  Line 1011 of linked script http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/op/openlayers/lib/OpenLayers/Layer.js
            return this.map.calculateBounds();
  Line 1946 of linked script http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/op/openlayers/lib/OpenLayers/Map.js
                extent = this.baseLayer.getExtent();
  Line 1706 of linked script http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/op/openlayers/lib/OpenLayers/Map.js
                var bounds = this.getExtent();
  Line 1594 of linked script http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/op/openlayers/lib/OpenLayers/Map.js
            this.moveTo(lonlat, zoom, {
  Line 64 of linked script http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/omap.js: In function makeMap
    			map.setCenter (lonLat, zoom);
  Line 6 of linked script http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/omap.js: In function makemap
          makeMap( lat, lon );
  Line 1 of function script 
    makemap(49.7960944444444,9.931275);

The same code works fine with OpenLayers 2.8

Attachments

omap.js Download (2.4 KB) - added by ol 3 years ago.
makemap

Change History

in reply to: ↑ description   Changed 3 years ago by ol

  • milestone changed from 2.9.1 Release to Future

Replying to ol:

I forgot the SVN rev:

Revision: 10367

Apparently bug #2414 is still not fixed. Loading a map into this div {{{ <div style="position:relative; width:768px; margin-left:auto; margin-right:auto;"> <div id="map" style="position:absolute; height:576px; left:0px; top:0px; bottom:0px; right:0px; display:none; background-color:#C8C8C8"></div> <a href="P1170444.html" id="imagelink"> <IMG id="image" SRC="P1170442.jpg" width="768" height="576" border="0"> </a> </div> <br> <FONT face="Verdana, Arial, Helvetica, Sans-Serif" size="-1">15.11.2008 17:13 - Würzburg - Augustinerkirche &ndash; </font> <input type="submit" value="Karte" id="maptoggle" onclick="makemap(49.7960944444444,9.931275);" > <br> }}} I get this trace back in Opera and similar in IE8 {{{ message: Statement on line 1441: Cannot convert undefined or null to Object stacktrace: Line 1441 of linked script  http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/op/openlayers/lib/OpenLayers/Map.js var w_deg = size.w * resolution; Line 1011 of linked script  http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/op/openlayers/lib/OpenLayers/Layer.js return this.map.calculateBounds(); Line 1946 of linked script  http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/op/openlayers/lib/OpenLayers/Map.js extent = this.baseLayer.getExtent(); Line 1706 of linked script  http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/op/openlayers/lib/OpenLayers/Map.js var bounds = this.getExtent(); Line 1594 of linked script  http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/op/openlayers/lib/OpenLayers/Map.js this.moveTo(lonlat, zoom, { Line 64 of linked script  http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/omap.js: In function makeMap map.setCenter (lonLat, zoom); Line 6 of linked script  http://orion/Mvcb/chorintern/chronik/wuerzburg_08/images/omap.js: In function makemap makeMap( lat, lon ); Line 1 of function script makemap(49.7960944444444,9.931275); }}} The same code works fine with OpenLayers 2.8

  Changed 3 years ago by bbinet

  • summary changed from Seems 2414 not fixed to updateSize should be called manually

If your makemap function remove "display:none" from the map div, then as stated in  http://trac.openlayers.org/ticket/2414#comment:10 you are now in charge of manually calling map.updateSize() so that the map can calculate its dimensions.

  Changed 3 years ago by bbinet

  • summary changed from updateSize should be called manually to Seems 2414 not fixed

Sorry I changed the ticket summary by mistake. So revert...

  Changed 3 years ago by ol

Thanks for the reply. Unfortunately, I couldn't figure out how to use updateSize so I removed the display:none before creating the map. Sort of defeats the purpose of the display:none but at least it's working again.

Nevertheless, and since it looks like a regression to me, I'd like to know how to do this properly. So I attach the makemap function in case someone wants to look at this more closely. Simpler solutions are also welcome.

Changed 3 years ago by ol

makemap

Note: See TracTickets for help on using tickets.