pxt-microbit 5.0.1 → 5.0.4
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/hexcache/{7b81443eba5eb35bd5641711bb1366ea74e7bffa0deb1f29ba957bc48a272be2.hex → 523847a64a39d936972bb116ae62f3572fc68bbfaab239b9668a73843129f62d.hex} +9397 -9397
- package/built/hexcache/{64b3bde6cc2a08bff02c27b4f850c35c6b9da63143da33234243ef4c9a0a4ab3.hex → b3453e568175cf180eacd9bc7dbb01b5c8a3d08a615bc1f9c1da7291cd084375.hex} +9590 -9588
- package/built/sim.d.ts +1 -0
- package/built/sim.js +44 -34
- package/built/target.js +55 -55
- package/built/target.json +55 -55
- package/built/targetlight.json +6 -6
- package/built/web/react-common-authcode.css +13 -0
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/docs/reference/music/create-sound-effect.md +21 -1
- package/docs/reference/music/play-sound-effect.md +32 -2
- package/package.json +2 -2
- package/pxtarget.json +1 -1
- package/targetconfig.json +131 -131
package/built/sim.d.ts
CHANGED
|
@@ -747,6 +747,7 @@ declare namespace pxsim.visuals {
|
|
|
747
747
|
private attachPinsIOEvents;
|
|
748
748
|
private attachPinsTouchEvents;
|
|
749
749
|
private attachABEvents;
|
|
750
|
+
attachButtonEvents(stateButton: Button, buttonOuter: SVGElement, elButton: SVGElement): void;
|
|
750
751
|
private attachAPlusBEvents;
|
|
751
752
|
}
|
|
752
753
|
}
|
package/built/sim.js
CHANGED
|
@@ -2608,6 +2608,9 @@ var pxsim;
|
|
|
2608
2608
|
.sim-button {
|
|
2609
2609
|
pointer-events: none;
|
|
2610
2610
|
}
|
|
2611
|
+
.sim-head .sim-button {
|
|
2612
|
+
pointer-events: unset;
|
|
2613
|
+
}
|
|
2611
2614
|
.sim-board, .sim-display, sim-button {
|
|
2612
2615
|
fill: #111;
|
|
2613
2616
|
}
|
|
@@ -2903,10 +2906,12 @@ path.sim-board {
|
|
|
2903
2906
|
pxsim.svg.fill(this.buttonsOuter[2], theme.virtualButtonOuter);
|
|
2904
2907
|
pxsim.svg.fill(this.buttons[2], theme.virtualButtonUp);
|
|
2905
2908
|
pxsim.svg.fills(this.logos, theme.accent);
|
|
2906
|
-
if (this.domHardwareVersion > 1)
|
|
2909
|
+
if (this.domHardwareVersion > 1) {
|
|
2907
2910
|
pxsim.svg.fills(this.heads.slice(1), "gold");
|
|
2908
|
-
|
|
2911
|
+
}
|
|
2912
|
+
else {
|
|
2909
2913
|
pxsim.svg.fills(this.heads.slice(1), theme.accent);
|
|
2914
|
+
}
|
|
2910
2915
|
if (this.shakeButton)
|
|
2911
2916
|
pxsim.svg.fill(this.shakeButton, theme.virtualButtonUp);
|
|
2912
2917
|
this.pinGradients.forEach(lg => pxsim.svg.setGradientColors(lg, theme.pin, theme.pinActive));
|
|
@@ -3480,7 +3485,7 @@ path.sim-board {
|
|
|
3480
3485
|
// head
|
|
3481
3486
|
this.head = pxsim.svg.child(this.g, "g", { class: "sim-head" });
|
|
3482
3487
|
pxsim.svg.child(this.head, "circle", { cx: 258, cy: 75, r: 100, fill: "transparent" });
|
|
3483
|
-
this.headParts = pxsim.svg.child(this.head, "g", {
|
|
3488
|
+
this.headParts = pxsim.svg.child(this.head, "g", {});
|
|
3484
3489
|
this.heads = [];
|
|
3485
3490
|
// background
|
|
3486
3491
|
this.heads.push(pxsim.svg.path(this.headParts, "sim-button", "M 269.9 50.2 L 269.9 50.2 l -39.5 0 v 0 c -14.1 0.1 -24.6 10.7 -24.6 24.8 c 0 13.9 10.4 24.4 24.3 24.7 v 0 h 39.6 c 14.2 0 24.8 -10.6 24.8 -24.7 C 294.5 61 284 50.3 269.9 50.2 M 269.7 89.2"));
|
|
@@ -3587,6 +3592,8 @@ path.sim-board {
|
|
|
3587
3592
|
const headTitle = pxsim.localization.lf("logo touch (micro:bit v2 needed)");
|
|
3588
3593
|
pxsim.accessibility.makeFocusable(this.headParts);
|
|
3589
3594
|
pxsim.accessibility.setAria(this.headParts, "button", headTitle);
|
|
3595
|
+
this.headParts.setAttribute("class", "sim-button-outer sim-button-group");
|
|
3596
|
+
this.attachButtonEvents(this.board.logoTouch, this.headParts, this.headParts);
|
|
3590
3597
|
// microphone led
|
|
3591
3598
|
const microphoneTitle = pxsim.localization.lf("microphone (micro:bit v2 needed)");
|
|
3592
3599
|
const microg = pxsim.svg.child(this.g, "g", { title: microphoneTitle });
|
|
@@ -3785,38 +3792,41 @@ path.sim-board {
|
|
|
3785
3792
|
}
|
|
3786
3793
|
attachABEvents() {
|
|
3787
3794
|
const bpState = this.board.buttonPairState;
|
|
3788
|
-
const stateButtons = [bpState.aBtn, bpState.bBtn
|
|
3789
|
-
const elButtonOuters = this.buttonsOuter.slice(0, 2)
|
|
3790
|
-
const elButtons = this.buttons.slice(0, 2)
|
|
3795
|
+
const stateButtons = [bpState.aBtn, bpState.bBtn];
|
|
3796
|
+
const elButtonOuters = this.buttonsOuter.slice(0, 2);
|
|
3797
|
+
const elButtons = this.buttons.slice(0, 2);
|
|
3791
3798
|
elButtonOuters.forEach((btn, index) => {
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
this.board.bus.queue(
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3799
|
+
this.attachButtonEvents(stateButtons[index], btn, elButtons[index]);
|
|
3800
|
+
});
|
|
3801
|
+
}
|
|
3802
|
+
attachButtonEvents(stateButton, buttonOuter, elButton) {
|
|
3803
|
+
let pressedTime;
|
|
3804
|
+
pxsim.pointerEvents.down.forEach(evid => buttonOuter.addEventListener(evid, ev => {
|
|
3805
|
+
// console.log(`down ${stateButton.id}`)
|
|
3806
|
+
stateButton.pressed = true;
|
|
3807
|
+
pxsim.svg.fill(elButton, this.props.theme.buttonDown);
|
|
3808
|
+
this.board.bus.queue(stateButton.id, 1 /* MICROBIT_BUTTON_EVT_DOWN */);
|
|
3809
|
+
pressedTime = pxsim.runtime.runningTime();
|
|
3810
|
+
}));
|
|
3811
|
+
buttonOuter.addEventListener(pxsim.pointerEvents.leave, ev => {
|
|
3812
|
+
stateButton.pressed = false;
|
|
3813
|
+
pxsim.svg.fill(elButton, this.props.theme.buttonUp);
|
|
3814
|
+
});
|
|
3815
|
+
buttonOuter.addEventListener(pxsim.pointerEvents.up, ev => {
|
|
3816
|
+
stateButton.pressed = false;
|
|
3817
|
+
pxsim.svg.fill(elButton, this.props.theme.buttonUp);
|
|
3818
|
+
this.board.bus.queue(stateButton.id, 2 /* MICROBIT_BUTTON_EVT_UP */);
|
|
3819
|
+
const currentTime = pxsim.runtime.runningTime();
|
|
3820
|
+
if (currentTime - pressedTime > 1000 /* DEVICE_BUTTON_LONG_CLICK_TIME */)
|
|
3821
|
+
this.board.bus.queue(stateButton.id, 4 /* MICROBIT_BUTTON_EVT_LONG_CLICK */);
|
|
3822
|
+
else
|
|
3823
|
+
this.board.bus.queue(stateButton.id, 3 /* MICROBIT_BUTTON_EVT_CLICK */);
|
|
3824
|
+
pressedTime = undefined;
|
|
3825
|
+
});
|
|
3826
|
+
pxsim.accessibility.enableKeyboardInteraction(buttonOuter, undefined, () => {
|
|
3827
|
+
this.board.bus.queue(stateButton.id, 1 /* MICROBIT_BUTTON_EVT_DOWN */);
|
|
3828
|
+
this.board.bus.queue(stateButton.id, 2 /* MICROBIT_BUTTON_EVT_UP */);
|
|
3829
|
+
this.board.bus.queue(stateButton.id, 3 /* MICROBIT_BUTTON_EVT_CLICK */);
|
|
3820
3830
|
});
|
|
3821
3831
|
}
|
|
3822
3832
|
attachAPlusBEvents() {
|