r94659 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94658‎ | r94659 | r94660 >
Date:16:54, 16 August 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixed ge tilt
Modified paths:
  • /trunk/extensions/Maps/includes/services/GoogleMaps3/jquery.googlemap.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/includes/services/GoogleMaps3/jquery.googlemap.js
@@ -228,14 +228,41 @@
229229 mw.loader.using( 'ext.maps.gm3.earth', function() {
230230 if ( google.earth.isSupported() ) {
231231 var ge = new GoogleEarth( map );
 232+ var setTilt = function() {
 233+ if ( ge.getInstance() !== undefined ) {
 234+ var center = map.getCenter();
 235+ var lookAt = ge.instance_.createLookAt('');
 236+ var range = Math.pow(2, GoogleEarth.MAX_EARTH_ZOOM_ - map.getZoom());
 237+ lookAt.setRange(range);
 238+ lookAt.setLatitude(center.lat());
 239+ lookAt.setLongitude(center.lng());
 240+ lookAt.setHeading(0);
 241+ lookAt.setAltitude(0);
 242+
 243+ // Teleport to the pre-tilt view immediately.
 244+ ge.instance_.getOptions().setFlyToSpeed(5);
 245+ ge.instance_.getView().setAbstractView(lookAt);
 246+ lookAt.setTilt(options.tilt);
 247+ // Fly to the tilt at regular speed in 200ms
 248+ ge.instance_.getOptions().setFlyToSpeed(0.75);
 249+ window.setTimeout(function() {
 250+ ge.instance_.getView().setAbstractView(lookAt);
 251+ }, 200);
 252+ // Set the flyto speed back to default after the animation starts.
 253+ window.setTimeout(function() {
 254+ ge.instance_.getOptions().setFlyToSpeed(1);
 255+ }, 250);
 256+ }
 257+ else {
 258+ setTimeout( this, 100 );
 259+ }
 260+ };
232261
233 - //var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
234 -
235 - //lookAt.setTilt(lookAt.getTilt() + options.tilt);
236 - //ge.getView().setAbstractView(lookAt);
 262+ setTilt();
237263 }
 264+
238265 _this.addOverlays();
239 - map.setMapTypeId(GoogleEarth.MAP_TYPE_ID);
 266+ map.setMapTypeId( GoogleEarth.MAP_TYPE_ID );
240267 } );
241268 } } );
242269 }