1 <html xmlns="http://www.w3.org/1999/xhtml">
3 <title>Feature Handler Acceptance Test</title>
4 <style type="text/css">
31 border: 1px solid gray;
36 <script src="../../lib/OpenLayers.js"></script>
37 <script type="text/javascript">
39 var map, draw, handler, controls;
40 OpenLayers.Feature.Vector.style['default']['strokeWidth'] = '2';
43 map = new OpenLayers.Map('map');
45 var vectors = new OpenLayers.Layer.Vector(
49 map.addLayer(vectors);
52 draw = new OpenLayers.Control.DrawFeature(
53 vectors, OpenLayers.Handler.Polygon
58 "over": function(feature) {
59 log("over " + feature.id);
61 "out": function(feature) {
62 log("out " + feature.id);
64 "click": function(feature) {
65 log("click " + feature.id);
67 "dblclick": function(feature) {
68 log("dblclick " + feature.id);
70 "clickout": function(feature) {
71 log("clickout " + feature.id);
75 handler = new OpenLayers.Handler.Feature(
76 {map: map}, vectors, callbacks
79 map.setCenter(new OpenLayers.LonLat(0, 0), 3);
84 document.getElementById('output').value += msg + "\n";
88 document.getElementById('output').value = "";
93 <body onload="init()">
97 Draw a few polygons on the map. Some overlapping. Activate the
98 feature handler and ensure that "over" and "out" are called only
99 when mousing over/out of a feature for the first time. The
100 "click" callback should be called for every click on a feature.
101 The "clickout" callback should be called when?
107 <input type="radio" name="type" value="none" id="noneToggle"
108 onclick="draw.deactivate();handler.deactivate();" checked="checked" />
109 <label for="noneToggle">navigate</label>
112 <input type="radio" name="type" value="polygon" id="polygonToggle"
113 onclick="draw.activate();handler.deactivate();" />
114 <label for="polygonToggle">draw polygon</label>
117 <input type="radio" name="type" value="feature" id="featureToggle"
118 onclick="draw.deactivate();handler.activate();" />
119 <label for="featureToggle">activate feature handler</label>
122 <button onclick="clearLog();">clear log</button><br />
123 <textarea id="output"></textarea>