@@ -116,6 +116,102 @@ class Scratch3FaceSensingBlocks {
116116 return 5 ;
117117 }
118118
119+ /**
120+ * An array of info about the face part menu choices.
121+ * @type {object[] }
122+ */
123+ get PART_INFO ( ) {
124+ return [ {
125+ text : formatMessage ( {
126+ id : 'faceSensing.nose' ,
127+ default : 'nose' ,
128+ description : 'Option for the "go to [PART]" and "when sprite touches [PART] blocks'
129+
130+ } ) ,
131+ value : '2'
132+ } , {
133+ text : formatMessage ( {
134+ id : 'faceSensing.mouth' ,
135+ default : 'mouth' ,
136+ description : 'Option for the "go to [PART]" and "when sprite touches [PART] blocks'
137+
138+ } ) ,
139+ value : '3'
140+ } , {
141+ text : formatMessage ( {
142+ id : 'faceSensing.leftEye' ,
143+ default : 'left eye' ,
144+ description : 'Option for the "go to [PART]" and "when sprite touches [PART] blocks'
145+
146+ } ) ,
147+ value : '0'
148+ } , {
149+ text : formatMessage ( {
150+ id : 'faceSensing.rightEye' ,
151+ default : 'right eye' ,
152+ description : 'Option for the "go to [PART]" and "when sprite touches [PART] blocks'
153+
154+ } ) ,
155+ value : '1'
156+ } , {
157+ text : formatMessage ( {
158+ id : 'faceSensing.betweenEyes' ,
159+ default : 'between eyes' ,
160+ description : 'Option for the "go to [PART]" and "when sprite touches [PART] blocks'
161+
162+ } ) ,
163+ value : '6'
164+ } , {
165+ text : formatMessage ( {
166+ id : 'faceSensing.leftEar' ,
167+ default : 'left ear' ,
168+ description : 'Option for the "go to [PART]" and "when sprite touches [PART] blocks'
169+
170+ } ) ,
171+ value : '4'
172+ } , {
173+ text : formatMessage ( {
174+ id : 'faceSensing.rightEar' ,
175+ default : 'right ear' ,
176+ description : 'Option for the "go to [PART]" and "when sprite touches [PART] blocks'
177+
178+ } ) ,
179+ value : '5'
180+ } , {
181+ text : formatMessage ( {
182+ id : 'faceSensing.topOfHead' ,
183+ default : 'top of head' ,
184+ description : 'Option for the "go to [PART]" and "when sprite touches [PART] blocks'
185+
186+ } ) ,
187+ value : '7'
188+ } ] ;
189+ }
190+
191+ /**
192+ * An array of choices about the tilt direction menu.
193+ * @type {object[] }
194+ */
195+ get TILT_INFO ( ) {
196+ return [ {
197+ text : formatMessage ( {
198+ id : 'faceSensing.left' ,
199+ default : 'left' ,
200+ description : 'Argument for the "when face tilts [DIRECTION]" block'
201+
202+ } ) ,
203+ value : 'left'
204+ } , {
205+ text : formatMessage ( {
206+ id : 'faceSensing.right' ,
207+ default : 'right' ,
208+ description : 'Argument for the "when face tilts [DIRECTION]" block'
209+
210+ } ) ,
211+ value : 'right'
212+ } ] ;
213+ }
214+
119215 /**
120216 * Occasionally step a loop to sample the video, stamp it to the preview
121217 * skin, and add a TypedArray copy of the canvas's pixel data.
@@ -191,7 +287,7 @@ class Scratch3FaceSensingBlocks {
191287 text : formatMessage ( {
192288 id : 'faceSensing.goToPart' ,
193289 default : 'go to [PART]' ,
194- description : ''
290+ description : 'Command that moves target to [PART] '
195291 } ) ,
196292 blockType : BlockType . COMMAND ,
197293 arguments : {
@@ -208,7 +304,7 @@ class Scratch3FaceSensingBlocks {
208304 text : formatMessage ( {
209305 id : 'faceSensing.pointInFaceTiltDirection' ,
210306 default : 'point in direction of face tilt' ,
211- description : ''
307+ description : 'Command that points the target in the direction of face tilt '
212308 } ) ,
213309 blockType : BlockType . COMMAND ,
214310 filter : [ TargetType . SPRITE ]
@@ -218,7 +314,7 @@ class Scratch3FaceSensingBlocks {
218314 text : formatMessage ( {
219315 id : 'faceSensing.setSizeToFaceSize' ,
220316 default : 'set size to face size' ,
221- description : ''
317+ description : 'Command that sets the size of the target to the face size '
222318 } ) ,
223319 blockType : BlockType . COMMAND ,
224320 filter : [ TargetType . SPRITE ]
@@ -229,7 +325,7 @@ class Scratch3FaceSensingBlocks {
229325 text : formatMessage ( {
230326 id : 'faceSensing.whenTilted' ,
231327 default : 'when face tilts [DIRECTION]' ,
232- description : ''
328+ description : 'Event that triggers when face tilts [DIRECTION] '
233329 } ) ,
234330 blockType : BlockType . HAT ,
235331 arguments : {
@@ -245,7 +341,7 @@ class Scratch3FaceSensingBlocks {
245341 text : formatMessage ( {
246342 id : 'faceSensing.whenSpriteTouchesPart' ,
247343 default : 'when this sprite touches a [PART]' ,
248- description : ''
344+ description : 'Event that triggers when sprite touches a [PART] '
249345 } ) ,
250346 arguments : {
251347 PART : {
@@ -262,7 +358,7 @@ class Scratch3FaceSensingBlocks {
262358 text : formatMessage ( {
263359 id : 'faceSensing.whenFaceDetected' ,
264360 default : 'when a face is detected' ,
265- description : ''
361+ description : 'Event that triggers when a face is detected '
266362 } ) ,
267363 blockType : BlockType . HAT
268364 } ,
@@ -272,7 +368,7 @@ class Scratch3FaceSensingBlocks {
272368 text : formatMessage ( {
273369 id : 'faceSensing.faceDetected' ,
274370 default : 'a face is detected?' ,
275- description : ''
371+ description : 'Reporter that returns whether a face is detected '
276372 } ) ,
277373 blockType : BlockType . BOOLEAN
278374 } ,
@@ -281,7 +377,7 @@ class Scratch3FaceSensingBlocks {
281377 text : formatMessage ( {
282378 id : 'faceSensing.faceTilt' ,
283379 default : 'face tilt' ,
284- description : ''
380+ description : 'Reporter that returns the face tilt '
285381 } ) ,
286382 blockType : BlockType . REPORTER
287383 } ,
@@ -290,26 +386,14 @@ class Scratch3FaceSensingBlocks {
290386 text : formatMessage ( {
291387 id : 'faceSensing.faceSize' ,
292388 default : 'face size' ,
293- description : ''
389+ description : 'Reporter that returns the face size '
294390 } ) ,
295391 blockType : BlockType . REPORTER
296392 }
297393 ] ,
298394 menus : {
299- PART : [
300- { text : 'nose' , value : '2' } ,
301- { text : 'mouth' , value : '3' } ,
302- { text : 'left eye' , value : '0' } ,
303- { text : 'right eye' , value : '1' } ,
304- { text : 'between eyes' , value : '6' } ,
305- { text : 'left ear' , value : '4' } ,
306- { text : 'right ear' , value : '5' } ,
307- { text : 'top of head' , value : '7' }
308- ] ,
309- TILT : [
310- { text : 'left' , value : 'left' } ,
311- { text : 'right' , value : 'right' }
312- ]
395+ PART : this . PART_INFO ,
396+ TILT : this . TILT_INFO
313397 }
314398 } ;
315399 }
0 commit comments