diff --git a/sim/visuals/microbit.ts b/sim/visuals/microbit.ts index 14150156..f865e6f5 100644 --- a/sim/visuals/microbit.ts +++ b/sim/visuals/microbit.ts @@ -662,12 +662,12 @@ namespace pxsim.visuals { - - + svg.child(this.g, "rect", { class: "sim-thermometer", x: 85, - y: MB_HEIGHT - 192, + y: ty, width: 10, height: 80, rx: 5, ry: 5, fill: `url(#${gid})` }); this.thermometerText = svg.child(this.g, "text", { class: 'sim-text', - x: 100, y: MB_HEIGHT - 168 }) as SVGTextElement; + x: 100, y: MB_HEIGHT - 174 }) as SVGTextElement; this.updateTheme(); let pt = this.element.createSVGPoint(); svg.buttonEvents(this.thermometer, (ev) => { let cur = svg.cursorPoint(pt, this.element, ev); - let t = Math.max(0, Math.min(1, (80 - cur.y) / 80)) - state.thermometerState.temperature = Math.floor(tmin + t * (tmax - tmin)); + let t = Math.max(0, Math.min(1, (cur.y - ty - 5) / 70)) + state.thermometerState.temperature = Math.floor(tmax - t * (tmax - tmin)); this.updateTemperature(); }, ev => { }, ev => { }) }