Changeset 6516
- Timestamp:
- 03/13/08 09:44:09 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js
r6514 r6516 49 49 */ 50 50 divEvents: null, 51 52 /** Whether or not Pan icons will be displayed53 * Default is true54 *55 * @type Boolean56 */57 showPan: true,58 59 /** Whether or not ZoomBar will be displayed60 * Default is true61 *62 * @type Boolean63 */64 showZoomBar: true,65 51 66 52 /** … … 147 133 } 148 134 149 if (this.showPan) { 150 151 this._addButton("panup", "north-mini.png", centered, sz); 152 px.y = centered.y+sz.h; 153 this._addButton("panleft", "west-mini.png", px, sz); 154 if (this.zoomWorldIcon) { 155 this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz); 156 157 wposition *= 2; 158 } 159 this._addButton("panright", "east-mini.png", px.add(wposition, 0), sz); 160 this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz); 161 } 162 if (this.showZoomBar) { 163 this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz); 164 centered = this._addZoomBar(centered.add(0, sz.h*4 + 5)); 165 this._addButton("zoomout", "zoom-minus-mini.png", centered, sz); 166 } 135 this._addButton("panup", "north-mini.png", centered, sz); 136 px.y = centered.y+sz.h; 137 this._addButton("panleft", "west-mini.png", px, sz); 138 if (this.zoomWorldIcon) { 139 this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz); 140 141 wposition *= 2; 142 } 143 this._addButton("panright", "east-mini.png", px.add(wposition, 0), sz); 144 this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz); 145 this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz); 146 centered = this._addZoomBar(centered.add(0, sz.h*4 + 5)); 147 this._addButton("zoomout", "zoom-minus-mini.png", centered, sz); 167 148 return this.div; 168 149 }, trunk/openlayers/tests/Control/test_PanZoomBar.html
r6514 r6516 5 5 var map; 6 6 function test_01_Control_PanZoomBar_constructor (t) { 7 8 t.plan( 6 ); 9 7 t.plan( 4 ); 10 8 11 control = new OpenLayers.Control.PanZoomBar({position: new OpenLayers.Pixel(100,100) , showPan: false, showZoomBar: false});9 control = new OpenLayers.Control.PanZoomBar({position: new OpenLayers.Pixel(100,100)}); 12 10 t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" ); 13 11 t.eq( control.displayClass, "olControlPanZoomBar", "displayClass is correct" ); 14 12 t.eq( control.position.x, 100, "PanZoom X Set correctly."); 15 13 t.eq( control.position.y, 100, "PanZoom y Set correctly."); 16 t.eq( control.showPan, false, "showPan Set correctly.");17 t.eq( control.showZoomBar, false, "showZoomBar Set correctly.");18 19 14 } 20 15 function test_02_Control_PanZoomBar_addControl (t) { 21 t.plan( 10);16 t.plan( 8 ); 22 17 map = new OpenLayers.Map('map', {controls:[]}); 23 18 var layer = new OpenLayers.Layer.WMS("Test Layer", … … 25 20 {map: "/mapdata/vmap_wms.map", layers: "basic"}); 26 21 map.addLayer(layer); 27 control = new OpenLayers.Control.PanZoomBar( {showPan: false, showZoomBar: false});22 control = new OpenLayers.Control.PanZoomBar(); 28 23 t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" ); 29 24 t.ok( map instanceof OpenLayers.Map, "new OpenLayers.Map creates map" ); … … 34 29 t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), 1001, "Viewport div contains control div" ); 35 30 t.eq( control.div.style.top, "4px", "Control div top located correctly by default"); 36 t.eq( control.div.childNodes.length, 0, "showPan/showZoomBar work correctly");37 31 38 32 var control2 = new OpenLayers.Control.PanZoomBar(); 39 33 map.addControl(control2, new OpenLayers.Pixel(100,100)); 40 34 t.eq( control2.div.style.top, "100px", "2nd control div is located correctly"); 41 t.eq( control2.div.childNodes.length, 8, "showPan/showZoomBar work correctly on 2nd control div");42 35 } 43 36
