OpenLayers OpenLayers

Changeset 5627

Show
Ignore:
Timestamp:
01/02/08 14:36:12 (1 year ago)
Author:
tschaub
Message:

Oh please Google, give us some well named methods that solve this issue. We muddle around with obfuscated code trying in vein to solve your pesky setCenter flicker. This brings us a bit closer with even sized viewports but is still embarassingly wrong for users panning across the dateline with odd sized viewport. r=crschmidt (closes #1174)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Layer/EventPane.js

    r5626 r5627  
    240240                     !(newZoom == oldZoom) ) { 
    241241 
    242                     var center = this.getMapObjectLonLatFromOLLonLat(newCenter); 
    243  
    244242                    if (dragging && this.dragPanMapObject &&  
    245243                        this.smoothDragPan) { 
     
    249247                        this.dragPanMapObject(dX, dY); 
    250248                    } else { 
     249                        var center = this.getMapObjectLonLatFromOLLonLat(newCenter); 
    251250                        var zoom = this.getMapObjectZoomFromOLZoom(newZoom); 
    252251                        this.setMapObjectCenter(center, zoom, dragging); 
     
    283282            var moLonLat = this.getMapObjectLonLatFromMapObjectPixel(moPixel); 
    284283            lonlat = this.getOLLonLatFromMapObjectLonLat(moLonLat); 
     284            var xrem = this.map.size.w % 2; 
     285            var yrem = this.map.size.h % 2; 
     286            if(xrem != 0 || yrem != 0) { 
     287                // odd sized viewport 
     288                var olPx = viewPortPx.add(xrem, yrem); 
     289                var moPx = this.getMapObjectPixelFromOLPixel(olPx); 
     290                var moLoc = this.getMapObjectLonLatFromMapObjectPixel(moPx); 
     291                var olLoc = this.getOLLonLatFromMapObjectLonLat(moLoc); 
     292                // adjust by half a pixel in odd dimension(s) 
     293                lonlat.lon += (olLoc.lon - lonlat.lon) / 2; 
     294                lonlat.lat += (olLoc.lat - lonlat.lat) / 2; 
     295            } 
    285296        } 
    286297        return lonlat;