diff options
author | Aubrey Li <Aubrey-Li> | 2021-11-30 17:53:13 -0500 |
---|---|---|
committer | Aubrey Li <Aubrey-Li> | 2021-11-30 17:53:13 -0500 |
commit | 2e6709216795e86c8b414dcb2dd45855cf23ea24 (patch) | |
tree | a9d8746067856f0497acd5c0fb9ef17332424655 /src | |
parent | 20758c0deb4892e896f7f36a2ff1b6ae79ab3dee (diff) |
latest from Mapbox
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/MainView.tsx | 2 | ||||
-rw-r--r-- | src/client/views/collections/MapView/CollectionMapView.tsx | 24 | ||||
-rw-r--r-- | src/client/views/nodes/MapBox/MapBox.tsx | 38 |
3 files changed, 38 insertions, 26 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 7ec7277a9..2929630b6 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -187,7 +187,7 @@ export class MainView extends React.Component { fa.faArrowAltCircleDown, fa.faArrowAltCircleUp, fa.faArrowAltCircleLeft, fa.faArrowAltCircleRight, fa.faStopCircle, fa.faCheckCircle, fa.faGripVertical, fa.faSortUp, fa.faSortDown, fa.faTable, fa.faTh, fa.faThList, fa.faProjectDiagram, fa.faSignature, fa.faColumns, fa.faChevronCircleUp, fa.faUpload, fa.faBorderAll, fa.faBraille, fa.faChalkboard, fa.faPencilAlt, fa.faEyeSlash, fa.faSmile, fa.faIndent, fa.faOutdent, fa.faChartBar, fa.faBan, fa.faPhoneSlash, fa.faGripLines, - fa.faSave, fa.faBookmark, fa.faList, fa.faListOl, fa.faFolderPlus, fa.faLightbulb, fa.faBookOpen, fa.faMapMarkedAlt); + fa.faSave, fa.faBookmark, fa.faList, fa.faListOl, fa.faFolderPlus, fa.faLightbulb, fa.faBookOpen, fa.faMapMarkerAlt); this.initAuthenticationRouters(); } diff --git a/src/client/views/collections/MapView/CollectionMapView.tsx b/src/client/views/collections/MapView/CollectionMapView.tsx index 1166de61c..885f51bfb 100644 --- a/src/client/views/collections/MapView/CollectionMapView.tsx +++ b/src/client/views/collections/MapView/CollectionMapView.tsx @@ -54,18 +54,18 @@ const mapOptions = { fullscreenControl: false, } -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 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 options = { fields: ["formatted_address", "geometry", "name"], // note: level of details is charged by item per retrieval, not recommended to return all fields 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" |