From 8f21b2ef39afbe4723e0b23b1bd9f47c27e078fc Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 14 Sep 2022 00:56:52 -0400
Subject: turned off overlayView when lightboxDoc is active

---
 src/client/views/OverlayView.tsx | 135 ++++++++++++++++++++-------------------
 1 file changed, 69 insertions(+), 66 deletions(-)

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

diff --git a/src/client/views/OverlayView.tsx b/src/client/views/OverlayView.tsx
index 2354e84ff..6d7f2c037 100644
--- a/src/client/views/OverlayView.tsx
+++ b/src/client/views/OverlayView.tsx
@@ -12,6 +12,7 @@ import { DragManager } from '../util/DragManager';
 import { ScriptingGlobals } from '../util/ScriptingGlobals';
 import { Transform } from '../util/Transform';
 import { CollectionFreeFormLinksView } from './collections/collectionFreeForm/CollectionFreeFormLinksView';
+import { LightboxView } from './LightboxView';
 import { DocumentView } from './nodes/DocumentView';
 import './OverlayView.scss';
 import { ScriptingRepl } from './ScriptingRepl';
@@ -90,7 +91,7 @@ export class OverlayWindow extends React.Component<OverlayWindowProps> {
     };
 
     render() {
-        return (
+        return LightboxView.LightboxDoc ? null : (
             <div className="overlayWindow-outerDiv" style={{ transform: `translate(${this.x}px, ${this.y}px)`, width: this.width, height: this.height }}>
                 <div className="overlayWindow-titleBar" onPointerDown={this.onPointerDown}>
                     {this.props.overlayOptions.title || 'Untitled'}
@@ -169,72 +170,74 @@ export class OverlayView extends React.Component {
     );
 
     @computed get overlayDocs() {
-        return DocListCast(Doc.MyOverlayDocs?.data).map(d => {
-            let offsetx = 0,
-                offsety = 0;
-            const dref = React.createRef<HTMLDivElement>();
-            const onPointerMove = action((e: PointerEvent, down: number[]) => {
-                if (e.buttons === 1) {
-                    d.overlayX = e.clientX + offsetx;
-                    d.overlayY = e.clientY + offsety;
-                }
-                if (e.metaKey) {
-                    const dragData = new DragManager.DocumentDragData([d]);
-                    dragData.offset = [-offsetx, -offsety];
-                    dragData.dropAction = 'move';
-                    dragData.removeDocument = (doc: Doc | Doc[]) => {
-                        const docs = doc instanceof Doc ? [doc] : doc;
-                        docs.forEach(d => Doc.RemoveDocFromList(Doc.MyOverlayDocs, undefined, d));
-                        return true;
-                    };
-                    dragData.moveDocument = (doc: Doc | Doc[], targetCollection: Doc | undefined, addDocument: (doc: Doc | Doc[]) => boolean): boolean => {
-                        return dragData.removeDocument!(doc) ? addDocument(doc) : false;
-                    };
-                    DragManager.StartDocumentDrag([dref.current!], dragData, down[0], down[1]);
-                    return true;
-                }
-                return false;
-            });
+        return LightboxView.LightboxDoc
+            ? null
+            : DocListCast(Doc.MyOverlayDocs?.data).map(d => {
+                  let offsetx = 0,
+                      offsety = 0;
+                  const dref = React.createRef<HTMLDivElement>();
+                  const onPointerMove = action((e: PointerEvent, down: number[]) => {
+                      if (e.buttons === 1) {
+                          d.overlayX = e.clientX + offsetx;
+                          d.overlayY = e.clientY + offsety;
+                      }
+                      if (e.metaKey) {
+                          const dragData = new DragManager.DocumentDragData([d]);
+                          dragData.offset = [-offsetx, -offsety];
+                          dragData.dropAction = 'move';
+                          dragData.removeDocument = (doc: Doc | Doc[]) => {
+                              const docs = doc instanceof Doc ? [doc] : doc;
+                              docs.forEach(d => Doc.RemoveDocFromList(Doc.MyOverlayDocs, undefined, d));
+                              return true;
+                          };
+                          dragData.moveDocument = (doc: Doc | Doc[], targetCollection: Doc | undefined, addDocument: (doc: Doc | Doc[]) => boolean): boolean => {
+                              return dragData.removeDocument!(doc) ? addDocument(doc) : false;
+                          };
+                          DragManager.StartDocumentDrag([dref.current!], dragData, down[0], down[1]);
+                          return true;
+                      }
+                      return false;
+                  });
 
-            const onPointerDown = (e: React.PointerEvent) => {
-                setupMoveUpEvents(this, e, onPointerMove, emptyFunction, emptyFunction);
-                offsetx = NumCast(d.overlayX) - e.clientX;
-                offsety = NumCast(d.overlayY) - e.clientY;
-            };
-            return (
-                <div
-                    className="overlayView-doc"
-                    ref={dref}
-                    key={d[Id]}
-                    onPointerDown={onPointerDown}
-                    style={{ top: d.type === 'presentation' ? 0 : undefined, width: NumCast(d._width), height: NumCast(d._height), transform: `translate(${d.overlayX}px, ${d.overlayY}px)` }}>
-                    <DocumentView
-                        Document={d}
-                        rootSelected={returnTrue}
-                        bringToFront={emptyFunction}
-                        addDocument={undefined}
-                        removeDocument={this.removeOverlayDoc}
-                        PanelWidth={d[WidthSym]}
-                        PanelHeight={d[HeightSym]}
-                        ScreenToLocalTransform={this.docScreenToLocalXf(d)}
-                        renderDepth={1}
-                        isDocumentActive={returnTrue}
-                        isContentActive={returnTrue}
-                        whenChildContentsActiveChanged={emptyFunction}
-                        focus={DocUtils.DefaultFocus}
-                        styleProvider={DefaultStyleProvider}
-                        docViewPath={returnEmptyDoclist}
-                        addDocTab={returnFalse}
-                        pinToPres={emptyFunction}
-                        docFilters={returnEmptyFilter}
-                        docRangeFilters={returnEmptyFilter}
-                        searchFilterDocs={returnEmptyDoclist}
-                        ContainingCollectionView={undefined}
-                        ContainingCollectionDoc={undefined}
-                    />
-                </div>
-            );
-        });
+                  const onPointerDown = (e: React.PointerEvent) => {
+                      setupMoveUpEvents(this, e, onPointerMove, emptyFunction, emptyFunction);
+                      offsetx = NumCast(d.overlayX) - e.clientX;
+                      offsety = NumCast(d.overlayY) - e.clientY;
+                  };
+                  return (
+                      <div
+                          className="overlayView-doc"
+                          ref={dref}
+                          key={d[Id]}
+                          onPointerDown={onPointerDown}
+                          style={{ top: d.type === 'presentation' ? 0 : undefined, width: NumCast(d._width), height: NumCast(d._height), transform: `translate(${d.overlayX}px, ${d.overlayY}px)` }}>
+                          <DocumentView
+                              Document={d}
+                              rootSelected={returnTrue}
+                              bringToFront={emptyFunction}
+                              addDocument={undefined}
+                              removeDocument={this.removeOverlayDoc}
+                              PanelWidth={d[WidthSym]}
+                              PanelHeight={d[HeightSym]}
+                              ScreenToLocalTransform={this.docScreenToLocalXf(d)}
+                              renderDepth={1}
+                              isDocumentActive={returnTrue}
+                              isContentActive={returnTrue}
+                              whenChildContentsActiveChanged={emptyFunction}
+                              focus={DocUtils.DefaultFocus}
+                              styleProvider={DefaultStyleProvider}
+                              docViewPath={returnEmptyDoclist}
+                              addDocTab={returnFalse}
+                              pinToPres={emptyFunction}
+                              docFilters={returnEmptyFilter}
+                              docRangeFilters={returnEmptyFilter}
+                              searchFilterDocs={returnEmptyDoclist}
+                              ContainingCollectionView={undefined}
+                              ContainingCollectionDoc={undefined}
+                          />
+                      </div>
+                  );
+              });
     }
 
     public static ShowSpinner() {
-- 
cgit v1.2.3-70-g09d2

