1
0
Fork 0

Fixed ship tooltip disappearing when hovering the ship list

This commit is contained in:
Michaël Lemaire 2018-07-01 22:58:46 +02:00
parent df80b958a5
commit 5fb8a6ce58
6 changed files with 20 additions and 14 deletions

View File

@ -18,18 +18,18 @@
The only hard dependency of the toolchain is Node.js (with npm).
If Node.js is not installed on your system but Python3 is, you can use the following commands to (de)activate a virtual
and local Node.js environment:
source activate_node # From now on, "npm" command will be the one from virtual environment
deactivate_node # This restores the environment as before the "source" command
If you want to build on your computer, clone the repository, then run:
npm install # Install dependencies
npm start # Start development server, and open game in web browser
npm test # Run unit tests
If Node.js is not installed on your system but Python3 is, you can use the following commands to (de)activate a virtual
and local Node.js environment:
source activate_node # From now on, "npm" command will be the one from virtual environment
deactivate_node # This restores the environment as before the "source" command
## Credits
* **[Michaël Lemaire](https://thunderk.net/)** - Code and graphics

View File

@ -108,6 +108,7 @@ Common UI
Technical
---------
* Fix tooltips and input events on mobile
* Pause timers when the game is paused (at least animation timers)
* Pack sounds
* Add toggles for shaders, automatically disable them if too slow, and initially disable them on mobile

View File

@ -109,11 +109,7 @@ module TK.SpaceTac.UI {
});
// Watch mouse move to capture hovering over background
view.input.on("pointermove", (pointer: Phaser.Input.Pointer) => {
if (this.view.dialogs_opened.length > 0 || this.view.character_sheet.isOpened() || this.view.layer_overlay.length > 0) {
return;
}
background.on("pointermove", (pointer: Phaser.Input.Pointer) => {
let location = new ArenaLocation(pointer.x / this.view.getScaling(), pointer.y / this.view.getScaling());
let ship = this.getShip(location);
this.callbacks_hover.forEach(callback => callback(location, ship));

View File

@ -32,7 +32,8 @@ module TK.SpaceTac.UI {
this.container = builder.container("shiplist", x, y);
builder = builder.in(this.container);
builder.image("battle-shiplist-background", 0, 0);
let bg = builder.image("battle-shiplist-background", 0, 0);
bg.setInteractive();
this.view = view;
this.battle = battle;
@ -42,7 +43,6 @@ module TK.SpaceTac.UI {
this.items = [];
this.hovered = null;
// FIXME
this.info_button = builder.button("battle-shiplist-info-button", 0, 0, undefined, "Tactical display", on => tactical_mode.manipulate("shiplist")(on));
this.setShipsFromBattle(battle);

View File

@ -62,7 +62,6 @@ module TK.SpaceTac.UI {
this.builder = builder.styled({ color: "#dce9f9", size: 16, shadow: true });
if (!onclose) {
onclose = () => this.hide();
}

View File

@ -201,12 +201,19 @@ module TK.SpaceTac.UI {
if (this.hovered === obj) {
return;
} else {
if (this.debug) {
console.log("Pointer force out", this.hovered);
}
this.forceLeaveHovered();
}
}
this.hovered = obj;
this.hovered.data.set("pointer", pointer);
if (this.debug) {
console.log("Pointer over", obj);
}
cursorinside = true;
enternext = Timer.global.schedule(hovertime, effectiveenter);
});
@ -216,6 +223,9 @@ module TK.SpaceTac.UI {
if (this.hovered === obj) {
this.hovered = null;
if (this.debug) {
console.log("Pointer out", obj);
}
}
cursorinside = false;