OpenLayers OpenLayers

Changeset 5433

Show
Ignore:
Timestamp:
12/15/07 16:29:06 (1 year ago)
Author:
crschmidt
Message:

When trying to deactivate a control from within that control's featureAdded
event, a null exception is encountered. A null check fixes this bug. (Closes
#1143)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Handler/Path.js

    r4985 r5433  
    8080    destroyFeature: function() { 
    8181        OpenLayers.Handler.Point.prototype.destroyFeature.apply(this); 
    82         this.line.destroy(); 
     82        if(this.line) { 
     83            this.line.destroy(); 
     84        } 
    8385        this.line = null; 
    8486    }, 
  • trunk/openlayers/lib/OpenLayers/Handler/Point.js

    r5396 r5433  
    139139     */ 
    140140    destroyFeature: function() { 
    141         this.point.destroy(); 
     141        if(this.point) { 
     142            this.point.destroy(); 
     143        } 
    142144        this.point = null; 
    143145    }, 
  • trunk/openlayers/lib/OpenLayers/Handler/Polygon.js

    r4985 r5433  
    6666    destroyFeature: function() { 
    6767        OpenLayers.Handler.Path.prototype.destroyFeature.apply(this); 
    68         this.polygon.destroy(); 
     68        if(this.polygon) { 
     69            this.polygon.destroy(); 
     70        } 
    6971        this.polygon = null; 
    7072    }, 
  • trunk/openlayers/lib/OpenLayers/Layer/EventPane.js

    r5232 r5433  
    238238                     !(newZoom == oldZoom) ) { 
    239239 
    240                     var center = this.getMapObjectLonLatFromOLLonLat(newCenter); 
    241  
    242240                    if (dragging && this.dragPanMapObject &&  
    243241                        this.smoothDragPan) { 
     
    247245                        this.dragPanMapObject(dX, dY); 
    248246                    } else { 
     247                        var center = this.getMapObjectLonLatFromOLLonLat(newCenter); 
    249248                        var zoom = this.getMapObjectZoomFromOLZoom(newZoom); 
    250249                        this.setMapObjectCenter(center, zoom, dragging); 
     
    281280            var moLonLat = this.getMapObjectLonLatFromMapObjectPixel(moPixel); 
    282281            lonlat = this.getOLLonLatFromMapObjectLonLat(moLonLat); 
     282            var xrem = this.map.size.w % 2; 
     283            var yrem = this.map.size.h % 2; 
     284            if(xrem != 0 || yrem != 0) { 
     285                // odd sized viewport 
     286                var olPx = viewPortPx.add(xrem, yrem); 
     287                var moPx = this.getMapObjectPixelFromOLPixel(olPx); 
     288                var moLoc = this.getMapObjectLonLatFromMapObjectPixel(moPx); 
     289                var olLoc = this.getOLLonLatFromMapObjectLonLat(moLoc); 
     290                // adjust by half a pixel in odd dimension(s) 
     291                lonlat.lon += (olLoc.lon - lonlat.lon) / 2; 
     292                lonlat.lat += (olLoc.lat - lonlat.lat) / 2; 
     293            } 
    283294        } 
    284295        return lonlat;