Model viewer now pauses and unpauses when switching tools.

This commit is contained in:
Daan Vanden Bosch 2019-08-21 16:55:12 +02:00
parent 66147fa5e1
commit 060e746aac

View File

@ -15,6 +15,7 @@ import { property } from "../../core/observable";
import { Property } from "../../core/observable/Property";
import { PSO_FRAME_RATE } from "../../../core/rendering/conversion/ninja_animation";
import { parse_xvm, Xvm } from "../../../core/data_formats/parsing/ninja/texture";
import { gui_store, GuiTool } from "../../core/stores/GuiStore";
import Logger = require("js-logger");
const logger = Logger.get("viewer/stores/ModelStore");
@ -78,6 +79,19 @@ export class ModelStore implements Disposable {
this.current_model.observe(this.load_model),
this.current_animation.observe(this.load_animation),
);
let prev_animation_playing = this.animation_playing.get();
this.disposables.push(
gui_store.tool.observe(tool => {
if (tool === GuiTool.Viewer) {
this.animation_playing.set(prev_animation_playing);
} else {
prev_animation_playing = this.animation_playing.get();
this.animation_playing.set(false);
}
}),
);
}
dispose(): void {