Features/trigger widget #101
@ -13,6 +13,20 @@ class TriggerWidget extends React.Component<any, any> {
|
||||
this.props.dispatch({type: 'trigger/decreaseChannel'});
|
||||
}
|
||||
|
||||
// Trigger Type
|
||||
changeTriggerType = () => {
|
||||
this.props.dispatch({type: 'trigger/changeTriggerType'});
|
||||
}
|
||||
|
||||
// Trigger Level
|
||||
increaseTriggerLevel = () => {
|
||||
this.props.dispatch({type: 'trigger/increaseTriggerLevel'});
|
||||
}
|
||||
|
||||
decreaseTriggerLevel = () => {
|
||||
this.props.dispatch({type: 'trigger/decreaseTriggerLevel'});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="TriggerWidget">
|
||||
@ -38,6 +52,44 @@ class TriggerWidget extends React.Component<any, any> {
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="TriggerWidgetAdjustTriggerType">
|
||||
<button
|
||||
className="MinusButton"
|
||||
onClick={() => this.changeTriggerType()}>
|
||||
-
|
||||
</button>
|
||||
<label
|
||||
className="AdjustChannelBlockValue"
|
||||
style={{color: this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1]}}
|
||||
>
|
||||
{this.props.triggerWidget.triggerType.toString()}
|
||||
</label>
|
||||
<button
|
||||
className="PlusButton"
|
||||
onClick={() => this.changeTriggerType()}>
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="TriggerWidgetAdjustTriggerLevel">
|
||||
<button
|
||||
className="MinusButton"
|
||||
onClick={() => this.decreaseTriggerLevel()}>
|
||||
-
|
||||
</button>
|
||||
<label
|
||||
className="AdjustChannelBlockValue"
|
||||
style={{color: this.props.triggerWidget.channelColorsList[this.props.triggerWidget.triggerChannel-1]}}
|
||||
>
|
||||
{this.props.triggerWidget.triggerLevel.toString()}
|
||||
</label>
|
||||
<button
|
||||
className="PlusButton"
|
||||
onClick={() => this.increaseTriggerLevel()}>
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
)
|
||||
|
@ -14,4 +14,12 @@
|
||||
.AdjustChannelBlockValue {
|
||||
padding-left: 2vw;
|
||||
padding-right: 2vw;
|
||||
}
|
||||
}
|
||||
|
||||
.TriggerWidgetAdjustTriggerType {
|
||||
margin-top: 1vh;
|
||||
}
|
||||
|
||||
.TriggerWidgetAdjustTriggerLevel {
|
||||
margin-top: 1vh;
|
||||
}
|
||||
|
@ -31,6 +31,27 @@ export default function(state = initialState, action: {type: any, payload: any})
|
||||
...state,
|
||||
triggerChannel: state.triggerChannel - 1
|
||||
};
|
||||
case "trigger/changeTriggerType":
|
||||
if (state.triggerType == TriggerType.RisingEdge) {
|
||||
return {
|
||||
...state,
|
||||
triggerType: TriggerType.FallingEdge
|
||||
}
|
||||
}
|
||||
return {
|
||||
...state,
|
||||
triggerType: TriggerType.RisingEdge
|
||||
}
|
||||
case "trigger/increaseTriggerLevel":
|
||||
return {
|
||||
...state,
|
||||
triggerLevel: state.triggerLevel + 1
|
||||
};
|
||||
case "trigger/decreaseTriggerLevel":
|
||||
return {
|
||||
...state,
|
||||
triggerLevel: state.triggerLevel - 1
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user