using icons on drop downs
This commit is contained in:
@ -13,8 +13,8 @@
|
||||
"LightCondition.Dark|block": "dark",
|
||||
"LightIntensityMode.Ambient|block": "ambient light",
|
||||
"LightIntensityMode.Reflected|block": "reflected light",
|
||||
"sensors.ColorSensor.color|block": "`icons.colorSensor` %color| color",
|
||||
"sensors.ColorSensor.light|block": "`icons.colorSensor` %color|%mode",
|
||||
"sensors.ColorSensor.color|block": "`icons.colorSensor` %sensor| color",
|
||||
"sensors.ColorSensor.light|block": "`icons.colorSensor` %sensor|%mode",
|
||||
"sensors.ColorSensor.onColorDetected|block": "on `icons.colorSensor` %sensor|detected color %color",
|
||||
"sensors.ColorSensor.onLightChanged|block": "on `icons.colorSensor` %sensor|%mode|%condition",
|
||||
"sensors.color1|block": "1",
|
||||
|
@ -100,6 +100,8 @@ namespace sensors {
|
||||
//% block="on `icons.colorSensor` %sensor|detected color %color"
|
||||
//% blockId=colorOnColorDetected
|
||||
//% parts="colorsensor"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=100 blockGap=8
|
||||
//% group="Color Sensor"
|
||||
@ -113,12 +115,14 @@ namespace sensors {
|
||||
|
||||
/**
|
||||
* Get the current color from the color sensor.
|
||||
* @param color the color sensor to query the request
|
||||
* @param sensor the color sensor to query the request
|
||||
*/
|
||||
//% help=sensors/color-sensor/color
|
||||
//% block="`icons.colorSensor` %color| color"
|
||||
//% block="`icons.colorSensor` %sensor| color"
|
||||
//% blockId=colorGetColor
|
||||
//% parts="colorsensor"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=99
|
||||
//% group="Color Sensor"
|
||||
@ -136,6 +140,8 @@ namespace sensors {
|
||||
//% block="on `icons.colorSensor` %sensor|%mode|%condition"
|
||||
//% blockId=colorOnLightChanged
|
||||
//% parts="colorsensor"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=89 blockGap=8
|
||||
//% group="Color Sensor"
|
||||
@ -146,12 +152,14 @@ namespace sensors {
|
||||
|
||||
/**
|
||||
* Measures the ambient or reflected light value from 0 (darkest) to 100 (brightest).
|
||||
* @param color the color sensor port
|
||||
* @param sensor the color sensor port
|
||||
*/
|
||||
//% help=sensors/color-sensor/light
|
||||
//% block="`icons.colorSensor` %color|%mode"
|
||||
//% block="`icons.colorSensor` %sensor|%mode"
|
||||
//% blockId=colorLight
|
||||
//% parts="colorsensor"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=88
|
||||
//% group="Color Sensor"
|
||||
@ -171,15 +179,15 @@ namespace sensors {
|
||||
}
|
||||
}
|
||||
|
||||
//% whenUsed block="1" weight=95 fixedInstance
|
||||
//% whenUsed block="1" weight=95 fixedInstance jres=icons.port1
|
||||
export const color1: ColorSensor = new ColorSensor(1)
|
||||
|
||||
//% whenUsed block="3" weight=90 fixedInstance
|
||||
//% whenUsed block="3" weight=90 fixedInstance jres=icons.port3
|
||||
export const color3: ColorSensor = new ColorSensor(3)
|
||||
|
||||
//% whenUsed block="2" weight=90 fixedInstance
|
||||
//% whenUsed block="2" weight=90 fixedInstance jres=icons.port2
|
||||
export const color2: ColorSensor = new ColorSensor(2)
|
||||
|
||||
//% whenUsed block="4" weight=90 fixedInstance
|
||||
//% whenUsed block="4" weight=90 fixedInstance jres=icons.port4
|
||||
export const color4: ColorSensor = new ColorSensor(4)
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ namespace brick {
|
||||
//% blockId=scren_image_picker block="%image" shim=TD_ID
|
||||
//% image.fieldEditor="imagedropdown"
|
||||
//% image.fieldOptions.columns=6
|
||||
//% block.fieldOptions.hasSearchBar=true
|
||||
//% image.fieldOptions.hasSearchBar=true
|
||||
//% group="Screen" weight=0 blockHidden=1
|
||||
export function _imagePicker(image: Image): Image {
|
||||
return image;
|
||||
|
@ -27,6 +27,8 @@ namespace sensors {
|
||||
//% block="`icons.gyroSensor` %sensor|angle"
|
||||
//% blockId=gyroGetAngle
|
||||
//% parts="gyroscope"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=65 blockGap=8
|
||||
//% group="Gyro Sensor"
|
||||
@ -43,6 +45,8 @@ namespace sensors {
|
||||
//% block="`icons.gyroSensor` %sensor|rotation rate"
|
||||
//% blockId=gyroGetRate
|
||||
//% parts="gyroscope"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=65 blockGap=8
|
||||
//% group="Gyro Sensor"
|
||||
@ -51,16 +55,16 @@ namespace sensors {
|
||||
return this.getNumber(NumberFormat.Int16LE, 0)
|
||||
}
|
||||
}
|
||||
|
||||
//% fixedInstance whenUsed block="1"
|
||||
|
||||
//% fixedInstance whenUsed block="1" jres=icons.port1
|
||||
export const gyro1: GyroSensor = new GyroSensor(1)
|
||||
|
||||
//% fixedInstance whenUsed block="2" weight=95
|
||||
//% fixedInstance whenUsed block="2" weight=95 jres=icons.port2
|
||||
export const gyro2: GyroSensor = new GyroSensor(2)
|
||||
|
||||
//% fixedInstance whenUsed block="3"
|
||||
|
||||
//% fixedInstance whenUsed block="3" jres=icons.port3
|
||||
export const gyro3: GyroSensor = new GyroSensor(3)
|
||||
|
||||
//% fixedInstance whenUsed block="4"
|
||||
//% fixedInstance whenUsed block="4" jres=icons.port4
|
||||
export const gyro4: GyroSensor = new GyroSensor(4)
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
"InfraredSensorEvent.ObjectDetected|block": "object detected",
|
||||
"InfraredSensorEvent.ObjectNear|block": "object near",
|
||||
"sensors.InfraredSensor.onEvent|block": "on `icons.infraredSensor` %sensor|%event",
|
||||
"sensors.InfraredSensor.proximity|block": "`icons.infraredSensor` %infrared|proximity",
|
||||
"sensors.InfraredSensor.remoteCommand|block": "`icons.infraredSensor` %infrared|remote command",
|
||||
"sensors.InfraredSensor.proximity|block": "`icons.infraredSensor` %sensor|proximity",
|
||||
"sensors.InfraredSensor.remoteCommand|block": "`icons.infraredSensor` %sensor|remote command",
|
||||
"sensors.InfraredSensor.waitUntil|block": "wait until `icons.infraredSensor` %sensor| %event",
|
||||
"sensors.RemoteInfraredBeaconButton.isPressed|block": "`icons.infraredSensor` %button|is pressed",
|
||||
"sensors.RemoteInfraredBeaconButton.onEvent|block": "on `icons.infraredSensor` %button|%event",
|
||||
|
@ -192,6 +192,8 @@ namespace sensors {
|
||||
//% block="on `icons.infraredSensor` %sensor|%event"
|
||||
//% blockId=infraredOn
|
||||
//% parts="infraredsensor"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=100 blockGap=8
|
||||
//% group="Infrared Sensor"
|
||||
@ -206,6 +208,8 @@ namespace sensors {
|
||||
//% block="wait until `icons.infraredSensor` %sensor| %event"
|
||||
//% blockId=infraredwait
|
||||
//% parts="infraredsensor"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=99 blockGap=8
|
||||
//% group="Infrared Sensor"
|
||||
@ -215,12 +219,14 @@ namespace sensors {
|
||||
|
||||
/**
|
||||
* Get the promixity measured by the infrared sensor, from ``0`` (close) to ``100`` (far)
|
||||
* @param ir the infrared sensor
|
||||
* @param sensor the infrared sensor
|
||||
*/
|
||||
//% help=input/infrared/proximity
|
||||
//% block="`icons.infraredSensor` %infrared|proximity"
|
||||
//% block="`icons.infraredSensor` %sensor|proximity"
|
||||
//% blockId=infraredGetProximity
|
||||
//% parts="infrared"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=65 blockGap=8
|
||||
//% group="Infrared Sensor"
|
||||
@ -231,12 +237,14 @@ namespace sensors {
|
||||
|
||||
/**
|
||||
* Get the remote commandreceived the infrared sensor.
|
||||
* @param ir the infrared sensor
|
||||
* @param sensor the infrared sensor
|
||||
*/
|
||||
//% help=input/infrared/remote-command
|
||||
//% block="`icons.infraredSensor` %infrared|remote command"
|
||||
//% block="`icons.infraredSensor` %sensor|remote command"
|
||||
//% blockId=infraredGetRemoteCommand
|
||||
//% parts="infrared"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=65 blockGap=8
|
||||
//% group="Infrared Sensor"
|
||||
@ -252,16 +260,16 @@ namespace sensors {
|
||||
}
|
||||
}
|
||||
|
||||
//% fixedInstance whenUsed block="1"
|
||||
//% fixedInstance whenUsed block="1" jres=icons.port1
|
||||
export const infraredSensor1: InfraredSensor = new InfraredSensor(1)
|
||||
|
||||
//% fixedInstance whenUsed block="2"
|
||||
//% fixedInstance whenUsed block="2" jres=icons.port2
|
||||
export const infraredSensor2: InfraredSensor = new InfraredSensor(2)
|
||||
|
||||
//% fixedInstance whenUsed block="3"
|
||||
//% fixedInstance whenUsed block="3" jres=icons.port3
|
||||
export const infraredSensor3: InfraredSensor = new InfraredSensor(3)
|
||||
|
||||
//% fixedInstance whenUsed block="4"
|
||||
//% fixedInstance whenUsed block="4" jres=icons.port4
|
||||
export const infraredSensor4: InfraredSensor = new InfraredSensor(4)
|
||||
|
||||
|
||||
|
@ -44,6 +44,8 @@ namespace sensors {
|
||||
//% help=input/touch-sensor/on-event
|
||||
//% blockId=touchEvent block="on `icons.touchSensor` %sensor|%event"
|
||||
//% parts="touch"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=99 blockGap=8
|
||||
//% group="Touch Sensor"
|
||||
@ -59,6 +61,8 @@ namespace sensors {
|
||||
//% help=input/touch-sensor/wait-until
|
||||
//% blockId=touchWaitUntil block="wait until `icons.touchSensor` %sensor|%event"
|
||||
//% parts="touch"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=98 blockGap=8
|
||||
//% group="Touch Sensor"
|
||||
@ -74,6 +78,8 @@ namespace sensors {
|
||||
//% block="`icons.touchSensor` %sensor|is pressed"
|
||||
//% blockId=touchIsPressed
|
||||
//% parts="touch"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=81 blockGap=8
|
||||
//% group="Touch Sensor"
|
||||
@ -89,6 +95,8 @@ namespace sensors {
|
||||
//% block="`icons.touchSensor` %sensor|was pressed"
|
||||
//% blockId=touchWasPressed
|
||||
//% parts="touch"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=81 blockGap=8
|
||||
//% group="Touch Sensor"
|
||||
@ -97,12 +105,12 @@ namespace sensors {
|
||||
}
|
||||
}
|
||||
|
||||
//% whenUsed block="1" weight=95 fixedInstance
|
||||
//% whenUsed block="1" weight=95 fixedInstance jres=icons.port1
|
||||
export const touchSensor1: TouchSensor = new TouchSensor(1)
|
||||
//% whenUsed block="2" weight=95 fixedInstance
|
||||
//% whenUsed block="2" weight=95 fixedInstance jres=icons.port2
|
||||
export const touchSensor2: TouchSensor = new TouchSensor(2)
|
||||
//% whenUsed block="3" weight=95 fixedInstance
|
||||
//% whenUsed block="3" weight=95 fixedInstance jres=icons.port3
|
||||
export const touchSensor3: TouchSensor = new TouchSensor(3)
|
||||
//% whenUsed block="4" weight=95 fixedInstance
|
||||
//% whenUsed block="4" weight=95 fixedInstance jres=icons.port4
|
||||
export const touchSensor4: TouchSensor = new TouchSensor(4)
|
||||
}
|
||||
|
@ -45,6 +45,8 @@ namespace sensors {
|
||||
//% blockId=ultrasonicOn
|
||||
//% block="on `icons.ultrasonicSensor` %sensor|%event"
|
||||
//% parts="ultrasonicsensor"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=100 blockGap=8
|
||||
//% group="Ultrasonic Sensor"
|
||||
@ -59,6 +61,8 @@ namespace sensors {
|
||||
//% block="wait until `icons.ultrasonicSensor` %sensor| %event"
|
||||
//% blockId=ultrasonicWait
|
||||
//% parts="ultrasonicsensor"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=99 blockGap=8
|
||||
//% group="Ultrasonic Sensor"
|
||||
@ -74,6 +78,8 @@ namespace sensors {
|
||||
//% block="`icons.ultrasonicSensor` %sensor|distance"
|
||||
//% blockId=sonarGetDistance
|
||||
//% parts="ultrasonicsensor"
|
||||
//% sensor.fieldEditor="imagedropdown"
|
||||
//% sensor.fieldOptions.columns=4
|
||||
//% blockNamespace=sensors
|
||||
//% weight=65 blockGap=8
|
||||
//% group="Ultrasonic Sensor"
|
||||
@ -84,15 +90,15 @@ namespace sensors {
|
||||
}
|
||||
}
|
||||
|
||||
//% fixedInstance whenUsed block="1"
|
||||
//% fixedInstance whenUsed block="1" jres=icons.port1
|
||||
export const ultrasonic1: UltraSonicSensor = new UltraSonicSensor(1)
|
||||
|
||||
//% fixedInstance whenUsed block="4"
|
||||
//% fixedInstance whenUsed block="4" jres=icons.port4
|
||||
export const ultrasonic4: UltraSonicSensor = new UltraSonicSensor(4)
|
||||
|
||||
//% fixedInstance whenUsed block="2"
|
||||
//% fixedInstance whenUsed block="2" jres=icons.port2
|
||||
export const ultrasonic2: UltraSonicSensor = new UltraSonicSensor(2)
|
||||
|
||||
//% fixedInstance whenUsed block="3"
|
||||
//% fixedInstance whenUsed block="3" jres=icons.port3
|
||||
export const ultrasonic3: UltraSonicSensor = new UltraSonicSensor(3)
|
||||
}
|
||||
|
Reference in New Issue
Block a user