From b3f81bf0cad1f7dadf47de7b7fc673b35180c46c Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 30 Jul 2021 08:00:49 -0400
Subject: set default native width for maps.  changed map css so sidebar will
 show up.  fixed pointerEvents for map

---
 src/client/views/nodes/MapBox/MapBox.tsx | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

(limited to 'src/client/views/nodes/MapBox/MapBox.tsx')

diff --git a/src/client/views/nodes/MapBox/MapBox.tsx b/src/client/views/nodes/MapBox/MapBox.tsx
index d52b91908..775cf03ca 100644
--- a/src/client/views/nodes/MapBox/MapBox.tsx
+++ b/src/client/views/nodes/MapBox/MapBox.tsx
@@ -1,22 +1,17 @@
-import { Autocomplete, GoogleMap, GoogleMapProps, InfoBox, InfoWindow, Marker } from '@react-google-maps/api';
-import { action, computed, IReactionDisposer, observable, ObservableMap, reaction, runInAction } from 'mobx';
+import { Autocomplete, GoogleMap, GoogleMapProps, InfoWindow, Marker } from '@react-google-maps/api';
+import { action, IReactionDisposer, observable } from 'mobx';
 import { observer } from "mobx-react";
 import * as React from "react";
-import { Doc, WidthSym } from '../../../../fields/Doc';
+import { Doc, WidthSym, HeightSym } from '../../../../fields/Doc';
 import { documentSchema } from '../../../../fields/documentSchemas';
 import { makeInterface } from '../../../../fields/Schema';
-import { Cast, NumCast, StrCast } from '../../../../fields/Types';
-import { setupMoveUpEvents, emptyFunction } from '../../../../Utils';
+import { NumCast } from '../../../../fields/Types';
+import { emptyFunction, setupMoveUpEvents } from '../../../../Utils';
 import { DragManager } from '../../../util/DragManager';
-import { undoBatch } from '../../../util/UndoManager';
-import { CollectionViewType } from '../../collections/CollectionView';
-import { TabDocView } from '../../collections/TabDocView';
 import { ViewBoxAnnotatableComponent, ViewBoxAnnotatableProps } from '../../DocComponent';
 import { SidebarAnnos } from '../../SidebarAnnos';
-import { StyleProp } from '../../StyleProvider';
 import { FieldView, FieldViewProps } from '../FieldView';
-import { PresMovement } from '../PresBox';
-import "./MapBox.scss"
+import "./MapBox.scss";
 import { MapMarker } from './MapMarker';
 
 type MapDocument = makeInterface<[typeof documentSchema]>;
@@ -87,6 +82,15 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
     private _sidebarRef = React.createRef<SidebarAnnos>();
     private _ref: React.RefObject<HTMLDivElement> = React.createRef();
 
+    constructor(props: any) {
+        super(props);
+
+        if (!Doc.NativeWidth(this.dataDoc)) {
+            Doc.SetNativeWidth(this.dataDoc, Doc.NativeWidth(this.dataDoc) || 850);
+            Doc.SetNativeHeight(this.dataDoc, Doc.NativeHeight(this.dataDoc) || this.Document[HeightSym]() / this.Document[WidthSym]() * 850);
+        }
+    }
+
 
     @action
     private setSearchBox = (searchBox: any) => {
@@ -239,12 +243,10 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
     }
 
     render() {
-        const { Document, fieldKey, isContentActive: active } = this.props;
-
         return <div className="MapBox" ref={this._ref}>
             {/* HELLO WORLD! */}
             <div className={"MapBox-contents"}
-                style={{ pointerEvents: active() ? undefined : "none", overflow: 'hidden' }}
+                style={{ pointerEvents: this.isContentActive() ? undefined : "none" }}
                 onWheel={e => e.stopPropagation()}
                 onPointerDown={e => (e.button === 0 && !e.ctrlKey) && e.stopPropagation()} >
                 {/* // {/* <LoadScript
-- 
cgit v1.2.3-70-g09d2

