V4 updates (#210)

* update pxt.json files

* Fix button event enums

fixes https://github.com/microsoft/pxt-calliope/issues/206

* Fix Safari CSS Rule for iOS app

fixes https://github.com/microsoft/pxt-calliope/issues/205

* aprove preffered repos

should fix https://github.com/microsoft/pxt-calliope/issues/167
This commit is contained in:
Juri Wolf
2023-01-11 18:51:27 +01:00
committed by GitHub
parent 1aaedf1fa0
commit 77ed2ccfb1
62 changed files with 223 additions and 162 deletions

12
libs/core/enums.d.ts vendored
View File

@ -39,21 +39,11 @@ declare namespace basic {
}
declare const enum ButtonEvent {
//% blockIdentity="input.buttonEventValueId"
//% block="pressed down"
declare const enum ButtonEvents {
Down = 1, // MICROBIT_BUTTON_EVT_DOWN
//% blockIdentity="input.buttonEventValueId"
//% block="released up"
Up = 2, // MICROBIT_BUTTON_EVT_UP
//% blockIdentity="input.buttonEventValueId"
//% block="clicked"
Click = 3, // MICROBIT_BUTTON_EVT_CLICK
//% blockIdentity="input.buttonEventValueId"
//% block="long clicked"
LongClick = 4, // MICROBIT_BUTTON_EVT_LONG_CLICK
//% blockIdentity="input.buttonEventValueId"
//% block="hold"
Hold = 5, // MICROBIT_BUTTON_EVT_HOLD
}

View File

@ -323,9 +323,9 @@ namespace game {
}
function unplugEvents(): void {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { });
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { });
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => { });
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => { });
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
control.reset();
});
}

View File

@ -7,21 +7,11 @@ enum class Button {
AB = MICROBIT_ID_BUTTON_AB,
};
enum class ButtonEvent {
//% blockIdentity="input.buttonEventValueId"
//% block="pressed down"
enum class ButtonEvents {
Down = MICROBIT_BUTTON_EVT_DOWN,
//% blockIdentity="input.buttonEventValueId"
//% block="released up"
Up = MICROBIT_BUTTON_EVT_UP,
//% blockIdentity="input.buttonEventValueId"
//% block="clicked"
Click = MICROBIT_BUTTON_EVT_CLICK,
//% blockIdentity="input.buttonEventValueId"
//% block="long clicked"
LongClick = MICROBIT_BUTTON_EVT_LONG_CLICK,
//% blockIdentity="input.buttonEventValueId"
//% block="hold"
Hold = MICROBIT_BUTTON_EVT_HOLD,
};

View File

@ -1,3 +1,23 @@
enum ButtonEvent {
//% blockIdentity="input.buttonEventValueId"
//% block="pressed down"
Down = ButtonEvents.Down,
//% blockIdentity="input.buttonEventValueId"
//% block="released up"
Up = ButtonEvents.Up,
//% blockIdentity="input.buttonEventValueId"
//% block="clicked"
Click = ButtonEvents.Click,
//% blockIdentity="input.buttonEventValueId"
//% block="long clicked"
LongClick = ButtonEvents.LongClick,
//% blockIdentity="input.buttonEventValueId"
//% block="hold"
Hold = ButtonEvents.Hold,
};
/**
* Events and data from sensors
*/
@ -10,7 +30,7 @@ namespace input {
*/
//% help=input/button-event
//% weight=19 blockId="control_button_event_value" block="%id"
//% shim=TD_ID advanced=true
//% advanced=true
//% group="Events"
export function buttonEventValue(id: ButtonEvent): number {
return id;

View File

@ -1,7 +1,7 @@
{
"name": "core",
"description": "The microbit core library",
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/base",
"dependencies": {},
"files": [
"README.md",
"platform.h",
@ -76,7 +76,7 @@
],
"testFiles": [],
"public": true,
"dependencies": {},
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/base",
"dalDTS": {
"compileServiceVariant": "mbcodal",
"includeDirs": [
@ -172,5 +172,6 @@
}
}
]
}
}
},
"partial": true
}