Features/bottombar redux #97
@ -32,7 +32,7 @@ class HorizontalWidget extends React.Component<any, any> {
|
||||
<div className="HorizontalWidgetAdjustBlock-HorizontalTimeBase">
|
||||
<button
|
||||
className="MinusButton"
|
||||
onClick={() => this.decrementTimeBase}>
|
||||
onClick={() => this.decrementTimeBase()}>
|
||||
-
|
||||
</button>
|
||||
<label
|
||||
@ -43,7 +43,7 @@ class HorizontalWidget extends React.Component<any, any> {
|
||||
</label>
|
||||
<button
|
||||
className="PlusButton"
|
||||
onClick={() => this.incrementTimeBase}>
|
||||
onClick={() => this.incrementTimeBase()}>
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
@ -51,7 +51,7 @@ class HorizontalWidget extends React.Component<any, any> {
|
||||
<div className="HorizontalWidgetAdjustBlock-HorizontalOffset">
|
||||
<button
|
||||
className="MinusButton"
|
||||
onClick={() => this.decrementOffset}>
|
||||
onClick={() => this.decrementOffset()}>
|
||||
-
|
||||
</button>
|
||||
<label
|
||||
@ -62,7 +62,7 @@ class HorizontalWidget extends React.Component<any, any> {
|
||||
</label>
|
||||
<button
|
||||
className="PlusButton"
|
||||
onClick={() => this.incrementOffset}>
|
||||
onClick={() => this.incrementOffset()}>
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
|
@ -41,7 +41,7 @@ class VerticalWidget extends React.Component<any, any> {
|
||||
<div className="VerticalWidgetAdjustChannelBlock">
|
||||
<button
|
||||
className="MinusButton"
|
||||
onClick={this.decreaseChannel}>
|
||||
onClick={() => this.decreaseChannel()}>
|
||||
-
|
||||
</button>
|
||||
<label
|
||||
@ -52,7 +52,7 @@ class VerticalWidget extends React.Component<any, any> {
|
||||
</label>
|
||||
<button
|
||||
className="PlusButton"
|
||||
onClick={this.increaseChannel}>
|
||||
onClick={() => this.increaseChannel()}>
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
@ -60,7 +60,7 @@ class VerticalWidget extends React.Component<any, any> {
|
||||
<div className="VerticalWidgetAdjustBlock-TimePerDivision">
|
||||
<button
|
||||
className="MinusButton"
|
||||
onClick={() => this.decrementTimePerDivision}>
|
||||
onClick={() => this.decrementTimePerDivision()}>
|
||||
-
|
||||
</button>
|
||||
<label
|
||||
@ -71,7 +71,7 @@ class VerticalWidget extends React.Component<any, any> {
|
||||
</label>
|
||||
<button
|
||||
className="PlusButton"
|
||||
onClick={() => this.incrementTimePerDivision}>
|
||||
onClick={() => this.incrementTimePerDivision()}>
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
@ -79,7 +79,7 @@ class VerticalWidget extends React.Component<any, any> {
|
||||
<div className="VerticalWidgetAdjustBlock-VerticalOffset">
|
||||
<button
|
||||
className="MinusButton"
|
||||
onClick={() => this.decrementVerticalOffset}>
|
||||
onClick={() => this.decrementVerticalOffset()}>
|
||||
-
|
||||
</button>
|
||||
<label
|
||||
@ -90,7 +90,7 @@ class VerticalWidget extends React.Component<any, any> {
|
||||
</label>
|
||||
<button
|
||||
className="PlusButton"
|
||||
onClick={() => this.incrementVerticalOffset}>
|
||||
onClick={() => this.incrementVerticalOffset()}>
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
|
@ -31,7 +31,44 @@ const x10ProbeValues = [
|
||||
// 13 different voltages per divison presets
|
||||
// Start at x1ProbeValues[6] and change accordingly
|
||||
|
||||
const horizontalTimeBases = [
|
||||
"1ns/div",
|
||||
"2ns/div",
|
||||
"5ns/div",
|
||||
"10ns/div",
|
||||
"20ns/div",
|
||||
"50ns/div",
|
||||
"100ns/div",
|
||||
"200ns/div",
|
||||
"500ns/div",
|
||||
"1us/div",
|
||||
"2us/div",
|
||||
"5us/div",
|
||||
"10us/div",
|
||||
"20us/div",
|
||||
"50us/div",
|
||||
"100us/div",
|
||||
"200us/div",
|
||||
"500us/div",
|
||||
"1ms/div",
|
||||
"2ms/div",
|
||||
"5ms/div",
|
||||
"10ms/div",
|
||||
"20ms/div",
|
||||
"50ms/div",
|
||||
"100ms/div",
|
||||
"200ms/div",
|
||||
"500ms/div",
|
||||
"1s/div",
|
||||
"2s/div",
|
||||
"5s/div",
|
||||
"10s/div"
|
||||
];
|
||||
// 31 different voltages per division presets
|
||||
// Start at horizontalTimeBases[15] and change accordingly
|
||||
|
||||
export default {
|
||||
x1ProbeValues,
|
||||
x10ProbeValues
|
||||
x10ProbeValues,
|
||||
horizontalTimeBases
|
||||
};
|
@ -0,0 +1,8 @@
|
||||
enum DefaultChannelColor {
|
||||
Channel1 = "#EBFF00",
|
||||
Channel2 = "#00FF19",
|
||||
Channel3 = "#0075FF",
|
||||
Channel4 = "#FF0000"
|
||||
};
|
||||
|
||||
export default DefaultChannelColor;
|
@ -1,40 +1,54 @@
|
||||
import DefaultValues from '../../configuration/defaultValues';
|
||||
|
||||
const initialState = {
|
||||
horizontalTimeBase: {value: 0, unit: "ns/div"},
|
||||
horizontalOffset: {value: 0, unit: "ms"}
|
||||
horizontalTimeBase: {
|
||||
value: DefaultValues.horizontalTimeBases[15],
|
||||
index: 15
|
||||
},
|
||||
horizontalOffset: {
|
||||
value: 0,
|
||||
unit: "ms"
|
||||
}
|
||||
};
|
||||
|
||||
export default function(state = initialState, action: {type: any, payload: any}) {
|
||||
switch(action.type) {
|
||||
case "horizontal/increaseTimeBase":
|
||||
if (state.horizontalTimeBase.index >= 30) {
|
||||
return { ...state };
|
||||
}
|
||||
return {
|
||||
...state,
|
||||
horizontalTimeBase: {
|
||||
value: state.horizontalTimeBase.value + 1,
|
||||
unit: state.horizontalTimeBase.unit
|
||||
value: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index + 1],
|
||||
index: state.horizontalTimeBase.index + 1
|
||||
}
|
||||
}
|
||||
case "horizontal/decreaseTimeBase":
|
||||
if (state.horizontalTimeBase.index === 0) {
|
||||
return { ...state };
|
||||
}
|
||||
return {
|
||||
...state,
|
||||
horizontalTimeBase: {
|
||||
value: state.horizontalTimeBase.value - 1,
|
||||
unit: state.horizontalTimeBase.unit
|
||||
value: DefaultValues.horizontalTimeBases[state.horizontalTimeBase.index - 1],
|
||||
index: state.horizontalTimeBase.index - 1
|
||||
}
|
||||
}
|
||||
case "horizontal/increaseOffset":
|
||||
return {
|
||||
...state,
|
||||
horizontalOffset: {
|
||||
value: state.horizontalOffset.value + 1,
|
||||
unit: state.horizontalOffset.unit
|
||||
...state.horizontalOffset,
|
||||
value: state.horizontalOffset.value + 1
|
||||
}
|
||||
}
|
||||
case "horizontal/decreaseOffset":
|
||||
return {
|
||||
...state,
|
||||
horizontalOffset: {
|
||||
value: state.horizontalOffset.value - 1,
|
||||
unit: state.horizontalOffset.unit
|
||||
...state.horizontalOffset,
|
||||
value: state.horizontalOffset.value - 1
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
@ -1,13 +1,14 @@
|
||||
import DefaultValues from '../../configuration/defaultValues';
|
||||
import DefaultChannelColor from '../../configuration/enums/defaultChannelColor';
|
||||
import MeasurementType from '../../configuration/enums/measurementType';
|
||||
|
||||
const initialState = {
|
||||
activeChannel: 1,
|
||||
channelColorsList: [
|
||||
"#EBFF00",
|
||||
"#00FF19",
|
||||
"#0075FF",
|
||||
"#FF0000"
|
||||
DefaultChannelColor.Channel1,
|
||||
DefaultChannelColor.Channel2,
|
||||
DefaultChannelColor.Channel3,
|
||||
DefaultChannelColor.Channel4
|
||||
],
|
||||
timePerDivision: [
|
||||
{value: DefaultValues.x1ProbeValues[6], index: 6},
|
||||
@ -30,6 +31,9 @@ const initialState = {
|
||||
};
|
||||
|
||||
export default function(state = initialState, action: {type: any, payload: any}) {
|
||||
var channelIndex = state.activeChannel - 1;
|
||||
var tmp;
|
||||
|
||||
switch(action.type) {
|
||||
case "vertical/increaseChannel":
|
||||
if (state.activeChannel >= 4) {
|
||||
@ -48,23 +52,45 @@ export default function(state = initialState, action: {type: any, payload: any})
|
||||
activeChannel: state.activeChannel - 1
|
||||
};
|
||||
case "vertical/increaseVerticalOffset":
|
||||
return { ...state }
|
||||
// Decrease vertical offset
|
||||
tmp = state.verticalOffset;
|
||||
|
||||
tmp[channelIndex].value = state.verticalOffset[channelIndex].value + 1;
|
||||
return {
|
||||
...state,
|
||||
verticalOffset: tmp
|
||||
}
|
||||
case "vertical/decreaseVerticalOffset":
|
||||
return { ...state }
|
||||
// Decrease vertical offset
|
||||
tmp = state.verticalOffset;
|
||||
|
||||
tmp[channelIndex].value = state.verticalOffset[channelIndex].value - 1;
|
||||
return {
|
||||
...state,
|
||||
verticalOffset: tmp
|
||||
}
|
||||
case "vertical/increaseTimePerDivision":
|
||||
if (state.timePerDivision[state.activeChannel - 1].index >= 12) {
|
||||
return { ...state }
|
||||
};
|
||||
break;
|
||||
// Increase time per division
|
||||
case "vertical/decreaseTimePerDivision":
|
||||
if (state.timePerDivision[state.activeChannel - 1].index === 0) {
|
||||
return { ...state }
|
||||
};
|
||||
// Decrease time per division
|
||||
break;
|
||||
tmp = state.timePerDivision;
|
||||
|
||||
tmp[channelIndex].index = state.timePerDivision[channelIndex].index - 1;
|
||||
tmp[channelIndex].value = DefaultValues.x1ProbeValues[tmp[channelIndex].index];
|
||||
return {
|
||||
...state,
|
||||
timePerDivision: tmp
|
||||
}
|
||||
case "vertical/decreaseTimePerDivision":
|
||||
if (state.timePerDivision[state.activeChannel - 1].index >= 12) {
|
||||
return { ...state }
|
||||
};
|
||||
tmp = state.timePerDivision;
|
||||
|
||||
tmp[channelIndex].index = state.timePerDivision[channelIndex].index + 1;
|
||||
tmp[channelIndex].value = DefaultValues.x1ProbeValues[tmp[channelIndex].index];
|
||||
return {
|
||||
...state,
|
||||
timePerDivision: tmp
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user