Skip to content

Commit 509c5e3

Browse files
Fix star/carrier clicking
1 parent 16c71a9 commit 509c5e3

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

client/src/game/animation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AnimationService {
2727
})
2828
}
2929

30-
app?.ticker.add(animation)
30+
app.ticker.add(animation)
3131

3232
setTimeout(() => {
3333
container.removeChild(graphics)

client/src/game/map.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ import WormHoleLayer from './wormHole'
1313
import TooltipLayer from './tooltip'
1414
import type {Store} from "vuex";
1515
import type {State} from "../store";
16-
import type {DrawingContext, GameContainer} from "./container";
16+
import { type DrawingContext, type GameContainer} from "./container";
1717
import type {Game, Player, Star as StarData, Carrier as CarrierData} from "../types/game";
1818
import type {Location, MapObject, UserGameSettings} from "@solaris-common";
1919
import { Chunks } from './chunks'
2020
import Carrier from "./carrier";
2121
import type { EventBus } from '../eventBus'
2222
import MapEventBusEventNames from '../eventBusEventNames/map'
2323
import MapCommandEventBusEventNames from "../eventBusEventNames/mapCommand";
24+
import globalGameContainer from './container';
2425

2526
enum Mode {
2627
Galaxy = 'galaxy',
@@ -286,6 +287,14 @@ export class Map {
286287
}
287288
}
288289

290+
destroy () {
291+
if (this.unsubscribe) {
292+
this.unsubscribe();
293+
}
294+
295+
this.unsubscribe = undefined;
296+
}
297+
289298
setupStar (game: Game, userSettings: UserGameSettings, starData: StarData) {
290299
let star = this.stars.find(x => x.data._id === starData._id)
291300

@@ -791,7 +800,7 @@ export class Map {
791800
} else if (this.mode === 'ruler') {
792801
this.rulerPoints!.onStarClicked(e)
793802
}
794-
AnimationService.drawSelectedCircle(this.app, this.container, e.location)
803+
AnimationService.drawSelectedCircle(globalGameContainer.app!, this.container, e.location)
795804
}
796805

797806
onStarDefaultClicked (dic) {
@@ -856,7 +865,7 @@ export class Map {
856865
this.rulerPoints!.onCarrierClicked(e)
857866
}
858867

859-
AnimationService.drawSelectedCircle(this.app, this.container, e.location)
868+
AnimationService.drawSelectedCircle(globalGameContainer.app!, this.container, e.location)
860869
}
861870

862871
onCarrierRightClicked (e) {

client/src/views/game/components/GameContainer.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ onMounted(() => {
139139
});
140140
141141
onBeforeUnmount(() => {
142+
gameContainer.destroy();
143+
142144
eventBus.off(MapEventBusEventNames.MapOnStarClicked, onStarClickedHandler);
143145
eventBus.off(MapEventBusEventNames.MapOnStarRightClicked, onStarRightClickedHandler);
144146
eventBus.off(MapEventBusEventNames.MapOnCarrierClicked, onCarrierClickedHandler);

0 commit comments

Comments
 (0)