Add motor slider control

This commit is contained in:
Sam El-Husseini
2017-12-28 13:23:30 -08:00
parent d7f46c0fb5
commit cbe68b3199
4 changed files with 228 additions and 6 deletions

View File

@ -44,7 +44,7 @@ namespace pxsim.visuals {
}
.sim-text.number {
font-family: Courier, Lato, Work Sans, PT Serif, Source Serif Pro;
font-weight: bold;
/*font-weight: bold;*/
}
.sim-text.inverted {
fill:#5A5A5A;
@ -62,6 +62,14 @@ namespace pxsim.visuals {
fill: gray !important;
cursor: pointer;
}
/* Motor slider */
.sim-motor-btn {
cursor: pointer;
}
.sim-motor-btn:hover {
fill: gray !important;
}
`;
const EV3_WIDTH = 99.984346;
@ -213,9 +221,12 @@ namespace pxsim.visuals {
}
case NodeType.MediumMotor:
case NodeType.LargeMotor: {
// TODO: figure out if the motor is in "input" or "output" mode
const state = ev3board().getMotors()[port];
view = new MotorReporterControl(this.element, this.defs, state, port);
if (state.isInput()) {
view = new MotorSliderControl(this.element, this.defs, state, port);
} else {
view = new MotorReporterControl(this.element, this.defs, state, port);
}
break;
}
}