From 529e1cdb46a3af4fc44ad2bff6afd879fd1558ad Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Sun, 22 Aug 2021 14:21:11 -0400
Subject: started to fix issues with recognizing ink strokes.  fixed minimizing
 presentation box by fixing TabDocViews to provide a working removeDocument
 prop

---
 src/client/views/collections/TabDocView.tsx | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

(limited to 'src/client/views/collections/TabDocView.tsx')

diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx
index 1969d728c..e24fcf372 100644
--- a/src/client/views/collections/TabDocView.tsx
+++ b/src/client/views/collections/TabDocView.tsx
@@ -11,7 +11,6 @@ import { DataSym, Doc, DocListCast, DocListCastAsync, HeightSym, Opt, WidthSym }
 import { Id } from '../../../fields/FieldSymbols';
 import { FieldId } from "../../../fields/RefField";
 import { BoolCast, Cast, NumCast, StrCast } from "../../../fields/Types";
-import { TraceMobx } from '../../../fields/util';
 import { emptyFunction, lightOrDark, returnEmptyDoclist, returnFalse, returnTrue, setupMoveUpEvents, Utils } from "../../../Utils";
 import { DocServer } from "../../DocServer";
 import { DocUtils } from '../../documents/Documents';
@@ -313,6 +312,14 @@ export class TabDocView extends React.Component<TabDocViewProps> {
                 return CollectionDockingView.AddSplit(doc, locationParams, this.stack);
         }
     }
+    remDocTab = (doc: Doc | Doc[]) => {
+        if (doc === this._document) {
+            SelectionManager.DeselectAll();
+            CollectionDockingView.CloseSplit(this._document);
+            return true;
+        }
+        return false;
+    }
 
     getCurrentFrame = () => {
         return NumCast(Cast(PresBox.Instance.childDocs[PresBox.Instance.itemIndex].presentationTargetDoc, Doc, null)._currentFrame);
@@ -349,7 +356,6 @@ export class TabDocView extends React.Component<TabDocViewProps> {
 
     @computed get layerProvider() { return this._document && DefaultLayerProvider(this._document); }
     @computed get docView() {
-        TraceMobx();
         return !this._activated || !this._document || this._document._viewType === CollectionViewType.Docking ? (null) :
             <><DocumentView key={this._document[Id]} ref={action((r: DocumentView) => this._view = r)}
                 renderDepth={0}
@@ -366,7 +372,7 @@ export class TabDocView extends React.Component<TabDocViewProps> {
                 docRangeFilters={CollectionDockingView.Instance.childDocRangeFilters}
                 searchFilterDocs={CollectionDockingView.Instance.searchFilterDocs}
                 addDocument={undefined}
-                removeDocument={undefined}
+                removeDocument={this.remDocTab}
                 addDocTab={this.addDocTab}
                 ScreenToLocalTransform={this.ScreenToLocalTransform}
                 dontCenter={"y"}
@@ -393,7 +399,6 @@ export class TabDocView extends React.Component<TabDocViewProps> {
     }
 
     render() {
-        this.tab && CollectionDockingView.Instance.tabMap.delete(this.tab);
         return (
             <div className="collectionDockingView-content" style={{
                 fontFamily: Doc.UserDoc().renderStyle === "comic" ? "Comic Sans MS" : undefined,
-- 
cgit v1.2.3-70-g09d2

