diff options
Diffstat (limited to 'src/client/views/nodes/MapBox/MapBox.tsx')
-rw-r--r-- | src/client/views/nodes/MapBox/MapBox.tsx | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/src/client/views/nodes/MapBox/MapBox.tsx b/src/client/views/nodes/MapBox/MapBox.tsx index 6894cea19..7875060e2 100644 --- a/src/client/views/nodes/MapBox/MapBox.tsx +++ b/src/client/views/nodes/MapBox/MapBox.tsx @@ -28,6 +28,7 @@ import { Annotation } from '../../pdf/Annotation'; import { SidebarAnnos } from '../../SidebarAnnos'; import { StyleProp } from '../../StyleProvider'; import { FieldView, FieldViewProps } from '../FieldView'; +import * as dotenv from 'dotenv'; import "./MapBox.scss"; /** @@ -61,21 +62,30 @@ const mapOptions = { fullscreenControl: false, } +dotenv.config({ path: __dirname + '/.env' }) +const apiKey = process.env.GOOGLE_MAPS; + +const script = document.createElement('script'); +script.defer = true; +script.async = true; +script.src = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=places,drawing`; +document.head.appendChild(script); + /** * Consider integrating later: allows for drawing, circling, making shapes on map */ -const drawingManager = new google.maps.drawing.DrawingManager({ - drawingControl: true, - drawingControlOptions: { - position: google.maps.ControlPosition.TOP_RIGHT, - drawingModes: [ - google.maps.drawing.OverlayType.MARKER, - // currently we are not supporting the following drawing mode on map, a thought for future development - google.maps.drawing.OverlayType.CIRCLE, - google.maps.drawing.OverlayType.POLYLINE, - ], - }, -}); +// const drawingManager = new window.google.maps.drawing.DrawingManager({ +// drawingControl: true, +// drawingControlOptions: { +// position: google.maps.ControlPosition.TOP_RIGHT, +// drawingModes: [ +// google.maps.drawing.OverlayType.MARKER, +// // currently we are not supporting the following drawing mode on map, a thought for future development +// google.maps.drawing.OverlayType.CIRCLE, +// google.maps.drawing.OverlayType.POLYLINE, +// ], +// }, +// }); // options for searchbox in Google Maps Places Autocomplete API @@ -87,6 +97,7 @@ const options = { @observer export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps & FieldViewProps & Partial<GoogleMapProps>, MapDocument>(MapDocument) { + private _dropDisposer?: DragManager.DragDropDisposer; private _disposers: { [name: string]: IReactionDisposer } = {}; private _annotationLayer: React.RefObject<HTMLDivElement> = React.createRef(); @@ -602,8 +613,9 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps childPointerEvents={true} pointerEvents={CurrentUserUtils.SelectedTool !== InkTool.None || this._isAnnotating || SnappingManager.GetIsDragging() ? "all" : "none"} />; return <div className="mapBox" ref={this._ref}> + {console.log(apiKey)} {/* <LoadScript - googleMapsApiKey={process.env.GOOGLE_MAPS!} + googleMapsApiKey={apiKey!} libraries={['places', 'drawing']} > */} <div className="mapBox-wrapper" |