Ticket #754: panzoombar.patch
| File panzoombar.patch, 3.1 kB (added by kkempfer, 1 year ago) |
|---|
-
tests/Control/test_PanZoomBar.html
old new 4 4 <script type="text/javascript"><!-- 5 5 var map; 6 6 function test_01_Control_PanZoomBar_constructor (t) { 7 t.plan( 3);7 t.plan( 5 ); 8 8 9 control = new OpenLayers.Control.PanZoomBar({position: new OpenLayers.Pixel(100,100) });9 control = new OpenLayers.Control.PanZoomBar({position: new OpenLayers.Pixel(100,100), showPan: false, showZoomBar: false}); 10 10 t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" ); 11 11 t.eq( control.position.x, 100, "PanZoom X Set correctly."); 12 12 t.eq( control.position.y, 100, "PanZoom y Set correctly."); 13 t.eq( control.showPan, false, "showPan Set correctly."); 14 t.eq( control.showZoomBar, false, "showZoomBar Set correctly."); 13 15 } 14 16 function test_02_Control_PanZoomBar_addControl (t) { 15 17 t.plan( 8 ); -
lib/OpenLayers/Control/PanZoomBar.js
old new 29 29 30 30 /** @type OpenLayers.Events */ 31 31 divEvents: null, 32 33 /** Whether or not Pan icons will be displayed 34 * Default is true 35 * 36 * @type Boolean 37 */ 38 showPan: true, 39 40 /** Whether or not ZoomBar will be displayed 41 * Default is true 42 * 43 * @type Boolean 44 */ 45 showZoomBar: true, 32 46 33 47 initialize: function() { 34 48 OpenLayers.Control.PanZoom.prototype.initialize.apply(this, arguments); … … 88 102 89 103 var sz = new OpenLayers.Size(18,18); 90 104 var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y); 91 92 this._addButton("panup", "north-mini.png", centered, sz); 93 px.y = centered.y+sz.h; 94 this._addButton("panleft", "west-mini.png", px, sz); 95 this._addButton("panright", "east-mini.png", px.add(sz.w, 0), sz); 96 this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz); 97 this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz); 98 centered = this._addZoomBar(centered.add(0, sz.h*4 + 5)); 99 this._addButton("zoomout", "zoom-minus-mini.png", centered, sz); 105 if(this.showPan){ 106 this._addButton("panup", "north-mini.png", centered, sz); 107 px.y = centered.y+sz.h; 108 this._addButton("panleft", "west-mini.png", px, sz); 109 this._addButton("panright", "east-mini.png", px.add(sz.w, 0), sz); 110 this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz); 111 } 112 if(this.showZoomBar){ 113 this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz); 114 centered = this._addZoomBar(centered.add(0, sz.h*4 + 5)); 115 this._addButton("zoomout", "zoom-minus-mini.png", centered, sz); 116 } 100 117 return this.div; 101 118 }, 102 119
