diff --git a/sim/state/color.ts b/sim/state/color.ts index cb83bc04..42ce61df 100644 --- a/sim/state/color.ts +++ b/sim/state/color.ts @@ -29,11 +29,12 @@ namespace pxsim { getDeviceType() { return DAL.DEVICE_TYPE_COLOR; } - + setColor(color: number) { - this.color = color; - this.changed = true; - this.valueChanged = true; + if (this.color != color) { + this.color = color; + this.setChangedState(); + } } getValue() { diff --git a/sim/state/touch.ts b/sim/state/touch.ts index 7542ad5b..4c900561 100644 --- a/sim/state/touch.ts +++ b/sim/state/touch.ts @@ -14,8 +14,7 @@ namespace pxsim { public setPressed(pressed: boolean) { this.pressed.push(pressed); - this.changed = true; - this.valueChanged = true; + this.setChangedState(); } public isPressed() { diff --git a/sim/visuals/nodes/colorSensorView.ts b/sim/visuals/nodes/colorSensorView.ts index ae321d0f..19ee2ed7 100644 --- a/sim/visuals/nodes/colorSensorView.ts +++ b/sim/visuals/nodes/colorSensorView.ts @@ -12,5 +12,9 @@ namespace pxsim.visuals { public getPaddingRatio() { return 1 / 8; } + + public updateState() { + // TODO: show different color modes + } } } \ No newline at end of file