map: Zoom-out now includes all next-jump accessible star systems
This commit is contained in:
parent
e0e10d9e40
commit
ddb1152765
|
@ -204,6 +204,19 @@ module TS.SpaceTac.UI {
|
||||||
this.tweens.create(this.layer_universe.scale).to({ x: scale, y: scale }, duration, easing).start();
|
this.tweens.create(this.layer_universe.scale).to({ x: scale, y: scale }, duration, easing).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the camera to include all direct-jump accessible stars
|
||||||
|
*/
|
||||||
|
setCameraOnAccessible(star: Star) {
|
||||||
|
let accessible = star.getNeighbors();
|
||||||
|
let xmin = min(accessible.map(star => star.x));
|
||||||
|
let xmax = max(accessible.map(star => star.x));
|
||||||
|
let ymin = min(accessible.map(star => star.y));
|
||||||
|
let ymax = max(accessible.map(star => star.y));
|
||||||
|
let dmax = Math.max(xmax - xmin, ymax - ymin);
|
||||||
|
this.setCamera(xmin + (xmax - xmin) * 0.5, ymin + (ymax - ymin) * 0.5, dmax * 1.1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the alpha value for all links
|
* Set the alpha value for all links
|
||||||
*/
|
*/
|
||||||
|
@ -221,8 +234,7 @@ module TS.SpaceTac.UI {
|
||||||
this.setLinksAlpha(1);
|
this.setLinksAlpha(1);
|
||||||
this.zoom = 0;
|
this.zoom = 0;
|
||||||
} else if (level == 1) {
|
} else if (level == 1) {
|
||||||
// TODO Zoom to next-jump accessible
|
this.setCameraOnAccessible(current_star);
|
||||||
this.setCamera(current_star.x, current_star.y, this.universe.radius * 0.5);
|
|
||||||
this.setLinksAlpha(0.6);
|
this.setLinksAlpha(0.6);
|
||||||
this.zoom = 1;
|
this.zoom = 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue