import { makeObservable, observable } from 'mobx'; import { observer } from 'mobx-react'; import React from 'react'; import { Button, Checkbox, Col, ControlLabel, Form, FormControl, Row, Modal } from 'react-bootstrap'; import GridOptionsManager from '../managers/GridOptionsManager'; import { EModalType } from '../ui/react-pathway-mapper'; import PathwayActions from '../utils/PathwayActions'; interface IGridSettingsProps{ show: boolean; handleClose: Function; pathwayActions: PathwayActions; } export enum EGridType{ GRID, GUIDE, NONE } @observer export default class GridSettings extends React.Component{ @observable private gridSize: number; @observable private guideColor: string; private defaultSettings = GridOptionsManager.defaultGridGuideOptions; @observable private enabledType: EGridType; constructor(props: IGridSettingsProps){ super(props); makeObservable(this); this.gridSize = this.defaultSettings.gridSpacing; this.guideColor = this.defaultSettings.guidelinesStyle.strokeStyle; } setEnabledType(newType: EGridType){ if(newType === this.enabledType){ this.enabledType = EGridType.NONE; return; } this.enabledType = newType; } render(){ return( {this.enabledType = this.props.pathwayActions.enabledType;}} onHide={() => { this.props.handleClose(EModalType.GRID); }}> Grid Settings
Enable Grids: {this.setEnabledType(EGridType.GRID);}}> Enable Guidelines: {this.setEnabledType(EGridType.GUIDE);}}> Grid Size: {this.gridSize = e.target.value;}}/> Guideline Color: {this.guideColor = e.target.value;}}/>
); } }