[OpenLayers-Dev] Bug in PanZoomBar Control / Viewport Element

Barbara Philippot bphilippot at orupaca.fr
Thu Sep 6 00:24:00 PDT 2012


Hi all,

I have a problem with PanZoomBar Control when map is inserted at bottom of
page and when a scrollbar appears in Firefox : a click in the div zoomBar
zooms at the maximum level zoom. No problem with Chrome and no problem when
map is inserted at top of page without scrollbar.

I find out that in the OnButtonClick method of the PanZoomBar control,
evt.buttonXY.y returns a bad value (line 280) (position of the click in the
page instead of zero), linked to the OpenLayers.Util.pagePosition function
in buttonclick.js (line 152). When getting the viewportElement, in Firefox
document.documentElement is always returned.
The matter is when the Document Type Declaration in the HTML file is
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">"
, document.compatMode returns "CSS1Compat" and viewportElement.scrollTop
returns a bad value. (line 1189 of Util.js)

The bug can be reproduced in the HTML file joined with Firefox ( link to
OpenLayers lib must be changed ). If you remove the DTD or if you put map
div at top of page or if you launch it in Chrome, PanZoomBar control works
well.
The patch joined resolves the problem returning document.body instead of
documentElement when compatMode is 'CSS1Compat' and browser FireFox but
it's likely this isn't the best method... what do you think about it ?


Regards,


Barbara PHILIPPOT
Géomaticienne
Observatoire Régional des Urgences PACA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20120906/cdc54221/attachment.html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20120906/cdc54221/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_util_viewport.diff
Type: application/octet-stream
Size: 671 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20120906/cdc54221/attachment.obj>


More information about the Dev mailing list