Changeset 3033
- Timestamp:
- 04/09/07 09:22:32 (2 years ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Control/PanZoom.js (modified) (1 diff)
- trunk/openlayers/tests/Control/test_PanZoom.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Control/PanZoom.js
r2965 r3033 105 105 OpenLayers.Event.observe(btn, "dblclick", 106 106 this.doubleClick.bindAsEventListener(btn)); 107 OpenLayers.Event.observe(btn, "click", 108 this.doubleClick.bindAsEventListener(btn)); 107 109 btn.action = id; 108 110 btn.map = this.map; trunk/openlayers/tests/Control/test_PanZoom.html
r2965 r3033 37 37 t.plan(0) 38 38 } else { 39 t.plan( 7);39 t.plan(35); 40 40 t.open_window( "Control/test_PanZoom.html", function( wnd ) { 41 41 t.delay_call( 3, function() { 42 simulateClick(wnd, wnd.control.buttons[0]); 42 var flag; 43 function setFlag(evt) { 44 flag[evt.type] = true; 45 } 46 function resetFlags() { 47 flag = { 48 mousedown: false, 49 mouseup: false, 50 click: false, 51 dblclick: false 52 }; 53 } 54 resetFlags(); 55 56 wnd.mapper.events.register("mousedown", mapper, setFlag); 57 wnd.mapper.events.register("mouseup", mapper, setFlag); 58 wnd.mapper.events.register("click", mapper, setFlag); 59 wnd.mapper.events.register("dblclick", mapper, setFlag); 60 61 simulateClick(wnd, wnd.control.buttons[0]); 43 62 t.ok( wnd.mapper.getCenter().lat > wnd.centerLL.lat, "Pan up works correctly" ); 63 t.ok(!flag.mousedown, "mousedown does not get to the map"); 64 t.ok(!flag.mouseup, "mouseup does not get to the map"); 65 t.ok(!flag.click, "click does not get to the map"); 66 t.ok(!flag.dblclick, "dblclick does not get to the map"); 67 resetFlags(); 44 68 45 69 simulateClick(wnd, wnd.control.buttons[1]); 46 70 t.ok( wnd.mapper.getCenter().lon < wnd.centerLL.lon, "Pan left works correctly" ); 71 t.ok(!flag.mousedown, "mousedown does not get to the map"); 72 t.ok(!flag.mouseup, "mouseup does not get to the map"); 73 t.ok(!flag.click, "click does not get to the map"); 74 t.ok(!flag.dblclick, "dblclick does not get to the map"); 75 resetFlags(); 47 76 48 77 simulateClick(wnd, wnd.control.buttons[2]); 49 78 t.ok( wnd.mapper.getCenter().lon == wnd.centerLL.lon, "Pan right works correctly" ); 79 t.ok(!flag.mousedown, "mousedown does not get to the map"); 80 t.ok(!flag.mouseup, "mouseup does not get to the map"); 81 t.ok(!flag.click, "click does not get to the map"); 82 t.ok(!flag.dblclick, "dblclick does not get to the map"); 83 resetFlags(); 50 84 51 85 simulateClick(wnd, wnd.control.buttons[3]); 52 86 t.ok( wnd.mapper.getCenter().lat == wnd.centerLL.lat, "Pan down works correctly" ); 87 t.ok(!flag.mousedown, "mousedown does not get to the map"); 88 t.ok(!flag.mouseup, "mouseup does not get to the map"); 89 t.ok(!flag.click, "click does not get to the map"); 90 t.ok(!flag.dblclick, "dblclick does not get to the map"); 91 resetFlags(); 53 92 54 93 simulateClick(wnd, wnd.control.buttons[4]); 55 94 t.eq( wnd.mapper.getZoom(), 6, "zoomin works correctly" ); 95 t.ok(!flag.mousedown, "mousedown does not get to the map"); 96 t.ok(!flag.mouseup, "mouseup does not get to the map"); 97 t.ok(!flag.click, "click does not get to the map"); 98 t.ok(!flag.dblclick, "dblclick does not get to the map"); 99 resetFlags(); 56 100 57 101 simulateClick(wnd, wnd.control.buttons[6]); 58 102 t.eq( wnd.mapper.getZoom(), 5, "zoomout works correctly" ); 103 t.ok(!flag.mousedown, "mousedown does not get to the map"); 104 t.ok(!flag.mouseup, "mouseup does not get to the map"); 105 t.ok(!flag.click, "click does not get to the map"); 106 t.ok(!flag.dblclick, "dblclick does not get to the map"); 107 resetFlags(); 59 108 60 109 simulateClick(wnd, wnd.control.buttons[5]); 61 110 t.eq( wnd.mapper.getZoom(), 2, "zoomworld works correctly" ); 111 t.ok(!flag.mousedown, "mousedown does not get to the map"); 112 t.ok(!flag.mouseup, "mouseup does not get to the map"); 113 t.ok(!flag.click, "click does not get to the map"); 114 t.ok(!flag.dblclick, "dblclick does not get to the map"); 115 resetFlags(); 116 62 117 }); 63 118 }); … … 68 123 var evt = wnd.document.createEvent("MouseEvents"); 69 124 evt.initMouseEvent("mousedown", true, true, wnd, 0, 0, 0, 0, 0, false, false, false, false, 0, null); 70 var canceled = !elem.dispatchEvent(evt); 125 elem.dispatchEvent(evt); 126 127 evt = wnd.document.createEvent("MouseEvents"); 128 evt.initMouseEvent("mouseup", true, true, wnd, 0, 0, 0, 0, 0, false, false, false, false, 0, null); 129 elem.dispatchEvent(evt); 130 131 evt = wnd.document.createEvent("MouseEvents"); 132 evt.initMouseEvent("click", true, true, wnd, 0, 0, 0, 0, 0, false, false, false, false, 0, null); 133 elem.dispatchEvent(evt); 134 135 evt = wnd.document.createEvent("MouseEvents"); 136 evt.initMouseEvent("dblclick", true, true, wnd, 0, 0, 0, 0, 0, false, false, false, false, 0, null); 137 elem.dispatchEvent(evt); 71 138 } 72 139
