OpenLayers OpenLayers

Changeset 5224

Show
Ignore:
Timestamp:
11/20/07 17:21:54 (1 year ago)
Author:
euzuro
Message:

patch for smoother dragging of google layer. For now this remains a wierd (and admirable) hack... restricted to the use of v2.82 of the google api... but hot damn. it does work. hopefully the good folks at google might help us out and open this up as part of the API. Dinosaur egg kudos to cr5 for finding this and taking the time to plug it in. Thanks to tschaub for the quick review. (Closes #816)

Files:

Legend:

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

    r5028 r5224  
    226226 
    227227                    var center = this.getMapObjectLonLatFromOLLonLat(newCenter); 
    228                     var zoom = this.getMapObjectZoomFromOLZoom(newZoom); 
    229                     this.setMapObjectCenter(center, zoom); 
     228 
     229                    if (dragging && this.dragPanMapObject) { 
     230                        var res = this.map.resolution; //readability 
     231                        var dX = (newCenter.lon - oldCenter.lon) / res; 
     232                        var dY = (newCenter.lat - oldCenter.lat) / res; 
     233                        this.dragPanMapObject(dX, dY); 
     234                    } else { 
     235                        var zoom = this.getMapObjectZoomFromOLZoom(newZoom); 
     236                        this.setMapObjectCenter(center, zoom, dragging); 
     237                    } 
    230238                } 
    231239            } 
  • trunk/openlayers/lib/OpenLayers/Layer/Google.js

    r5002 r5224  
    120120            termsOfUse.style.bottom = ""; 
    121121 
     122            //can we do smooth panning? (some versions don't) 
     123            if ( !this.mapObject.G || !this.mapObject.G.qb || 
     124                 (typeof this.mapObject.G.qb != "function") ) { 
     125 
     126                this.dragPanMapObject = null; 
     127            } 
     128 
    122129        } catch (e) { 
    123130            // do not crash 
     
    336343    
    337344    /** 
     345     * APIMethod: dragPanMapObject 
     346     *  
     347     * Parameters: 
     348     * dX - {Integer} 
     349     * dY - {Integer} 
     350     */ 
     351    dragPanMapObject: function(dX, dY) { 
     352        var newX = this.mapObject.G.left - dX; 
     353        var newY = this.mapObject.G.top + dY; 
     354        this.mapObject.G.qb(newX, newY); 
     355    }, 
     356    
     357    /** 
    338358     * APIMethod: getMapObjectCenter 
    339359     *