import * as React from "react"; import { GlobalState } from '../../globalState'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faPlay, faStop, faPalette } from '@fortawesome/free-solid-svg-icons'; import { Color3, Color4 } from 'babylonjs/Maths/math.color'; import { DataStorage } from '../../dataStorage'; interface IPreviewAreaComponent { globalState: GlobalState; width: number; } export class PreviewAreaComponent extends React.Component { changeAnimation() { this.props.globalState.rotatePreview = !this.props.globalState.rotatePreview; this.props.globalState.onAnimationCommandActivated.notifyObservers(); this.forceUpdate(); } changeBackground(value: string) { const newColor = Color3.FromHexString(value); DataStorage.StoreNumber("BackgroundColorR", newColor.r); DataStorage.StoreNumber("BackgroundColorG", newColor.g); DataStorage.StoreNumber("BackgroundColorB", newColor.b); this.props.globalState.backgroundColor = Color4.FromColor3(newColor, 1.0); this.props.globalState.onPreviewBackgroundChanged.notifyObservers(); } render() { return ( <>
this.changeAnimation()} className={"button"}>
this.changeBackground(evt.target.value)} />
); } }