diff options
author | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
commit | ea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch) | |
tree | af67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/tests/manual/select-feature-right-click.html | |
parent | 59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff) | |
download | postrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip |
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/tests/manual/select-feature-right-click.html')
-rw-r--r-- | misc/openlayers/tests/manual/select-feature-right-click.html | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/misc/openlayers/tests/manual/select-feature-right-click.html b/misc/openlayers/tests/manual/select-feature-right-click.html new file mode 100644 index 0000000..edd79d6 --- /dev/null +++ b/misc/openlayers/tests/manual/select-feature-right-click.html @@ -0,0 +1,86 @@ +<html> + <head> + <title>OpenLayers Ticket 3404</title> + <script src="../../lib/OpenLayers.js"></script> + </head> + <body> + <table cellpadding="10px"> + <tr> + <td width="600"> + <p><a href="http://trac.osgeo.org/openlayers/ticket/3404">Ticket 3404</a> Test Page</p> + <p>This bug is only triggered by physical right mouse clicks so it is not possible to write + an automated js unit test</p> + <p>When a SelectFeature control and a Navigation control are added to a map the left-click + mousedown events are stopped by a Drag handler before reaching the Feature handler. However, + right-click mousedown events so pass through and reach the Feature handler.</p> + <p>The Feature handler records the xy of + each mousedown and mouseup events so they can be compared in the click event. Because only right-click + mousedown event are received the location of future left-click mouseup events are compared + to the location of the 'stale' right-click mousedown event resulting in the feature not being selected.</p> + <p>Steps to recreate the bug: + <ol> + <li>Left-click a point to select it.</li> + <li>Left-click the map to deselect the point.</li> + <li>Left-click a different point to select it.</li> + <li>Left-click the map to deselect the second point.</li> + <li>Right-click the map then left-click to close the browser context menu.</li> + <li>Left-click a point.</li> + </ol> + </p> + <p>Expected: The point is selected.</p> + </td> + <td> + <div style="width:300; height:400" id="map"></div> + </td> + </tr> + </table> + + <script defer="defer" type="text/javascript"> + var map = new OpenLayers.Map('map'); + + var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS", + "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} ); + + // allow testing of specific renderers via "?renderer=Canvas", etc + var renderer = OpenLayers.Util.getParameters(window.location.href).renderer; + renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers; + + var vectorLayer = new OpenLayers.Layer.Vector("Vector Layer", { + renderers: renderer + }); + + map.addLayers([wmsLayer, vectorLayer]); + map.addControl(new OpenLayers.Control.LayerSwitcher()); + + var selectControl = new OpenLayers.Control.SelectFeature( + vectorLayer, + { + clickout: true, toggle: false, + multiple: false, hover: false, + toggleKey: "ctrlKey", // ctrl key removes from selection + multipleKey: "shiftKey", // shift key adds to selection + } + ); + + map.addControl(selectControl); + selectControl.activate(); + + map.addControl(new OpenLayers.Control.Navigation()); + map.setCenter(new OpenLayers.LonLat(-75.1641667, 39.9522222), 10); + + var createRandomFeatures = function() { + var extent = map.getExtent(); + var features = []; + for(var i=0; i<10; ++i) { + features.push(new OpenLayers.Feature.Vector( + new OpenLayers.Geometry.Point(extent.left + (extent.right - extent.left) * Math.random(), + extent.bottom + (extent.top - extent.bottom) * Math.random() + ))); + } + return features; + } + + vectorLayer.addFeatures(createRandomFeatures()); + </script> + </body> +</html> |