pxt-microbit 7.1.37 → 7.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/block-tests.js +1 -1
- package/built/sim.js +53 -32
- package/built/target.js +1 -1
- package/built/target.json +1 -1
- package/built/targetlight.js +1 -1
- package/built/targetlight.json +1 -1
- package/built/theme.json +1 -1
- package/built/web/blockly.css +1 -1
- package/built/web/rtlblockly.css +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/package.json +4 -10
- package/pxtarget.json +1 -0
package/built/sim.js
CHANGED
|
@@ -3984,8 +3984,8 @@ var pxsim;
|
|
|
3984
3984
|
stroke-width:2px;
|
|
3985
3985
|
}
|
|
3986
3986
|
|
|
3987
|
-
.sim-pin-touch.touched
|
|
3988
|
-
stroke:darkorange;
|
|
3987
|
+
.sim-pin-touch.touched {
|
|
3988
|
+
stroke:darkorange !important;
|
|
3989
3989
|
}
|
|
3990
3990
|
|
|
3991
3991
|
.sim-led-back:hover {
|
|
@@ -4341,12 +4341,12 @@ path.sim-board {
|
|
|
4341
4341
|
}
|
|
4342
4342
|
updateButtonPairs() {
|
|
4343
4343
|
const state = this.board;
|
|
4344
|
-
const
|
|
4345
|
-
const
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4344
|
+
const { buttonDown, buttonUp, virtualButtonUp } = this.props.theme;
|
|
4345
|
+
const { aBtn, bBtn, abBtn } = state.buttonPairState;
|
|
4346
|
+
pxsim.svg.fill(this.buttons[0], aBtn.pressed ? buttonDown : buttonUp);
|
|
4347
|
+
pxsim.svg.fill(this.buttons[1], bBtn.pressed ? buttonDown : buttonUp);
|
|
4348
|
+
pxsim.svg.fill(this.buttons[2], abBtn.pressed ? buttonDown : virtualButtonUp);
|
|
4349
|
+
pxsim.svg.fill(this.headParts, state.logoTouch.pressed ? buttonDown : buttonUp);
|
|
4350
4350
|
}
|
|
4351
4351
|
updateLEDMatrix() {
|
|
4352
4352
|
const state = this.board;
|
|
@@ -4395,7 +4395,10 @@ path.sim-board {
|
|
|
4395
4395
|
pxsim.svg.fill(this.shakeButton, this.props.theme.virtualButtonUp);
|
|
4396
4396
|
this.board.accelerometerState.shake();
|
|
4397
4397
|
});
|
|
4398
|
-
pxsim.accessibility.enableKeyboardInteraction(this.shakeButton,
|
|
4398
|
+
pxsim.accessibility.enableKeyboardInteraction(this.shakeButton, () => {
|
|
4399
|
+
pxsim.svg.fill(this.shakeButton, this.props.theme.buttonDown);
|
|
4400
|
+
}, () => {
|
|
4401
|
+
pxsim.svg.fill(this.shakeButton, this.props.theme.virtualButtonUp);
|
|
4399
4402
|
this.board.accelerometerState.shake();
|
|
4400
4403
|
});
|
|
4401
4404
|
pxsim.accessibility.setAria(this.shakeButton, "button", "Shake the board");
|
|
@@ -5035,6 +5038,14 @@ path.sim-board {
|
|
|
5035
5038
|
return lg;
|
|
5036
5039
|
});
|
|
5037
5040
|
this.pinTexts = [67, 165, 275].map(x => pxsim.svg.child(this.g, "text", { class: "sim-text-pin", x: x, y: 345 }));
|
|
5041
|
+
pxsim.svg.path(this.g, "sim-label", "M35.7,376.4c0-2.8,2.1-5.1,5.5-5.1c3.3,0,5.5,2.4,5.5,5.1v4.7c0,2.8-2.2,5.1-5.5,5.1c-3.3,0-5.5-2.4-5.5-5.1V376.4zM43.3,376.4c0-1.3-0.8-2.3-2.2-2.3c-1.3,0-2.1,1.1-2.1,2.3v4.7c0,1.2,0.8,2.3,2.1,2.3c1.3,0,2.2-1.1,2.2-2.3V376.4z");
|
|
5042
|
+
pxsim.svg.path(this.g, "sim-label", "M136.2,374.1c2.8,0,3.4-0.8,3.4-2.5h2.9v14.3h-3.4v-9.5h-3V374.1z");
|
|
5043
|
+
pxsim.svg.path(this.g, "sim-label", "M248.6,378.5c1.7-1,3-1.7,3-3.1c0-1.1-0.7-1.6-1.6-1.6c-1,0-1.8,0.6-1.8,2.1h-3.3c0-2.6,1.8-4.6,5.1-4.6c2.6,0,4.9,1.3,4.9,4.3c0,2.4-2.3,3.9-3.8,4.7c-2,1.3-2.5,1.8-2.5,2.9h6.1v2.7h-10C244.8,381.2,246.4,379.9,248.6,378.5z");
|
|
5044
|
+
pxsim.svg.path(this.g, "sim-label", "M352.1,381.1c0,1.6,0.9,2.5,2.2,2.5c1.2,0,1.9-0.9,1.9-1.9c0-1.2-0.6-2-2.1-2h-1.3v-2.6h1.3c1.5,0,1.9-0.7,1.9-1.8c0-1.1-0.7-1.6-1.6-1.6c-1.4,0-1.8,0.8-1.8,2.1h-3.3c0-2.4,1.5-4.6,5.1-4.6c2.6,0,5,1.3,5,4c0,1.6-1,2.8-2.1,3.2c1.3,0.5,2.3,1.6,2.3,3.5c0,2.7-2.4,4.3-5.2,4.3c-3.5,0-5.5-2.1-5.5-5.1H352.1z");
|
|
5045
|
+
pxsim.svg.path(this.g, "sim-label", "M368.5,385.9h-3.1l-5.1-14.3h3.5l3.1,10.1l3.1-10.1h3.6L368.5,385.9z");
|
|
5046
|
+
pxsim.svg.path(this.g, "sim-label", "M444.4,378.3h7.4v2.5h-1.5c-0.6,3.3-3,5.5-7.1,5.5c-4.8,0-7.5-3.5-7.5-7.5c0-3.9,2.8-7.5,7.5-7.5c3.8,0,6.4,2.3,6.6,5h-3.5c-0.2-1.1-1.4-2.2-3.1-2.2c-2.7,0-4.1,2.3-4.1,4.7c0,2.5,1.4,4.7,4.4,4.7c2,0,3.2-1.2,3.4-2.7h-2.5V378.3z");
|
|
5047
|
+
pxsim.svg.path(this.g, "sim-label", "M461.4,380.9v-9.3h3.3v14.3h-3.5l-5.2-9.2v9.2h-3.3v-14.3h3.5L461.4,380.9z");
|
|
5048
|
+
pxsim.svg.path(this.g, "sim-label", "M472.7,371.6c4.8,0,7.5,3.5,7.5,7.2s-2.7,7.2-7.5,7.2h-5.3v-14.3H472.7z M470.8,374.4v8.6h1.8c2.7,0,4.2-2.1,4.2-4.3s-1.6-4.3-4.2-4.3H470.8z");
|
|
5038
5049
|
}
|
|
5039
5050
|
buildShakeElement() {
|
|
5040
5051
|
this.shakeButton = pxsim.svg.child(this.g, "circle", {
|
|
@@ -5072,16 +5083,8 @@ path.sim-board {
|
|
|
5072
5083
|
this.buttonsOuter[2].style.visibility = "hidden";
|
|
5073
5084
|
this.buttons[2].style.visibility = "hidden";
|
|
5074
5085
|
this.buttons.forEach(btn => pxsim.svg.hydrate(btn, { fill: "#111" }));
|
|
5075
|
-
pxsim.svg.path(this.g, "sim-label", "M35.7,376.4c0-2.8,2.1-5.1,5.5-5.1c3.3,0,5.5,2.4,5.5,5.1v4.7c0,2.8-2.2,5.1-5.5,5.1c-3.3,0-5.5-2.4-5.5-5.1V376.4zM43.3,376.4c0-1.3-0.8-2.3-2.2-2.3c-1.3,0-2.1,1.1-2.1,2.3v4.7c0,1.2,0.8,2.3,2.1,2.3c1.3,0,2.2-1.1,2.2-2.3V376.4z");
|
|
5076
|
-
pxsim.svg.path(this.g, "sim-label", "M136.2,374.1c2.8,0,3.4-0.8,3.4-2.5h2.9v14.3h-3.4v-9.5h-3V374.1z");
|
|
5077
|
-
pxsim.svg.path(this.g, "sim-label", "M248.6,378.5c1.7-1,3-1.7,3-3.1c0-1.1-0.7-1.6-1.6-1.6c-1,0-1.8,0.6-1.8,2.1h-3.3c0-2.6,1.8-4.6,5.1-4.6c2.6,0,4.9,1.3,4.9,4.3c0,2.4-2.3,3.9-3.8,4.7c-2,1.3-2.5,1.8-2.5,2.9h6.1v2.7h-10C244.8,381.2,246.4,379.9,248.6,378.5z");
|
|
5078
5086
|
pxsim.svg.path(this.g, "sim-button-label", "M48.1,270.9l-0.6-1.7h-5.1l-0.6,1.7h-3.5l5.1-14.3h3.1l5.2,14.3H48.1z M45,260.7l-1.8,5.9h3.5L45,260.7z");
|
|
5079
5087
|
pxsim.svg.path(this.g, "sim-button-label", "M449.1,135.8h5.9c3.9,0,4.7,2.4,4.7,3.9c0,1.8-1.4,2.9-2.5,3.2c0.9,0,2.6,1.1,2.6,3.3c0,1.5-0.8,4-4.7,4h-6V135.8zM454.4,141.7c1.6,0,2-1,2-1.7c0-0.6-0.3-1.7-2-1.7h-2v3.4H454.4z M452.4,144.1v3.5h2.1c1.6,0,2-1,2-1.8c0-0.7-0.4-1.8-2-1.8H452.4z");
|
|
5080
|
-
pxsim.svg.path(this.g, "sim-label", "M352.1,381.1c0,1.6,0.9,2.5,2.2,2.5c1.2,0,1.9-0.9,1.9-1.9c0-1.2-0.6-2-2.1-2h-1.3v-2.6h1.3c1.5,0,1.9-0.7,1.9-1.8c0-1.1-0.7-1.6-1.6-1.6c-1.4,0-1.8,0.8-1.8,2.1h-3.3c0-2.4,1.5-4.6,5.1-4.6c2.6,0,5,1.3,5,4c0,1.6-1,2.8-2.1,3.2c1.3,0.5,2.3,1.6,2.3,3.5c0,2.7-2.4,4.3-5.2,4.3c-3.5,0-5.5-2.1-5.5-5.1H352.1z");
|
|
5081
|
-
pxsim.svg.path(this.g, "sim-label", "M368.5,385.9h-3.1l-5.1-14.3h3.5l3.1,10.1l3.1-10.1h3.6L368.5,385.9z");
|
|
5082
|
-
pxsim.svg.path(this.g, "sim-label", "M444.4,378.3h7.4v2.5h-1.5c-0.6,3.3-3,5.5-7.1,5.5c-4.8,0-7.5-3.5-7.5-7.5c0-3.9,2.8-7.5,7.5-7.5c3.8,0,6.4,2.3,6.6,5h-3.5c-0.2-1.1-1.4-2.2-3.1-2.2c-2.7,0-4.1,2.3-4.1,4.7c0,2.5,1.4,4.7,4.4,4.7c2,0,3.2-1.2,3.4-2.7h-2.5V378.3z");
|
|
5083
|
-
pxsim.svg.path(this.g, "sim-label", "M461.4,380.9v-9.3h3.3v14.3h-3.5l-5.2-9.2v9.2h-3.3v-14.3h3.5L461.4,380.9z");
|
|
5084
|
-
pxsim.svg.path(this.g, "sim-label", "M472.7,371.6c4.8,0,7.5,3.5,7.5,7.2s-2.7,7.2-7.5,7.2h-5.3v-14.3H472.7z M470.8,374.4v8.6h1.8c2.7,0,4.2-2.1,4.2-4.3s-1.6-4.3-4.2-4.3H470.8z");
|
|
5085
5088
|
}
|
|
5086
5089
|
updateHardwareVersion() {
|
|
5087
5090
|
// check if microphone has been used
|
|
@@ -5315,9 +5318,19 @@ path.sim-board {
|
|
|
5315
5318
|
this.board.bus.queue(state.edgeConnectorState.pins[index].id, 3 /* DAL.MICROBIT_BUTTON_EVT_CLICK */);
|
|
5316
5319
|
pressedTime = undefined;
|
|
5317
5320
|
});
|
|
5318
|
-
pxsim.accessibility.enableKeyboardInteraction(btn,
|
|
5321
|
+
pxsim.accessibility.enableKeyboardInteraction(btn, () => {
|
|
5319
5322
|
let state = this.board;
|
|
5323
|
+
state.edgeConnectorState.pins[index].touched = true;
|
|
5324
|
+
let svgpin = this.pins[index];
|
|
5325
|
+
pxsim.U.addClass(svgpin, "touched");
|
|
5326
|
+
this.updatePin(state.edgeConnectorState.pins[index], index);
|
|
5320
5327
|
this.board.bus.queue(state.edgeConnectorState.pins[index].id, 1 /* DAL.MICROBIT_BUTTON_EVT_DOWN */);
|
|
5328
|
+
}, () => {
|
|
5329
|
+
let state = this.board;
|
|
5330
|
+
state.edgeConnectorState.pins[index].touched = false;
|
|
5331
|
+
let svgpin = this.pins[index];
|
|
5332
|
+
pxsim.U.removeClass(svgpin, "touched");
|
|
5333
|
+
this.updatePin(state.edgeConnectorState.pins[index], index);
|
|
5321
5334
|
this.board.bus.queue(state.edgeConnectorState.pins[index].id, 2 /* DAL.MICROBIT_BUTTON_EVT_UP */);
|
|
5322
5335
|
this.board.bus.queue(state.edgeConnectorState.pins[index].id, 3 /* DAL.MICROBIT_BUTTON_EVT_CLICK */);
|
|
5323
5336
|
});
|
|
@@ -5335,19 +5348,19 @@ path.sim-board {
|
|
|
5335
5348
|
attachButtonEvents(stateButton, buttonOuter, elButton) {
|
|
5336
5349
|
let pressedTime;
|
|
5337
5350
|
pxsim.pointerEvents.down.forEach(evid => buttonOuter.addEventListener(evid, ev => {
|
|
5338
|
-
// console.log(`down ${stateButton.id}`)
|
|
5339
5351
|
stateButton.pressed = true;
|
|
5340
|
-
|
|
5352
|
+
this.updateButtonPairs();
|
|
5341
5353
|
this.board.bus.queue(stateButton.id, 1 /* DAL.MICROBIT_BUTTON_EVT_DOWN */);
|
|
5342
5354
|
pressedTime = pxsim.runtime.runningTime();
|
|
5343
5355
|
}));
|
|
5344
5356
|
buttonOuter.addEventListener(pxsim.pointerEvents.leave, ev => {
|
|
5345
5357
|
stateButton.pressed = false;
|
|
5358
|
+
this.updateButtonPairs();
|
|
5346
5359
|
pxsim.svg.fill(elButton, this.props.theme.buttonUp);
|
|
5347
5360
|
});
|
|
5348
5361
|
buttonOuter.addEventListener(pxsim.pointerEvents.up, ev => {
|
|
5349
5362
|
stateButton.pressed = false;
|
|
5350
|
-
|
|
5363
|
+
this.updateButtonPairs();
|
|
5351
5364
|
this.board.bus.queue(stateButton.id, 2 /* DAL.MICROBIT_BUTTON_EVT_UP */);
|
|
5352
5365
|
const currentTime = pxsim.runtime.runningTime();
|
|
5353
5366
|
if (currentTime - pressedTime > 1000 /* DAL.DEVICE_BUTTON_LONG_CLICK_TIME */)
|
|
@@ -5356,8 +5369,13 @@ path.sim-board {
|
|
|
5356
5369
|
this.board.bus.queue(stateButton.id, 3 /* DAL.MICROBIT_BUTTON_EVT_CLICK */);
|
|
5357
5370
|
pressedTime = undefined;
|
|
5358
5371
|
});
|
|
5359
|
-
pxsim.accessibility.enableKeyboardInteraction(buttonOuter,
|
|
5372
|
+
pxsim.accessibility.enableKeyboardInteraction(buttonOuter, () => {
|
|
5373
|
+
stateButton.pressed = true;
|
|
5374
|
+
this.updateButtonPairs();
|
|
5360
5375
|
this.board.bus.queue(stateButton.id, 1 /* DAL.MICROBIT_BUTTON_EVT_DOWN */);
|
|
5376
|
+
}, () => {
|
|
5377
|
+
stateButton.pressed = false;
|
|
5378
|
+
this.updateButtonPairs();
|
|
5361
5379
|
this.board.bus.queue(stateButton.id, 2 /* DAL.MICROBIT_BUTTON_EVT_UP */);
|
|
5362
5380
|
this.board.bus.queue(stateButton.id, 3 /* DAL.MICROBIT_BUTTON_EVT_CLICK */);
|
|
5363
5381
|
});
|
|
@@ -5370,9 +5388,7 @@ path.sim-board {
|
|
|
5370
5388
|
bpState.aBtn.pressed = true;
|
|
5371
5389
|
bpState.bBtn.pressed = true;
|
|
5372
5390
|
bpState.abBtn.pressed = true;
|
|
5373
|
-
|
|
5374
|
-
pxsim.svg.fill(this.buttons[1], this.props.theme.buttonDown);
|
|
5375
|
-
pxsim.svg.fill(this.buttons[2], this.props.theme.buttonDown);
|
|
5391
|
+
this.updateButtonPairs();
|
|
5376
5392
|
this.board.bus.queue(bpState.abBtn.id, 1 /* DAL.MICROBIT_BUTTON_EVT_DOWN */);
|
|
5377
5393
|
pressedTime = pxsim.runtime.runningTime();
|
|
5378
5394
|
}));
|
|
@@ -5380,17 +5396,13 @@ path.sim-board {
|
|
|
5380
5396
|
bpState.aBtn.pressed = false;
|
|
5381
5397
|
bpState.bBtn.pressed = false;
|
|
5382
5398
|
bpState.abBtn.pressed = false;
|
|
5383
|
-
|
|
5384
|
-
pxsim.svg.fill(this.buttons[1], this.props.theme.buttonUp);
|
|
5385
|
-
pxsim.svg.fill(this.buttons[2], this.props.theme.virtualButtonUp);
|
|
5399
|
+
this.updateButtonPairs();
|
|
5386
5400
|
});
|
|
5387
5401
|
this.buttonsOuter[2].addEventListener(pxsim.pointerEvents.up, ev => {
|
|
5388
5402
|
bpState.aBtn.pressed = false;
|
|
5389
5403
|
bpState.bBtn.pressed = false;
|
|
5390
5404
|
bpState.abBtn.pressed = false;
|
|
5391
|
-
|
|
5392
|
-
pxsim.svg.fill(this.buttons[1], this.props.theme.buttonUp);
|
|
5393
|
-
pxsim.svg.fill(this.buttons[2], this.props.theme.virtualButtonUp);
|
|
5405
|
+
this.updateButtonPairs();
|
|
5394
5406
|
this.board.bus.queue(bpState.abBtn.id, 2 /* DAL.MICROBIT_BUTTON_EVT_UP */);
|
|
5395
5407
|
const currentTime = pxsim.runtime.runningTime();
|
|
5396
5408
|
if (currentTime - pressedTime > 1000 /* DAL.DEVICE_BUTTON_LONG_CLICK_TIME */)
|
|
@@ -5399,8 +5411,17 @@ path.sim-board {
|
|
|
5399
5411
|
this.board.bus.queue(bpState.abBtn.id, 3 /* DAL.MICROBIT_BUTTON_EVT_CLICK */);
|
|
5400
5412
|
pressedTime = undefined;
|
|
5401
5413
|
});
|
|
5402
|
-
pxsim.accessibility.enableKeyboardInteraction(this.buttonsOuter[2],
|
|
5414
|
+
pxsim.accessibility.enableKeyboardInteraction(this.buttonsOuter[2], () => {
|
|
5415
|
+
bpState.aBtn.pressed = true;
|
|
5416
|
+
bpState.bBtn.pressed = true;
|
|
5417
|
+
bpState.abBtn.pressed = true;
|
|
5418
|
+
this.updateButtonPairs();
|
|
5403
5419
|
this.board.bus.queue(bpState.abBtn.id, 1 /* DAL.MICROBIT_BUTTON_EVT_DOWN */);
|
|
5420
|
+
}, () => {
|
|
5421
|
+
bpState.aBtn.pressed = false;
|
|
5422
|
+
bpState.bBtn.pressed = false;
|
|
5423
|
+
bpState.abBtn.pressed = false;
|
|
5424
|
+
this.updateButtonPairs();
|
|
5404
5425
|
this.board.bus.queue(bpState.abBtn.id, 2 /* DAL.MICROBIT_BUTTON_EVT_UP */);
|
|
5405
5426
|
this.board.bus.queue(bpState.abBtn.id, 3 /* DAL.MICROBIT_BUTTON_EVT_CLICK */);
|
|
5406
5427
|
});
|