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:
parent
60feafdfec
commit
20b898c08b
Software/waveview/src/components
@ -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();
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user