From b56d2c2ae115e81fbf7aeaae0d2fed9ba073f11d Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 1 Oct 2024 15:19:52 -0400
Subject: more annopalette related cleanup

---
 src/client/views/DocumentDecorations.tsx | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

(limited to 'src/client/views/DocumentDecorations.tsx')

diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index df9ec1bbf..e569c7dc8 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -231,15 +231,17 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
                     views.forEach(iconView => {
                         const iconViewDoc = iconView.Document;
                         Doc.setNativeView(iconViewDoc);
+                        // bcz: hacky ... when closing a Doc do different things depending on the contet ...
                         if (iconViewDoc.activeFrame) {
-                            iconViewDoc.opacity = 0; // bcz: hacky ... allows inkMasks and other documents to be "turned off" without removing them from the animated collection which allows them to function properly in a presenation.
+                            iconViewDoc.opacity = 0; // if in an animation collection, set opacity to 0 to allow inkMasks and other documents to remain in the collection and to smoothly animate when they are activated in a different animation frame
                         } else {
-                            // to mark annotations as no longer saved if they're deleted from the palette
-                            const dragFactory: Doc = DocCast(iconView.Document.dragFactory);
-                            if (dragFactory && DocCast(dragFactory.cloneOf).savedAsAnno) {
-                                DocCast(dragFactory.cloneOf).savedAsAnno = undefined;
-                            }
+                            // if Doc is in the annotation palette, remove the flag indicating that it's saved
+                            const dragFactory = DocCast(iconView.Document.dragFactory);
+                            if (dragFactory && DocCast(dragFactory.cloneOf).savedAsAnno) DocCast(dragFactory.cloneOf).savedAsAnno = undefined;
+
+                            // if this is a face Annotation doc, then just hide it.
                             if (iconView.Document.annotationOn && iconView.Document.face) iconView.Document.hidden = true;
+                            // otherwise actually remove the Doc from its parent collection
                             else iconView._props.removeDocument?.(iconView.Document);
                         }
                     });
-- 
cgit v1.2.3-70-g09d2

