From 7e4d793eaa7e5b6b564355a11fa02a5611645f20 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 21 Mar 2025 18:58:21 -0400
Subject: trying to improve how data / layout / root and templtae docs are
 accessed.

---
 src/client/views/search/FaceRecognitionHandler.tsx | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

(limited to 'src/client/views/search/FaceRecognitionHandler.tsx')

diff --git a/src/client/views/search/FaceRecognitionHandler.tsx b/src/client/views/search/FaceRecognitionHandler.tsx
index 6f70e96ab..841546a04 100644
--- a/src/client/views/search/FaceRecognitionHandler.tsx
+++ b/src/client/views/search/FaceRecognitionHandler.tsx
@@ -66,7 +66,7 @@ export class FaceRecognitionHandler {
      * returns a list of all face collection Docs on the current dashboard
      * @returns face collection Doc list
      */
-    public static UniqueFaces = () => DocListCast(Doc.ActiveDashboard?.[DocData].myUniqueFaces);
+    public static UniqueFaces = () => DocListCast(Doc.ActiveDashboard?.$myUniqueFaces);
 
     /**
      * Find a unique face from its name
@@ -87,22 +87,22 @@ export class FaceRecognitionHandler {
      * @param faceDoc unique face Doc
      * @returns label string
      */
-    public static UniqueFaceLabel = (faceDoc: Doc) => StrCast(faceDoc[DocData].face);
+    public static UniqueFaceLabel = (faceDoc: Doc) => StrCast(faceDoc.$face);
 
-    public static SetUniqueFaceLabel = (faceDoc: Doc, value: string) => (faceDoc[DocData].face = value);
+    public static SetUniqueFaceLabel = (faceDoc: Doc, value: string) => (faceDoc.$face = value);
     /**
      * Returns all the face descriptors associated with a unique face Doc
      * @param faceDoc unique face Doc
      * @returns face descriptors
      */
-    public static UniqueFaceDescriptors = (faceDoc: Doc) => DocListCast(faceDoc[DocData].face_annos).map(face => face.faceDescriptor as List<number>);
+    public static UniqueFaceDescriptors = (faceDoc: Doc) => DocListCast(faceDoc.$face_annos).map(face => face.faceDescriptor as List<number>);
 
     /**
      * Returns a list of all face image Docs associated with a unique face Doc
      * @param faceDoc unique face Doc
      * @returns image Docs
      */
-    public static UniqueFaceImages = (faceDoc: Doc) => DocListCast(faceDoc[DocData].face_annos).map(face => DocCast(face.annotationOn, face));
+    public static UniqueFaceImages = (faceDoc: Doc) => DocListCast(faceDoc.$face_annos).map(face => DocCast(face.annotationOn, face));
 
     /**
      * Adds a face image to a unique face Doc, adds the unique face Doc to the images list of reognized faces,
@@ -145,8 +145,8 @@ export class FaceRecognitionHandler {
      * @returns a unique face Doc
      */
     private createUniqueFaceDoc = (dashboard: Doc) => {
-        const faceDocNum = NumCast(dashboard[DocData].myUniqueFaces_count) + 1;
-        dashboard[DocData].myUniqueFaces_count = faceDocNum; // TODO: improve to a better name
+        const faceDocNum = NumCast(dashboard.$myUniqueFaces_count) + 1;
+        dashboard.$myUniqueFaces_count = faceDocNum; // TODO: improve to a better name
 
         const uniqueFaceDoc = Docs.Create.UniqeFaceDocument({
             title: ComputedField.MakeFunction('this.face', undefined, undefined, 'this.face = value') as unknown as string,
@@ -160,9 +160,8 @@ export class FaceRecognitionHandler {
             _width: 400,
             _height: 100,
         });
-        const uface = uniqueFaceDoc[DocData];
-        uface.face = `Face${faceDocNum}`;
-        uface.face_annos = new List<Doc>();
+        uniqueFaceDoc.$face = `Face${faceDocNum}`;
+        uniqueFaceDoc.$face_annos = new List<Doc>();
         Doc.SetContainer(uniqueFaceDoc, Doc.MyFaceCollection);
 
         Doc.ActiveDashboard && Doc.AddDocToList(Doc.ActiveDashboard[DocData], 'myUniqueFaces', uniqueFaceDoc);
@@ -241,7 +240,7 @@ export class FaceRecognitionHandler {
                                     annos.push(faceAnno);
                                 });
 
-                                imgDoc[DocData].data_annotations = new List<Doc>(annos);
+                                imgDoc.$data_annotations = new List<Doc>(annos);
                                 imgDoc._layout_showTags = annos.length > 0;
                                 return imgDocFaceDescriptions;
                             })
-- 
cgit v1.2.3-70-g09d2

