Ticket #1268 (new feature)

Opened 5 years ago

Last modified 4 years ago

getPixelFromEvent fails in some cases (margin, border, text-align)

Reported by: crschmidt Owned by: euzuro
Priority: minor Milestone: 2.13 Release
Component: Events Version: 2.5
Keywords: Cc:
State:

Description

IE's different CSSSS model means that there are some cases where IE fails to report the correct mouse position. This can be seen in a number of ways -- digitizing features, mouseposition control, etc. Typically, these problems can be solved by using different CSS.

The CSS properties which have been reported to cause problems:

  • Border on map element
  • Margin on map element
  • text-align on map element

The code to fix/improve is OpenLayers.Events.getMousePosition, and possibly OpenLayers.Util.getPagePosition.

There is no firm plan to fix this in the short term.

Change History

Changed 5 years ago by pgiraud

  • summary changed from getPixelFromEvent fails in some cases in IE (margin, border, text-align) to getPixelFromEvent fails in some cases (margin, border, text-align)

This doesn't only happen with IE.

The following example code includes a map with a cross drawn at lonlat(0,0) but the coordinates shown in the mousePosition control differ from the expected ones.

            map = new OpenLayers.Map('map');
            var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
                    "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
            map.addLayer(layer);

            vectorLayer = new OpenLayers.Layer.Vector();
            
            var line = new OpenLayers.Geometry.LineString([
                new OpenLayers.Geometry.Point(0, -10),
                new OpenLayers.Geometry.Point(0, 10)
            ]);
            var feature = new OpenLayers.Feature.Vector(line);
            vectorLayer.addFeatures([feature]);
            
            var line = new OpenLayers.Geometry.LineString([
                new OpenLayers.Geometry.Point(-10, 0),
                new OpenLayers.Geometry.Point(10, 0)
            ]);
            var feature = new OpenLayers.Feature.Vector(line);
            vectorLayer.addFeatures([feature]);

            map.addLayer(vectorLayer);
            map.zoomToMaxExtent();
            map.addControl(new OpenLayers.Control.MousePosition());

Changed 5 years ago by euzuro

  • milestone changed from 2.7 Release to 2.8 Release

Mass ticket move out of 2.7 in preparation for a release plan.

If you are actively working on this task, and think that you can help this ticket to get finished and closed by September 1, please move it back to 2.7.

Changed 4 years ago by crschmidt

  • milestone changed from 2.8 Release to 2.9 Release

Moving all tickets which have not been touched since 2.7 to 2.9.

Note: See TracTickets for help on using tickets.