= (props: IProps) => {
return (
{/* Implement Gestures Here */}
-
+
);
};
diff --git a/src/view/components/toolbar/motion/MotionSensorBar.tsx b/src/view/components/toolbar/motion/MotionSensorBar.tsx
index 08d959e12..a383e9eba 100644
--- a/src/view/components/toolbar/motion/MotionSensorBar.tsx
+++ b/src/view/components/toolbar/motion/MotionSensorBar.tsx
@@ -2,7 +2,7 @@
// Licensed under the MIT license.
import * as React from "react";
-import { CONSTANTS, WEBVIEW_MESSAGES } from "../../../constants";
+import { CONSTANTS, SENSOR_LIST, WEBVIEW_MESSAGES } from "../../../constants";
import "../../../styles/MotionSensorBar.css";
import { sendMessage } from "../../../utils/MessageUtils";
import { ISensorProps, ISliderProps } from "../../../viewUtils";
@@ -16,7 +16,7 @@ const MOTION_SLIDER_PROPS_X: ISliderProps = {
maxValue: 78,
minLabel: "Left",
minValue: -78,
- type: "motion_x",
+ type: SENSOR_LIST.MOTION_X,
};
const MOTION_SLIDER_PROPS_Y: ISliderProps = {
axisLabel: "Y",
@@ -24,7 +24,7 @@ const MOTION_SLIDER_PROPS_Y: ISliderProps = {
maxValue: 78,
minLabel: "Back",
minValue: -78,
- type: "motion_y",
+ type: SENSOR_LIST.MOTION_Y,
};
const MOTION_SLIDER_PROPS_Z: ISliderProps = {
axisLabel: "Z",
@@ -32,7 +32,7 @@ const MOTION_SLIDER_PROPS_Z: ISliderProps = {
maxValue: 78,
minLabel: "Up",
minValue: -78,
- type: "motion_z",
+ type: SENSOR_LIST.MOTION_Z,
};
const MOTION_SENSOR_PROPERTIES: ISensorProps = {
@@ -44,8 +44,16 @@ const MOTION_SENSOR_PROPERTIES: ISensorProps = {
],
unitLabel: "Lux",
};
+interface IProps {
+ axisValues: {
+ X_AXIS: number;
+ Y_AXIS: number;
+ Z_AXIS: number;
+ };
+ onUpdateValue: (sensor: SENSOR_LIST, value: number) => void;
+}
-class MotionSensorBar extends React.Component {
+class MotionSensorBar extends React.Component {
constructor(props: any) {
super(props);
}
@@ -64,6 +72,8 @@ class MotionSensorBar extends React.Component {
diff --git a/src/view/components/toolbar/motion/threeDimensionSlider/ThreeDimensionSlider.tsx b/src/view/components/toolbar/motion/threeDimensionSlider/ThreeDimensionSlider.tsx
index 4ff3da796..9de3c0041 100644
--- a/src/view/components/toolbar/motion/threeDimensionSlider/ThreeDimensionSlider.tsx
+++ b/src/view/components/toolbar/motion/threeDimensionSlider/ThreeDimensionSlider.tsx
@@ -1,4 +1,5 @@
import * as React from "react";
+import { SENSOR_LIST } from "../../../../constants";
import {
ISensorProps,
X_SLIDER_INDEX,
@@ -9,6 +10,12 @@ import InputSlider from "../../InputSlider";
interface IProps {
axisProperties: ISensorProps;
+ axisValues: {
+ X_AXIS: number;
+ Y_AXIS: number;
+ Z_AXIS: number;
+ };
+ onUpdateValue: (sensor: SENSOR_LIST, value: number) => void;
}
export const ThreeDimensionSlider: React.FC = props => {
return (
@@ -30,6 +37,8 @@ export const ThreeDimensionSlider: React.FC = props => {
axisLabel={
props.axisProperties.sliderProps[X_SLIDER_INDEX].axisLabel
}
+ onUpdateValue={props.onUpdateValue}
+ value={props.axisValues.X_AXIS}
/>
= props => {
axisLabel={
props.axisProperties.sliderProps[Y_SLIDER_INDEX].axisLabel
}
+ onUpdateValue={props.onUpdateValue}
+ value={props.axisValues.Y_AXIS}
/>
= props => {
axisLabel={
props.axisProperties.sliderProps[Z_SLIDER_INDEX].axisLabel
}
+ onUpdateValue={props.onUpdateValue}
+ value={props.axisValues.Z_AXIS}
/>
);
diff --git a/src/view/constants.ts b/src/view/constants.ts
index 331d77be0..48471efff 100644
--- a/src/view/constants.ts
+++ b/src/view/constants.ts
@@ -70,14 +70,24 @@ export enum WEBVIEW_MESSAGES {
SENSOR_CHANGED = "sensor-changed",
SLIDER_TELEMETRY = "slider-telemetry",
}
+
export enum VSCODE_MESSAGES_TO_WEBVIEW {
SET_DEVICE = "set-device",
PAUSE_DEVICE = "pause-device",
RUN_DEVICE = "run-device",
+ RESET = "reset-state",
}
export enum DEBUG_COMMANDS {
STACK_TRACE = "stackTrace",
CONTINUE = "continue",
}
+export enum SENSOR_LIST {
+ TEMPERATURE = "temperature",
+ LIGHT = "light",
+ ACCELEROMETER = "accelerometer",
+ MOTION_X = "motion_x",
+ MOTION_Y = "motion_y",
+ MOTION_Z = "motion_z",
+}
export default CONSTANTS;
diff --git a/src/view/viewUtils.tsx b/src/view/viewUtils.tsx
index 7b6efed48..445b916b2 100644
--- a/src/view/viewUtils.tsx
+++ b/src/view/viewUtils.tsx
@@ -1,3 +1,5 @@
+import { SENSOR_LIST } from "./constants";
+
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
export interface ISliderProps {
@@ -5,8 +7,10 @@ export interface ISliderProps {
maxValue: number;
maxLabel: string;
minLabel: string;
- type: string;
+ type: string | SENSOR_LIST;
axisLabel: string;
+ value?: number;
+ onUpdateValue?: (sensor: SENSOR_LIST, value: number) => void;
}
export interface ISensorButtonProps {
@@ -17,7 +21,6 @@ export interface ISensorButtonProps {
onKeyUp: (event: React.KeyboardEvent) => void;
onKeyDown: (event: React.KeyboardEvent) => void;
}
-
export interface ISensorProps {
LABEL: string;
sliderProps: ISliderProps[];