7
mirror of https://github.com/EEVengers/ThunderScope.git synced 2025-04-22 17:43:44 +00:00

added electron side of hiding waveforms

This commit is contained in:
Jason Bonnell 2021-03-22 15:51:31 -04:00
parent 280b4f1686
commit 0479626684
6 changed files with 27 additions and 9 deletions

View File

@ -81,12 +81,14 @@ class Graph extends React.Component<any, any> {
/>
{
this.generator.getData().map((data: any, index: any) => {
return <LineSeries
return (
<LineSeries
className="data-series"
data={data}
style={{fill:"none", transform: "translate(0,0)"}}
style={{fill:"none", transform: "translate(0,0)", opacity: this.props.verticalWidget.settings[index].status}}
color={this.props.settings.colors.channel[index]}
/>
)
})
}
</FlexibleXYPlot>
@ -95,10 +97,11 @@ class Graph extends React.Component<any, any> {
}
}
function mapStateToProps(state: { graph: any, settings: any }) {
function mapStateToProps(state: { graph: any, settings: any, verticalWidget: any }) {
return {
graph: state.graph,
settings: state.settings
settings: state.settings,
verticalWidget: state.verticalWidget
};
}

View File

@ -8,6 +8,7 @@ class TriggerWidget extends React.Component<any, any> {
toggleMathMode = (mathEnabled: boolean) => {
this.props.dispatch({type: 'math/toggleMathMode', payload: mathEnabled });
this.props.dispatch({type: 'vertical/toggleMathWaveform' });
}
changeChannel1 = (channelNumber: number) => {
@ -179,9 +180,10 @@ class TriggerWidget extends React.Component<any, any> {
}
}
function mapStateToProps(state: { mathWidget: any, settings: any}) {
function mapStateToProps(state: { mathWidget: any, verticalWidget: any, settings: any}) {
return {
mathWidget: state.mathWidget,
verticalWidget: state.verticalWidget,
settings: state.settings
};
}

View File

@ -1,7 +1,7 @@
import MathOperators from '../../configuration/enums/mathOperators';
const MathWidgetInitialState = {
mathEnabled: true,
mathEnabled: false,
mathOperator: MathOperators.Addition,
channel1: 1,
channel2: 2

View File

@ -6,9 +6,9 @@ const SettingsInitialState = {
DefaultColors.Channel1,
DefaultColors.Channel2,
DefaultColors.Channel3,
DefaultColors.Channel4
],
math: DefaultColors.Math
DefaultColors.Channel4,
DefaultColors.Math
]
}
};

View File

@ -85,6 +85,9 @@ const VerticalWidgetInitialState = {
coupling: MeasurementType.DC,
bandwidth: 100,
status: 1
},
{
status: 0
}
],
verticalOffset: [

View File

@ -81,6 +81,7 @@ export default function(state = VerticalWidgetInitialState, action: {type: any,
settings: tmp
};
case "vertical/changeChannelStatus":
// TODO: Call C and tell them that we want to either start getting or stop receiving data from the channel
tmp = state.settings;
var newTotalChannelsUsed = state.totalChannelsUsed;
@ -175,6 +176,15 @@ export default function(state = VerticalWidgetInitialState, action: {type: any,
...state,
timePerDivision: tmp
};
case "vertical/toggleMathWaveform":
tmp = state.settings;
var newStatus = (state.settings[4].status === 1) ? 0 : 1;
state.settings[4].status = newStatus;
return {
...state,
settings: tmp
}
default:
return state;
}