From fcf44ede1de94778048b8efa14e20fa265c9408d Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Thu, 7 Sep 2023 17:04:26 -0400
Subject: another popup fix

---
 src/client/views/collections/TabDocView.tsx | 91 ++++++++++++++---------------
 1 file changed, 44 insertions(+), 47 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 e963e2f52..0044a2832 100644
--- a/src/client/views/collections/TabDocView.tsx
+++ b/src/client/views/collections/TabDocView.tsx
@@ -33,6 +33,7 @@ import { CollectionFreeFormView } from './collectionFreeForm/CollectionFreeFormV
 import { CollectionView } from './CollectionView';
 import './TabDocView.scss';
 import React = require('react');
+import { SettingsManager } from '../../util/SettingsManager';
 const _global = (window /* browser */ || global) /* node */ as any;
 
 interface TabDocViewProps {
@@ -567,60 +568,56 @@ export class TabMinimapView extends React.Component<TabMinimapViewProps> {
                 emptyFunction
             );
     };
-    render() {
-        if (!this.renderBounds) return null;
+    popup = () => {
+        if (!this.renderBounds) return <></>;
         const miniWidth = (this.props.PanelWidth() / NumCast(this.props.document._freeform_scale, 1) / this.renderBounds.dim) * 100;
         const miniHeight = (this.props.PanelHeight() / NumCast(this.props.document._freeform_scale, 1) / this.renderBounds.dim) * 100;
         const miniLeft = 50 + ((NumCast(this.props.document._freeform_panX) - this.renderBounds.cx) / this.renderBounds.dim) * 100 - miniWidth / 2;
         const miniTop = 50 + ((NumCast(this.props.document._freeform_panY) - this.renderBounds.cy) / this.renderBounds.dim) * 100 - miniHeight / 2;
         const miniSize = this.returnMiniSize();
         return (
-            <div className="miniMap-hidden">
-                <Popup
-                    icon={<FontAwesomeIcon icon="globe-asia" size="lg" />}
-                    color={StrCast(Doc.UserDoc().userVariantColor, Colors.MEDIUM_BLUE)}
-                    type={Type.TERT}
-                    onPointerDown={e => e.stopPropagation()}
-                    placement={'top-end'}
-                    popup={
-                        <div className="miniMap" style={{ width: miniSize, height: miniSize, background: this.props.background() }}>
-                            <CollectionFreeFormView
-                                Document={this.props.document}
-                                docViewPath={returnEmptyDoclist}
-                                childLayoutTemplate={this.childLayoutTemplate} // bcz: Ugh .. should probably be rendering a CollectionView or the minimap should be part of the collectionFreeFormView to avoid having to set stuff like this.
-                                noOverlay={true} // don't render overlay Docs since they won't scale
-                                setHeight={returnFalse}
-                                isContentActive={emptyFunction}
-                                isAnyChildContentActive={returnFalse}
-                                select={emptyFunction}
-                                isSelected={returnFalse}
-                                dontRegisterView={true}
-                                fieldKey={Doc.LayoutFieldKey(this.props.document)}
-                                bringToFront={emptyFunction}
-                                rootSelected={returnTrue}
-                                addDocument={returnFalse}
-                                moveDocument={returnFalse}
-                                removeDocument={returnFalse}
-                                PanelWidth={this.returnMiniSize}
-                                PanelHeight={this.returnMiniSize}
-                                ScreenToLocalTransform={Transform.Identity}
-                                renderDepth={0}
-                                whenChildContentsActiveChanged={emptyFunction}
-                                focus={emptyFunction}
-                                styleProvider={TabMinimapView.miniStyleProvider}
-                                addDocTab={this.props.addDocTab}
-                                pinToPres={TabDocView.PinDoc}
-                                childFilters={CollectionDockingView.Instance?.childDocFilters ?? returnEmptyDoclist}
-                                childFiltersByRanges={CollectionDockingView.Instance?.childDocRangeFilters ?? returnEmptyDoclist}
-                                searchFilterDocs={CollectionDockingView.Instance?.searchFilterDocs ?? returnEmptyDoclist}
-                                fitContentsToBox={returnTrue}
-                            />
-                            <div className="miniOverlay" onPointerDown={this.miniDown}>
-                                <div className="miniThumb" style={{ width: `${miniWidth}% `, height: `${miniHeight}% `, left: `${miniLeft}% `, top: `${miniTop}% ` }} />
-                            </div>
-                        </div>
-                    }
+            <div className="miniMap" style={{ width: miniSize, height: miniSize, background: this.props.background() }}>
+                <CollectionFreeFormView
+                    Document={this.props.document}
+                    docViewPath={returnEmptyDoclist}
+                    childLayoutTemplate={this.childLayoutTemplate} // bcz: Ugh .. should probably be rendering a CollectionView or the minimap should be part of the collectionFreeFormView to avoid having to set stuff like this.
+                    noOverlay={true} // don't render overlay Docs since they won't scale
+                    setHeight={returnFalse}
+                    isContentActive={emptyFunction}
+                    isAnyChildContentActive={returnFalse}
+                    select={emptyFunction}
+                    isSelected={returnFalse}
+                    dontRegisterView={true}
+                    fieldKey={Doc.LayoutFieldKey(this.props.document)}
+                    bringToFront={emptyFunction}
+                    rootSelected={returnTrue}
+                    addDocument={returnFalse}
+                    moveDocument={returnFalse}
+                    removeDocument={returnFalse}
+                    PanelWidth={this.returnMiniSize}
+                    PanelHeight={this.returnMiniSize}
+                    ScreenToLocalTransform={Transform.Identity}
+                    renderDepth={0}
+                    whenChildContentsActiveChanged={emptyFunction}
+                    focus={emptyFunction}
+                    styleProvider={TabMinimapView.miniStyleProvider}
+                    addDocTab={this.props.addDocTab}
+                    pinToPres={TabDocView.PinDoc}
+                    childFilters={CollectionDockingView.Instance?.childDocFilters ?? returnEmptyDoclist}
+                    childFiltersByRanges={CollectionDockingView.Instance?.childDocRangeFilters ?? returnEmptyDoclist}
+                    searchFilterDocs={CollectionDockingView.Instance?.searchFilterDocs ?? returnEmptyDoclist}
+                    fitContentsToBox={returnTrue}
                 />
+                <div className="miniOverlay" onPointerDown={this.miniDown}>
+                    <div className="miniThumb" style={{ width: `${miniWidth}% `, height: `${miniHeight}% `, left: `${miniLeft}% `, top: `${miniTop}% ` }} />
+                </div>
+            </div>
+        );
+    };
+    render() {
+        return (
+            <div className="miniMap-hidden">
+                <Popup icon={<FontAwesomeIcon icon="globe-asia" size="lg" />} color={SettingsManager.userVariantColor} type={Type.TERT} onPointerDown={e => e.stopPropagation()} placement={'top-end'} popup={this.popup} />
             </div>
         );
     }
-- 
cgit v1.2.3-70-g09d2

