@@ -8,16 +8,18 @@ AFRAME.registerSystem('mindar-face-system', {
8
8
video : null ,
9
9
shouldFaceUser : true ,
10
10
lastHasFace : false ,
11
+ disableFaceMirror : false ,
11
12
12
13
init : function ( ) {
13
14
this . anchorEntities = [ ] ;
14
15
this . faceMeshEntities = [ ] ;
15
16
} ,
16
17
17
- setup : function ( { uiLoading, uiScanning, uiError, filterMinCF, filterBeta} ) {
18
+ setup : function ( { uiLoading, uiScanning, uiError, filterMinCF, filterBeta, disableFaceMirror } ) {
18
19
this . ui = new UI ( { uiLoading, uiScanning, uiError} ) ;
19
20
this . filterMinCF = filterMinCF ;
20
21
this . filterBeta = filterBeta ;
22
+ this . disableFaceMirror = disableFaceMirror ;
21
23
} ,
22
24
23
25
registerFaceMesh : function ( el ) {
@@ -160,7 +162,9 @@ AFRAME.registerSystem('mindar-face-system', {
160
162
} ) ;
161
163
this . _resize ( ) ;
162
164
163
- await this . controller . setup ( ) ;
165
+ const flipFace = this . shouldFaceUser && ! this . disableFaceMirror ;
166
+
167
+ await this . controller . setup ( flipFace ) ;
164
168
await this . controller . dummyRun ( this . video ) ;
165
169
166
170
for ( let i = 0 ; i < this . faceMeshEntities . length ; i ++ ) {
@@ -208,6 +212,12 @@ AFRAME.registerSystem('mindar-face-system', {
208
212
this . video . style . width = vw + "px" ;
209
213
this . video . style . height = vh + "px" ;
210
214
215
+ if ( this . shouldFaceUser && ! this . disableFaceMirror ) {
216
+ video . style . transform = 'scaleX(-1)' ;
217
+ } else {
218
+ video . style . transform = 'scaleX(1)' ;
219
+ }
220
+
211
221
const sceneEl = container . getElementsByTagName ( "a-scene" ) [ 0 ] ;
212
222
sceneEl . style . top = this . video . style . top ;
213
223
sceneEl . style . left = this . video . style . left ;
@@ -227,6 +237,7 @@ AFRAME.registerComponent('mindar-face', {
227
237
uiError : { type : 'string' , default : 'yes' } ,
228
238
filterMinCF : { type : 'number' , default : - 1 } ,
229
239
filterBeta : { type : 'number' , default : - 1 } ,
240
+ disableFaceMirror : { type : 'boolean' , default : 'false' } ,
230
241
} ,
231
242
232
243
init : function ( ) {
@@ -244,6 +255,7 @@ AFRAME.registerComponent('mindar-face', {
244
255
uiError : this . data . uiError ,
245
256
filterMinCF : this . data . filterMinCF === - 1 ? null : this . data . filterMinCF ,
246
257
filterBeta : this . data . filterBeta === - 1 ? null : this . data . filterBeta ,
258
+ disableFaceMirror : this . data . disableFaceMirror ,
247
259
} ) ;
248
260
249
261
if ( this . data . autoStart ) {
0 commit comments