Fix controls

This commit is contained in:
Sam El-Husseini 2017-12-19 17:20:01 -08:00
parent 7f5b8aed99
commit 11b4bbc07e

View File

@ -383,6 +383,7 @@ namespace pxsim.visuals {
private updateStateStep(elapsed: number) { private updateStateStep(elapsed: number) {
const selected = this.layoutView.getSelected(); const selected = this.layoutView.getSelected();
let selectedChanged = false;
const inputNodes = ev3board().getInputNodes(); const inputNodes = ev3board().getInputNodes();
inputNodes.forEach((node, index) => { inputNodes.forEach((node, index) => {
node.updateState(elapsed); node.updateState(elapsed);
@ -391,6 +392,7 @@ namespace pxsim.visuals {
if (view) { if (view) {
this.layoutView.setInput(index, view); this.layoutView.setInput(index, view);
view.updateState(); view.updateState();
if (selected == view) selectedChanged = true;
} }
}); });
@ -407,6 +409,7 @@ namespace pxsim.visuals {
if (view) { if (view) {
this.layoutView.setOutput(index, view); this.layoutView.setOutput(index, view);
view.updateState(); view.updateState();
if (selected == view) selectedChanged = true;
} }
}); });
@ -430,6 +433,10 @@ namespace pxsim.visuals {
this.resize(); this.resize();
} }
if (selectedChanged && selected) {
this.controlView.updateState();
}
this.updateScreenStep(); this.updateScreenStep();
} }