diff options
Diffstat (limited to 'src/client/views/nodes/MapBox/MapBox.tsx')
-rw-r--r-- | src/client/views/nodes/MapBox/MapBox.tsx | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/client/views/nodes/MapBox/MapBox.tsx b/src/client/views/nodes/MapBox/MapBox.tsx index e80ad8acd..50444c73a 100644 --- a/src/client/views/nodes/MapBox/MapBox.tsx +++ b/src/client/views/nodes/MapBox/MapBox.tsx @@ -57,9 +57,9 @@ const defaultCenter = { const mapOptions = { fullscreenControl: false, -} +}; -dotenv.config({ path: __dirname + '/.env' }) +dotenv.config({ path: __dirname + '/.env' }); const apiKey = process.env.GOOGLE_MAPS; const script = document.createElement('script'); @@ -115,8 +115,8 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps @observable private searchMarkers: google.maps.Marker[] = []; @observable private searchBox = new window.google.maps.places.Autocomplete(this.inputRef.current!, options); @observable private _savedAnnotations = new ObservableMap<number, HTMLDivElement[]>(); - @computed get allSidebarDocs() { return DocListCast(this.dataDoc[this.SidebarKey]); }; - @computed get allMapMarkers() { return DocListCast(this.dataDoc[this.annotationKey]); }; + @computed get allSidebarDocs() { return DocListCast(this.dataDoc[this.SidebarKey]); } + @computed get allMapMarkers() { return DocListCast(this.dataDoc[this.annotationKey]); } @observable private toggleAddMarker = false; private _mainCont: React.RefObject<HTMLDivElement> = React.createRef(); @@ -155,7 +155,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps */ private CenterControl = () => { const controlDiv = document.createElement("div"); - controlDiv.className = "mapBox-addMarker" + controlDiv.className = "mapBox-addMarker"; // Set CSS for the control border. const controlUI = document.createElement("div"); controlUI.style.backgroundColor = "#fff"; @@ -201,7 +201,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps // Setup the click event listeners controlUI.addEventListener("click", () => { - if (this.toggleAddMarker == true) { + if (this.toggleAddMarker === true) { this.toggleAddMarker = false; console.log("add marker button status:" + this.toggleAddMarker); controlUI.style.backgroundColor = "#fff"; @@ -211,7 +211,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps console.log("add marker button status:" + this.toggleAddMarker); controlUI.style.backgroundColor = "#4476f7"; markerIcon.style.color = "rgb(255,255,255)"; - }; + } }); controlDiv.appendChild(controlUI); return controlDiv; @@ -271,10 +271,10 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps }, 250); // listener to addmarker event this._map.addListener('click', (e: MouseEvent) => { - if (this.toggleAddMarker == true) { + if (this.toggleAddMarker === true) { this.placeMarker((e as any).latLng, map); } - }) + }); } @action @@ -328,10 +328,10 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps console.log("print all sidebar Docs"); console.log(this.allSidebarDocs); if (!this.layoutDoc._showSidebar) this.toggleSidebar(); - const docs = doc instanceof Doc ? [doc] : doc + const docs = doc instanceof Doc ? [doc] : doc; docs.forEach(doc => { if (doc.lat !== undefined && doc.lng !== undefined) { - const existingMarker = this.allMapMarkers.find(marker => marker.lat === doc.lat && marker.lng == doc.lng); + const existingMarker = this.allMapMarkers.find(marker => marker.lat === doc.lat && marker.lng === doc.lng); doc.onClickBehavior = "enterPortal"; if (existingMarker) { Doc.AddDocToList(existingMarker, "data", doc); @@ -340,7 +340,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps this.addDocument(marker, this.annotationKey); } } - }) //add to annotation list + }); //add to annotation list console.log("sidebaraddDocument"); console.log(doc); @@ -359,7 +359,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps docs.forEach(doc => { console.log(this.allMapMarkers); console.log(this.allSidebarDocs); - }) + }); return this.removeDocument(doc, sidebarKey); } @@ -432,7 +432,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps title: place.name, position: place.geometry.location, }) - ) + ); } /** @@ -498,7 +498,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps @computed get annotationLayer() { const pe = this.props.isContentActive() && this.props.pointerEvents !== "none" && !MarqueeOptionsMenu.Instance.isShown() ? "all" : - SnappingManager.GetIsDragging() ? undefined : "none" + SnappingManager.GetIsDragging() ? undefined : "none"; return <div className="mapBox-annotationLayer" style={{ height: Doc.NativeHeight(this.Document) || undefined }} ref={this._annotationLayer}> {this.inlineTextAnnotations.sort((a, b) => NumCast(a.y) - NumCast(b.y)).map(anno => <Annotation key={`${anno[Id]}-annotation`} {...this.props} @@ -509,7 +509,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps getAnchor = () => { const anchor = AnchorMenu.Instance?.GetAnchor(this._savedAnnotations) ?? - this.rootDoc + this.rootDoc; return anchor; } @@ -525,7 +525,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps onLoad={marker => this.markerLoadHandler(marker, place)} onClick={(e: google.maps.MapMouseEvent) => this.markerClickHandler(e, place)} /> - )) + )); } // TODO: auto center on select a document in the sidebar |