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). 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: If you want to build on your computer, clone the repository, then run:
npm install # Install dependencies npm install # Install dependencies
npm start # Start development server, and open game in web browser npm start # Start development server, and open game in web browser
npm test # Run unit tests 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 ## Credits
* **[Michaël Lemaire](https://thunderk.net/)** - Code and graphics * **[Michaël Lemaire](https://thunderk.net/)** - Code and graphics

View file

@ -108,6 +108,7 @@ Common UI
Technical Technical
--------- ---------
* Fix tooltips and input events on mobile
* Pause timers when the game is paused (at least animation timers) * Pause timers when the game is paused (at least animation timers)
* Pack sounds * Pack sounds
* Add toggles for shaders, automatically disable them if too slow, and initially disable them on mobile * 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 // Watch mouse move to capture hovering over background
view.input.on("pointermove", (pointer: Phaser.Input.Pointer) => { background.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;
}
let location = new ArenaLocation(pointer.x / this.view.getScaling(), pointer.y / this.view.getScaling()); let location = new ArenaLocation(pointer.x / this.view.getScaling(), pointer.y / this.view.getScaling());
let ship = this.getShip(location); let ship = this.getShip(location);
this.callbacks_hover.forEach(callback => callback(location, ship)); 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); this.container = builder.container("shiplist", x, y);
builder = builder.in(this.container); 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.view = view;
this.battle = battle; this.battle = battle;
@ -42,7 +43,6 @@ module TK.SpaceTac.UI {
this.items = []; this.items = [];
this.hovered = null; 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.info_button = builder.button("battle-shiplist-info-button", 0, 0, undefined, "Tactical display", on => tactical_mode.manipulate("shiplist")(on));
this.setShipsFromBattle(battle); this.setShipsFromBattle(battle);

View file

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

View file

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