Changeset 2230
- Timestamp:
- 02/16/07 14:08:01 (2 years ago)
- Files:
-
- branches/openlayers/2.3/lib/OpenLayers/Control/OverviewMap.js (modified) (7 diffs)
- branches/openlayers/2.3/lib/OpenLayers/Control/PanZoom.js (modified) (1 diff)
- branches/openlayers/2.3/lib/OpenLayers/Layer.js (modified) (4 diffs)
- branches/openlayers/2.3/lib/OpenLayers/Layer/WMS/Untiled.js (modified) (4 diffs)
- branches/openlayers/2.3/lib/OpenLayers/Util.js (modified) (1 diff)
- branches/openlayers/2.3/tests/grid_inittiles.html (copied) (copied from trunk/openlayers/tests/grid_inittiles.html)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/openlayers/2.3/lib/OpenLayers/Control/OverviewMap.js
r2181 r2230 7 7 */ 8 8 9 // @require: OpenLayers/Control.js10 11 9 /** 12 * @class 13 */ 10 * @class 11 * 12 * @requires OpenLayers/Control.js 13 */ 14 14 OpenLayers.Control.OverviewMap = OpenLayers.Class.create(); 15 15 … … 107 107 this.extentRectangle.style.position = 'absolute'; 108 108 this.extentRectangle.style.zIndex = 1000; //HACK 109 this.extentRectangle.style.overflow = 'hidden'; 109 110 this.extentRectangle.style.backgroundImage = 'url(' + 110 111 OpenLayers.Util.getImagesLocation() + … … 163 164 'click', 164 165 this.maximizeControl.bindAsEventListener(this)); 166 OpenLayers.Event.observe(this.maximizeDiv, 167 'dblclick', 168 function(e) { 169 OpenLayers.Event.stop(e); 170 }); 165 171 this.div.appendChild(this.maximizeDiv); 166 172 … … 178 184 'click', 179 185 this.minimizeControl.bindAsEventListener(this)); 180 186 OpenLayers.Event.observe(this.minimizeDiv, 187 'dblclick', 188 function(e) { 189 OpenLayers.Event.stop(e); 190 }); 181 191 this.div.appendChild(this.minimizeDiv); 182 192 … … 419 429 // as the base layer for the main map. This should be made more robust. 420 430 if(this.map.units != 'degrees') { 421 if(this. map.getProjection() != this.ovmap.getProjection()) {431 if(this.ovmap.getProjection() && (this.map.getProjection() != this.ovmap.getProjection())) { 422 432 alert('The overview map only works when it is in the same projection as the main map'); 423 433 } 424 434 } 425 435 var pxBounds = this.getRectBoundsFromMapBounds(this.map.getExtent()); 426 this.setRectPxBounds(pxBounds); 436 if (pxBounds) { 437 this.setRectPxBounds(pxBounds); 438 } 427 439 }, 428 440 … … 480 492 var leftBottomPx = this.getOverviewPxFromLonLat(leftBottomLonLat); 481 493 var rightTopPx = this.getOverviewPxFromLonLat(rightTopLonLat); 482 return new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y, 483 rightTopPx.x, rightTopPx.y); 494 var bounds = null; 495 if (leftBottomPx && rightTopPx) { 496 bounds = new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y, 497 rightTopPx.x, rightTopPx.y); 498 } 499 return bounds; 484 500 }, 485 501 … … 531 547 var res = this.ovmap.getResolution(); 532 548 var extent = this.ovmap.getExtent(); 533 return new OpenLayers.Pixel( 534 Math.round(1/res * (lonlat.lon - extent.left)), 535 Math.round(1/res * (extent.top - lonlat.lat)) 536 ); 549 var px = null; 550 if (extent) { 551 px = new OpenLayers.Pixel( 552 Math.round(1/res * (lonlat.lon - extent.left)), 553 Math.round(1/res * (extent.top - lonlat.lat))); 554 } 555 return px; 537 556 }, 538 557 branches/openlayers/2.3/lib/OpenLayers/Control/PanZoom.js
r1721 r2230 86 86 87 87 btn.onmousedown = this.buttonDown.bindAsEventListener(btn); 88 btn.onmouseup = this.doubleClick.bindAsEventListener(btn); 88 89 btn.ondblclick = this.doubleClick.bindAsEventListener(btn); 89 btn.onclick = this.doubleClick.bindAsEventListener(btn);90 90 btn.action = id; 91 91 btn.map = this.map; branches/openlayers/2.3/lib/OpenLayers/Layer.js
r2018 r2230 18 18 /** @type DOMElement */ 19 19 div: null, 20 21 /** supported application event types 22 * 23 * @type Array */ 24 EVENT_TYPES: [ 25 "loadstart", "loadend", "loadcancel"], 26 27 /** @type OpenLayers.Events */ 28 events: null, 20 29 21 30 /** This variable is set when the layer is added to the map, via the … … 122 131 this.div.id = this.id; 123 132 } 133 134 this.events = new OpenLayers.Events(this, this.div, this.EVENT_TYPES); 124 135 }, 125 136 … … 136 147 this.div = null; 137 148 this.options = null; 149 this.events = null; 138 150 }, 139 151 … … 509 521 var res = this.map.getResolution(); 510 522 511 var delta_x = viewPortPx.x - Math.ceil(size.w / 2);512 var delta_y = viewPortPx.y - Math.ceil(size.h / 2);523 var delta_x = viewPortPx.x - (size.w / 2); 524 var delta_y = viewPortPx.y - (size.h / 2); 513 525 514 526 lonlat = new OpenLayers.LonLat(center.lon + delta_x * res , branches/openlayers/2.3/lib/OpenLayers/Layer/WMS/Untiled.js
r2074 r2230 31 31 /** @type OpenLayers.Tile.Image */ 32 32 tile: null, 33 33 34 /** did the image finish loading before a new draw was initiated? 35 * @type Boolean */ 36 doneLoading: false, 34 37 35 38 /** … … 64 67 */ 65 68 destroy: function() { 66 this.tile.destroy(); 67 this.tile = null; 69 if (this.tile) { 70 this.tile.destroy(); 71 this.tile = null; 72 } 68 73 OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this, arguments); 69 74 }, … … 109 114 */ 110 115 moveTo:function(bounds, zoomChanged, dragging) { 116 if (!this.doneLoading) { 117 this.events.triggerEvent("loadcancel"); 118 this.doneLoading = true; 119 } 111 120 OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments); 112 121 … … 156 165 } 157 166 167 this.events.triggerEvent("loadstart"); 168 this.doneLoading = false; 158 169 if (!this.tile) { 159 170 this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds, 160 171 url, tileSize); 161 172 this.tile.draw(); 173 var onload = function() { 174 this.doneLoading = true; 175 this.events.triggerEvent("loadend"); 176 } 177 OpenLayers.Event.observe(this.tile.imgDiv, 'load', 178 onload.bindAsEventListener(this)); 162 179 } else { 163 180 this.tile.moveTo(tileBounds, pos); branches/openlayers/2.3/lib/OpenLayers/Util.js
r2181 r2230 322 322 var div = OpenLayers.Util.createDiv(); 323 323 var img = OpenLayers.Util.createImage(null, null, null, null, null, null, 324 false);324 null, false); 325 325 div.appendChild(img); 326 326
