OpenLayers OpenLayers

Changeset 2230

Show
Ignore:
Timestamp:
02/16/07 14:08:01 (2 years ago)
Author:
sderle
Message:

Pull up r2181:r2229 to 2.3 branch. Includes fixes for:

#429 fix panning for odd size viewport
#478 Double clicking overview map expand/contract button zooms in Safari
#484 conflict between _addButton of MouseToolbar and PanZoom
#485 null pointer exception on CTRL+F5 in IE for WMS.Untiled
#486 add a few sanity checks to overview map
#489 requires tag incorrect in OverviewMap.js
#498 overviewmap: rectangle has minimum height in IE

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/openlayers/2.3/lib/OpenLayers/Control/OverviewMap.js

    r2181 r2230  
    77 */ 
    88 
    9 // @require: OpenLayers/Control.js 
    10  
    119/**  
    12 * @class 
    13 */ 
     10 * @class 
     11 *  
     12 * @requires OpenLayers/Control.js 
     13 */ 
    1414OpenLayers.Control.OverviewMap = OpenLayers.Class.create(); 
    1515 
     
    107107        this.extentRectangle.style.position = 'absolute'; 
    108108        this.extentRectangle.style.zIndex = 1000;  //HACK 
     109        this.extentRectangle.style.overflow = 'hidden'; 
    109110        this.extentRectangle.style.backgroundImage = 'url(' + 
    110111                                        OpenLayers.Util.getImagesLocation() + 
     
    163164                          'click',  
    164165                          this.maximizeControl.bindAsEventListener(this)); 
     166            OpenLayers.Event.observe(this.maximizeDiv, 
     167                          'dblclick', 
     168                          function(e) { 
     169                              OpenLayers.Event.stop(e); 
     170                          }); 
    165171            this.div.appendChild(this.maximizeDiv); 
    166172     
     
    178184                          'click',  
    179185                          this.minimizeControl.bindAsEventListener(this)); 
    180      
     186            OpenLayers.Event.observe(this.minimizeDiv, 
     187                          'dblclick', 
     188                          function(e) { 
     189                              OpenLayers.Event.stop(e); 
     190                          }); 
    181191            this.div.appendChild(this.minimizeDiv); 
    182192             
     
    419429        // as the base layer for the main map.  This should be made more robust. 
    420430        if(this.map.units != 'degrees') { 
    421             if(this.map.getProjection() != this.ovmap.getProjection()) { 
     431            if(this.ovmap.getProjection() && (this.map.getProjection() != this.ovmap.getProjection())) { 
    422432                alert('The overview map only works when it is in the same projection as the main map'); 
    423433            } 
    424434        } 
    425435        var pxBounds = this.getRectBoundsFromMapBounds(this.map.getExtent()); 
    426         this.setRectPxBounds(pxBounds); 
     436        if (pxBounds) { 
     437          this.setRectPxBounds(pxBounds); 
     438        } 
    427439    }, 
    428440     
     
    480492        var leftBottomPx = this.getOverviewPxFromLonLat(leftBottomLonLat); 
    481493        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; 
    484500    }, 
    485501 
     
    531547        var res  = this.ovmap.getResolution(); 
    532548        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; 
    537556    }, 
    538557 
  • branches/openlayers/2.3/lib/OpenLayers/Control/PanZoom.js

    r1721 r2230  
    8686 
    8787        btn.onmousedown = this.buttonDown.bindAsEventListener(btn); 
     88        btn.onmouseup = this.doubleClick.bindAsEventListener(btn); 
    8889        btn.ondblclick  = this.doubleClick.bindAsEventListener(btn); 
    89         btn.onclick  = this.doubleClick.bindAsEventListener(btn); 
    9090        btn.action = id; 
    9191        btn.map = this.map; 
  • branches/openlayers/2.3/lib/OpenLayers/Layer.js

    r2018 r2230  
    1818    /** @type DOMElement */ 
    1919    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, 
    2029 
    2130    /** This variable is set when the layer is added to the map, via the  
     
    122131            this.div.id = this.id; 
    123132        } 
     133 
     134        this.events = new OpenLayers.Events(this, this.div, this.EVENT_TYPES); 
    124135    }, 
    125136     
     
    136147        this.div = null; 
    137148        this.options = null; 
     149        this.events = null; 
    138150    }, 
    139151     
     
    509521            var res  = this.map.getResolution(); 
    510522         
    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); 
    513525             
    514526            lonlat = new OpenLayers.LonLat(center.lon + delta_x * res , 
  • branches/openlayers/2.3/lib/OpenLayers/Layer/WMS/Untiled.js

    r2074 r2230  
    3131    /** @type OpenLayers.Tile.Image */ 
    3232    tile: null, 
    33      
     33 
     34    /** did the image finish loading before a new draw was initiated? 
     35     * @type Boolean */ 
     36    doneLoading: false, 
    3437 
    3538    /** 
     
    6467     */ 
    6568    destroy: function() { 
    66         this.tile.destroy(); 
    67         this.tile = null;     
     69        if (this.tile) { 
     70          this.tile.destroy(); 
     71          this.tile = null;     
     72        } 
    6873        OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this, arguments); 
    6974    }, 
     
    109114     */ 
    110115    moveTo:function(bounds, zoomChanged, dragging) { 
     116        if (!this.doneLoading) { 
     117            this.events.triggerEvent("loadcancel");  
     118            this.doneLoading = true;  
     119        } 
    111120        OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments); 
    112121         
     
    156165            } 
    157166 
     167            this.events.triggerEvent("loadstart"); 
     168            this.doneLoading = false; 
    158169            if (!this.tile) { 
    159170                this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds,  
    160171                                                     url, tileSize); 
    161172                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)); 
    162179            } else { 
    163180                this.tile.moveTo(tileBounds, pos); 
  • branches/openlayers/2.3/lib/OpenLayers/Util.js

    r2181 r2230  
    322322    var div = OpenLayers.Util.createDiv(); 
    323323    var img = OpenLayers.Util.createImage(null, null, null, null, null, null,  
    324                                           false); 
     324                                          null, false); 
    325325    div.appendChild(img); 
    326326