import { reaction } from "mobx" ; import VisualizationOptionStore from "../stores/VisualizationOptionStore" ; import { lazyInject } from "../inversify.config" ; import CityLayoutService from "../services/layout/CityLayoutService" ; import CityBuilderStore from "../stores/CityBuilderStore" ; import SceneStore from "../stores/SceneStore" ; export default class SceneReactions { @ lazyInject ( "SceneStore" ) private readonly sceneStore ! : SceneStore ; @ lazyInject ( "CityBuilderStore" ) private readonly cityBuilderStore ! : CityBuilderStore ; @ lazyInject ( "VisualizationOptionStore" ) private readonly visualizationOptions ! : VisualizationOptionStore ; @ lazyInject ( "CityLayoutService" ) private readonly cityLayoutService ! : CityLayoutService ; constructor ( ) { this . prepareReactions ( ) ; } private prepareReactions ( ) { reaction ( ( ) => this . visualizationOptions . metricColor , ( ) => { if ( ! this . cityBuilderStore . show ) { this . cityLayoutService . createCity ( ) ; } } , { name : "Transfer the chosen color from the scene to the builder and rebuild city" , } ) ; reaction ( ( ) => this . sceneStore . projectData , ( ) => { this . cityLayoutService . createCity ( ) ; } , { name : "Convert backend data to threeJS shapes" , } ) ; } }