OpenLayers OpenLayers

Ticket #1402: updatedGooglePatch.patch

File updatedGooglePatch.patch, 2.2 kB (added by overstdr, 9 months ago)

Updated Google patch for 2.93...uses GDraggableObject instead of hack we currently use.

  • lib/OpenLayers/Layer/Google.js

    old new  
    7575     *     other maps, etc.  
    7676     */ 
    7777    sphericalMercator: false,  
     78     
     79    /** 
     80     * APIProperty: dragObject 
     81     * {GDraggableObject} Since 2.93, Google has exposed the ability to get 
     82     *     the maps GDraggableObject. We can now use this for smooth panning 
     83     */ 
     84    dragObject: null,  
    7885 
    7986    /**  
    8087     * Constructor: OpenLayers.Layer.Google 
     
    106113        try { 
    107114            // create GMap, hide nav controls 
    108115            this.mapObject = new GMap2( this.div ); 
     116             
     117            //since v 2.93 getDragObject is now available. 
     118            if(typeof this.mapObject.getDragObject=="function") { 
     119                this.dragObject = this.mapObject.getDragObject(); 
     120            } 
    109121 
     122 
    110123            // move the ToS and branding stuff up to the pane 
    111124            // thanks a *mil* Erik for thinking of this 
    112125            var poweredBy = this.div.lastChild; 
     
    124137            termsOfUse.style.bottom = ""; 
    125138 
    126139            //can we do smooth panning? (some versions don't) 
    127             if ( !this.mapObject.G || !this.mapObject.G.qb || 
    128                  (typeof this.mapObject.G.qb != "function") ) { 
    129  
     140            if ( !this.mapObject.G || (!this.mapObject.G.qb && this.dragObject==null) ||  
     141                (typeof this.mapObject.G.qb != "function" && this.dragObject==null)) { 
    130142                this.dragPanMapObject = null; 
    131143            } 
    132144 
     
    343355     * dY - {Integer} 
    344356     */ 
    345357    dragPanMapObject: function(dX, dY) { 
    346         var newX = this.mapObject.G.left - dX; 
    347         var newY = this.mapObject.G.top + dY; 
    348         this.mapObject.G.qb(newX, newY); 
     358        try { 
     359            var newX = this.mapObject.G.left - dX; 
     360            var newY = this.mapObject.G.top + dY; 
     361            if(this.dragObject!=null) { 
     362                //new since v.2.93 
     363                this.dragObject.moveTo(new GPoint(newX,newY)); 
     364            } else { 
     365                //else handle old version 
     366                this.mapObject.G.qb(newX, newY); 
     367            } 
     368        } catch(e) { 
     369            //prevent failures. 
     370        } 
    349371    },