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

moved division checks to widget rather than redux

This commit is contained in:
Jason Bonnell 2021-03-25 15:52:16 -04:00
parent 0aedf40185
commit 66790da52e
2 changed files with 15 additions and 8 deletions
Software/waveview/src
components/sidebar/widgets
redux/reducers/widgets

View File

@ -18,11 +18,24 @@ class VerticalWidget extends React.Component<any, any> {
// Time Per Division
incrementTimePerDivision = () => {
this.props.dispatch({type: 'vertical/increaseTimePerDivision'});
let currentChannel = this.props.verticalWidget.activeChannel - 1;
let index = this.props.verticalWidget.timePerDivision[currentChannel].index;
if (index !== 0)
{
// Call C
this.props.dispatch({type: 'vertical/increaseTimePerDivision'});
};
}
decrementTimePerDivision = () => {
this.props.dispatch({type: 'vertical/decreaseTimePerDivision'});
let currentChannel = this.props.verticalWidget.activeChannel - 1;
let index = this.props.verticalWidget.timePerDivision[currentChannel].index;
if (index < 12) {
// Call C
this.props.dispatch({type: 'vertical/decreaseTimePerDivision'});
}
}
incrementTimePerDivisionFine = () => {

View File

@ -114,9 +114,6 @@ export default function VerticalWidgetReducer(state = VerticalWidgetInitialState
verticalOffset: tmp
}
case "vertical/increaseTimePerDivision":
if (state.timePerDivision[state.activeChannel - 1].index === 0) {
return { ...state }
};
tmp = state.timePerDivision;
tmp[channelIndex].index = state.timePerDivision[channelIndex].index - 1;
@ -136,9 +133,6 @@ export default function VerticalWidgetReducer(state = VerticalWidgetInitialState
verticalOffset: tmp2
}
case "vertical/decreaseTimePerDivision":
if (state.timePerDivision[state.activeChannel - 1].index >= 12) {
return { ...state }
};
tmp = state.timePerDivision;
tmp[channelIndex].index = state.timePerDivision[channelIndex].index + 1;