Opened 16 years ago

Closed 15 years ago

Last modified 15 years ago

#68 closed defect (fixed)

Resizing bigmap; missing px units

Reported by: rjwalker Owned by: geonetwork-devel@…
Priority: minor Milestone: v2.4.0 RC2
Component: Web Map Viewer Version: v2.2.0 Final
Keywords: Cc:

Description

When the map viewer (bigmap) is resized, the width and height attributes are updated, but not correctly - the units (px) are not included. I've not seen a problem with "out-of-the-box" GN, but in my own local use of this code, there is a problem in Firefox 2 - the map doesn't resize correctly. Adding 'px' to the end of the sizes fixed the problem.

Although the current code does work "out-of-the-box" on IE and Firefox, I recommend applying the patch anyway because:

  1. The current code is simply wrong - CSS requires the units to be specified (the only exception being when the magnitude is zero).
  2. The current code doesn't match the rest of the JavaScript, which correctly appends "px" when changing width and height attributes.

Attachments (1)

gnp5.txt (1.0 KB ) - added by rjwalker 16 years ago.

Download all attachments as: .zip

Change History (5)

by rjwalker, 16 years ago

Attachment: gnp5.txt added

comment:1 by rjwalker, 16 years ago

im_markers.js is also affected by the same problem. Patch included below.

--- ../im_markers.js    2008-03-27 15:40:52.000000000 +1100
+++ im_markers.js-o     2008-07-01 15:00:39.000000000 +1000
@@ -55,8 +55,8 @@
        img.src = '/intermap/images/marker.gif'; // FIXME context
        // FIXME the image should be centered on the mouse click
 
-       img.style.left = pointerX - 6;
-       img.style.top = pointerY - 21;           
+       img.style.left = pointerX - 6 + "px";
+       img.style.top = pointerY - 21 + "px";           
        document.body.appendChild(img);    
 
 
@@ -320,8 +320,8 @@
        img.title = title;
 
        // FIXME the image should be centered on the coords
-       img.style.left = x - 6;
-       img.style.top  = y - 21;
+       img.style.left = x - 6 + "px";
+       img.style.top  = y - 21 + "px";
 
     parent.appendChild(img);
 

comment:2 by rjwalker, 16 years ago

Further investigation:

A while back I added a DOCTYPE declaration to the HTML generated by my local installation. It seems that this is the cause - it puts the browser into "strict" mode, where units must be supplied to lengths. Without the DOCTYPE, the browser is in "quirks" mode, where it supplies "px" if the units are missing.

See http://www.quirksmode.org/css/quirksmode.html for details.

Because GN currently does not include DOCTYPEs "out-of-the-box", it seems the problem would not normally occur. (But the JS code is still wrong.)

comment:3 by ticheler, 15 years ago

Resolution: fixed
Status: newclosed

+ "px" has been added in the two files

comment:4 by ticheler, 15 years ago

Milestone: v2.4.0 RC2
Note: See TracTickets for help on using tickets.