buttons -> brick buttons

This commit is contained in:
Peli de Halleux 2017-10-24 16:25:03 -07:00
parent 46175fc7db
commit fa6c81cf80

View File

@ -86,13 +86,10 @@ namespace input {
//% help=input/button/is-pressed //% help=input/button/is-pressed
//% block="%button|is pressed" //% block="%button|is pressed"
//% blockId=buttonIsPressed //% blockId=buttonIsPressed
//% parts="buttonpair" //% parts="brick"
//% blockNamespace=input //% blockNamespace=input
//% button.fieldEditor="gridpicker"
//% button.fieldOptions.width=220
//% button.fieldOptions.columns=3
//% weight=81 blockGap=8 //% weight=81 blockGap=8
//% group="Buttons" //% group="Brick buttons"
isPressed() { isPressed() {
return this._isPressed return this._isPressed
} }
@ -104,13 +101,10 @@ namespace input {
//% help=input/button/was-pressed //% help=input/button/was-pressed
//% block="%button|was pressed" //% block="%button|was pressed"
//% blockId=buttonWasPressed //% blockId=buttonWasPressed
//% parts="buttonpair" //% parts="brick"
//% blockNamespace=input //% blockNamespace=input
//% button.fieldEditor="gridpicker"
//% button.fieldOptions.width=220
//% button.fieldOptions.columns=3
//% weight=80 blockGap=8 //% weight=80 blockGap=8
//% group="Buttons" //% group="Brick buttons"
wasPressed() { wasPressed() {
const r = this._wasPressed const r = this._wasPressed
this._wasPressed = false this._wasPressed = false
@ -125,13 +119,10 @@ namespace input {
*/ */
//% help=input/button/on-event //% help=input/button/on-event
//% blockId=buttonEvent block="on %button|%event" //% blockId=buttonEvent block="on %button|%event"
//% parts="buttonpair" //% parts="brick"
//% blockNamespace=input //% blockNamespace=input
//% button.fieldEditor="gridpicker"
//% button.fieldOptions.width=220
//% button.fieldOptions.columns=3
//% weight=99 blockGap=8 //% weight=99 blockGap=8
//% group="Buttons" //% group="Brick buttons"
onEvent(ev: ButtonEvent, body: () => void) { onEvent(ev: ButtonEvent, body: () => void) {
control.onEvent(this._id, ev, body) control.onEvent(this._id, ev, body)
} }
@ -186,31 +177,31 @@ namespace input {
initBtns() // always ON as it handles ESCAPE button initBtns() // always ON as it handles ESCAPE button
/** /**
* Left button. * Left button on the EV3 Brick.
*/ */
//% whenUsed block="button left" weight=95 fixedInstance //% whenUsed block="button left" weight=95 fixedInstance
export const buttonLeft: Button = new DevButton(DAL.BUTTON_ID_LEFT) export const buttonLeft: Button = new DevButton(DAL.BUTTON_ID_LEFT)
/** /**
* Right button. * Right button on the EV3 Brick.
*/ */
//% whenUsed block="button right" weight=94 fixedInstance //% whenUsed block="button right" weight=94 fixedInstance
export const buttonRight: Button = new DevButton(DAL.BUTTON_ID_RIGHT) export const buttonRight: Button = new DevButton(DAL.BUTTON_ID_RIGHT)
/** /**
* Up button. * Up button on the EV3 Brick.
*/ */
//% whenUsed block="button up" weight=95 fixedInstance //% whenUsed block="button up" weight=95 fixedInstance
export const buttonUp: Button = new DevButton(DAL.BUTTON_ID_UP) export const buttonUp: Button = new DevButton(DAL.BUTTON_ID_UP)
/** /**
* Down button. * Down button on the EV3 Brick.
*/ */
//% whenUsed block="button down" weight=95 fixedInstance //% whenUsed block="button down" weight=95 fixedInstance
export const buttonDown: Button = new DevButton(DAL.BUTTON_ID_DOWN) export const buttonDown: Button = new DevButton(DAL.BUTTON_ID_DOWN)
/** /**
* Enter button. * Enter button on the EV3 Brick.
*/ */
//% whenUsed block="button enter" weight=95 fixedInstance //% whenUsed block="button enter" weight=95 fixedInstance
export const buttonEnter: Button = new DevButton(DAL.BUTTON_ID_ENTER) export const buttonEnter: Button = new DevButton(DAL.BUTTON_ID_ENTER)