arena: Fixed ship tooltip masking targetting info
This commit is contained in:
parent
452f3e5d10
commit
c559418d0e
|
@ -45,7 +45,7 @@ module TK.SpaceTac.UI.Specs {
|
|||
let ship = battleview.battle.play_order[3];
|
||||
battleview.cursorHovered(ship.location, ship);
|
||||
expect(battleview.targetting.target).toEqual(Target.newFromLocation(ship.arena_x, ship.arena_y));
|
||||
expect(battleview.ship_hovered).toBe(ship);
|
||||
expect(battleview.ship_hovered).toBeNull();
|
||||
|
||||
spyOn(battleview.targetting, "validate").and.stub();
|
||||
|
||||
|
@ -58,6 +58,11 @@ module TK.SpaceTac.UI.Specs {
|
|||
|
||||
battleview.cursorHovered(new ArenaLocation(5, 8), null);
|
||||
expect(battleview.targetting.target).toBeNull();
|
||||
expect(battleview.ship_hovered).toBeNull();
|
||||
|
||||
battleview.cursorHovered(ship.location, ship);
|
||||
expect(battleview.targetting.target).toBeNull();
|
||||
expect(battleview.ship_hovered).toBe(ship);
|
||||
});
|
||||
|
||||
it("allows to choose an action and a target with shortcut keys", function () {
|
||||
|
|
|
@ -187,13 +187,12 @@ module TK.SpaceTac.UI {
|
|||
cursorHovered(location: ArenaLocation | null, ship: Ship | null) {
|
||||
if (this.targetting.active) {
|
||||
this.targetting.setTargetFromLocation(location);
|
||||
}
|
||||
|
||||
if (ship && this.ship_hovered != ship) {
|
||||
// TODO if targetting is active, this may hide targetting info with the tooltip
|
||||
this.cursorOnShip(ship);
|
||||
} else if (!ship && this.ship_hovered) {
|
||||
this.cursorOffShip(this.ship_hovered);
|
||||
} else {
|
||||
if (ship && this.ship_hovered != ship) {
|
||||
this.cursorOnShip(ship);
|
||||
} else if (!ship && this.ship_hovered) {
|
||||
this.cursorOffShip(this.ship_hovered);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,6 +253,10 @@ module TK.SpaceTac.UI {
|
|||
this.exitTargettingMode();
|
||||
this.interacting = enabled;
|
||||
}
|
||||
|
||||
if (!enabled) {
|
||||
this.setShipHovered(null);
|
||||
}
|
||||
}
|
||||
|
||||
// Enter targetting mode
|
||||
|
@ -263,6 +266,8 @@ module TK.SpaceTac.UI {
|
|||
return null;
|
||||
}
|
||||
|
||||
this.setShipHovered(null);
|
||||
|
||||
this.targetting.setAction(action, mode);
|
||||
return this.targetting;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue