Ticket #1402: updatedGooglePatch.patch
| File updatedGooglePatch.patch, 2.2 kB (added by overstdr, 9 months ago) |
|---|
-
lib/OpenLayers/Layer/Google.js
old new 75 75 * other maps, etc. 76 76 */ 77 77 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, 78 85 79 86 /** 80 87 * Constructor: OpenLayers.Layer.Google … … 106 113 try { 107 114 // create GMap, hide nav controls 108 115 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 } 109 121 122 110 123 // move the ToS and branding stuff up to the pane 111 124 // thanks a *mil* Erik for thinking of this 112 125 var poweredBy = this.div.lastChild; … … 124 137 termsOfUse.style.bottom = ""; 125 138 126 139 //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)) { 130 142 this.dragPanMapObject = null; 131 143 } 132 144 … … 343 355 * dY - {Integer} 344 356 */ 345 357 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 } 349 371 },
