7
mirror of https://github.com/EEVengers/ThunderScope.git synced 2025-04-08 06:25:30 +00:00

UI->Plumber: Single

This commit is contained in:
Ratan Varghese 2021-03-22 01:48:28 -04:00
parent 60feafdfec
commit 20b898c08b
3 changed files with 10 additions and 3 deletions
Software/waveview/src/components

View File

@ -14,10 +14,12 @@ import GraphStatus from '../../configuration/enums/graphStatus';
import TestPoints from '../../util/testpoints';
class Graph extends React.Component<any, any> {
static instanceList: Graph[] = [];
timerID: number = 0;
generator: TestPoints = new TestPoints(50, 50);
componentDidMount() {
Graph.instanceList.push(this);
this.timerID = window.setInterval(
() => this.tick(),
16.67
@ -30,7 +32,7 @@ class Graph extends React.Component<any, any> {
}
tick() {
if(!this.props.graph.singleMode && this.props.graph.currentStatus === GraphStatus.On) {
if(this.props.graph.currentStatus === GraphStatus.On) {
this.props.dispatch({type: 'graph/tick'});
this.generator.update();
}

View File

@ -1,11 +1,16 @@
import React from 'react';
import { connect } from 'react-redux';
import './../../../css/sidebar/core/singleButton.css';
import Graph from '../../graph/graph';
class SingleButton extends React.Component<any, any> {
toggleSingleMode = () => {
this.props.dispatch({type: 'graph/singleMode'});
//this.props.dispatch({type: 'graph/singleMode'}); //TODO: something about this
if(Graph.instanceList.length > 0) {
this.props.dispatch({type: 'graph/tick'});
Graph.instanceList[0].generator.update();
}
}
render() {

View File

@ -17,7 +17,7 @@ class MeasurementsWidget extends React.Component<any, any> {
}
tick() {
if(!this.props.graph.singleMode && this.props.graph.currentStatus === GraphStatus.On) {
if(this.props.graph.currentStatus === GraphStatus.On) {
this.props.dispatch({type: 'measurements/tick'});
this.update();
}