summaryrefslogtreecommitdiff
path: root/src/client/app
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2019-08-19 02:02:10 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2019-08-19 02:02:10 +0900
commit958ec7b03f94149d942473eea03bfadc4956fe6b (patch)
tree5ba8510fc5c5a4e8ffa184b735f94a401078fb26 /src/client/app
parent[Room] Add bin (diff)
downloadsharkey-958ec7b03f94149d942473eea03bfadc4956fe6b.tar.gz
sharkey-958ec7b03f94149d942473eea03bfadc4956fe6b.tar.bz2
sharkey-958ec7b03f94149d942473eea03bfadc4956fe6b.zip
Fix #5307
Diffstat (limited to 'src/client/app')
-rw-r--r--src/client/app/common/scripts/room/room.ts13
-rw-r--r--src/client/app/common/views/pages/room/room.vue4
2 files changed, 15 insertions, 2 deletions
diff --git a/src/client/app/common/scripts/room/room.ts b/src/client/app/common/scripts/room/room.ts
index 38bd692671..5506e5e653 100644
--- a/src/client/app/common/scripts/room/room.ts
+++ b/src/client/app/common/scripts/room/room.ts
@@ -37,6 +37,7 @@ export class Room {
private selectedObject: THREE.Object3D = null;
private onChangeSelect: Function;
private isTransformMode = false;
+ private renderFrameRequestId: number;
public canvas: HTMLCanvasElement;
private get furnitures(): Furniture[] {
@@ -299,7 +300,8 @@ export class Room {
@autobind
private renderWithoutPostFXs() {
- requestAnimationFrame(this.renderWithoutPostFXs);
+ this.renderFrameRequestId =
+ window.requestAnimationFrame(this.renderWithoutPostFXs);
// Update animations
const clock = this.clock.getDelta();
@@ -313,7 +315,8 @@ export class Room {
@autobind
private renderWithPostFXs() {
- requestAnimationFrame(this.renderWithPostFXs);
+ this.renderFrameRequestId =
+ window.requestAnimationFrame(this.renderWithPostFXs);
// Update animations
const clock = this.clock.getDelta();
@@ -688,4 +691,10 @@ export class Room {
public findFurnitureById(id: string) {
return this.furnitures.find(furniture => furniture.id === id);
}
+
+ @autobind
+ public destroy() {
+ // Stop render loop
+ window.cancelAnimationFrame(this.renderFrameRequestId);
+ }
}
diff --git a/src/client/app/common/views/pages/room/room.vue b/src/client/app/common/views/pages/room/room.vue
index 4b70b62449..7a365fe9ba 100644
--- a/src/client/app/common/views/pages/room/room.vue
+++ b/src/client/app/common/views/pages/room/room.vue
@@ -124,6 +124,10 @@ export default Vue.extend({
});
},
+ beforeDestroy() {
+ room.destroy();
+ },
+
methods: {
async add() {
const { canceled, result: id } = await this.$root.dialog({