Skip to content

Commit

Permalink
support planets with radius 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederik Eychenie committed Apr 25, 2014
1 parent 521738f commit 5e3d1a9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/webapp/static/js/systemview.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
this.align = data.planets.length > 1 ? "left":"center";
this.Planets = data.planets; //_.sortBy(data.planets, function(p){return p.planet.radius * -1});
_.map( this.Planets, function(planet){
//--compat fixes
if(planet.planet.radius <= 0 ) planet.planet.radius = 500;
planet.starting_planet = planet.starting_planet || false; //ensure field presence
planet.required_thrust_to_move = planet.required_thrust_to_move || 0; //ensure field presence
// --end compat fixes
planet.imagePath = imageBaseUrl + 'planets/' + planet.planet.biome + '.png';
planet.imageWidth = planet.planet.radius >= 1000 ? '200px' : Math.round(200 * planet.planet.radius / 1000) + 'px';
planet.imageOffset = planet.planet.radius < 420 ? Math.round(200 * (420 - planet.planet.radius)/2000) + 'px': '0';
planet.starting_planet = planet.starting_planet || false; //ensure field presence
planet.required_thrust_to_move = planet.required_thrust_to_move || 0; //ensure field presence
});
}
ko.applyBindings( new SystemModel(), document.getElementById('systemInfo'))
Expand Down

0 comments on commit 5e3d1a9

Please sign in to comment.