Skip to content

Commit

Permalink
fix the gun info windows
Browse files Browse the repository at this point in the history
  • Loading branch information
runette committed Feb 14, 2024
1 parent 1f7a3a4 commit 873f498
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bcp/src/app/bcp-database/bcp-database.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(zoomChanged)="onBoundsChanged()"
(mapDragend)="onBoundsChanged()"
>
<map-info-window>
<map-info-window [options]="infoOptions">
<app-bcp-data-card *ngIf="selectedMarker"
[routerLink]="['entry']"
[queryParams]="{gunid:selectedMarker.gunid}"
Expand Down
32 changes: 26 additions & 6 deletions bcp/src/app/bcp-database/bcp-database.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
///<reference types='google.maps' />
///<reference path='../googlemap-locate/google-locate-control.ts' />
import { Component, ViewChild, OnInit, AfterViewInit, OnDestroy, ElementRef, ChangeDetectorRef} from '@angular/core';
import { Component,
ViewChild,
OnInit,
AfterViewInit,
OnDestroy,
ElementRef,
ChangeDetectorRef,
QueryList,
ViewChildren,
} from '@angular/core';
import { MapInfoWindow, MapMarker } from '@angular/google-maps';
import { BcpFilterValuesService, Material, GunCategory, RecordQuality, Order } from '../bcp-filter-values.service';
import { BcpFilterValuesService,
Material,
GunCategory,
RecordQuality,
Order,
} from '../bcp-filter-values.service';
import { BcpMapDataService, DataItem } from '../bcp-map-data.service';
import { BcpSiteDataService } from '../bcp-site-data.service';
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
Expand Down Expand Up @@ -47,14 +61,20 @@ export class BcpDatabaseComponent implements OnInit, AfterViewInit, OnDestroy {
maxZoom: 12
})
}

infoOptions = {
minWidth: 550,
}

invisMarker: google.maps.MarkerOptions = {visible: false, opacity: 0};
subscriptions: Subscription[] = [];

map: google.maps.Map;
@ViewChild(MapInfoWindow, {static: false}) mapInfo: MapInfoWindow;
@ViewChild(MapMarker, {static: false}) mapMarker: MapMarker;
@ViewChild("bounding_box", {static: false}) boundingBoxElement: ElementRef;

@ViewChildren(MapMarker) _markers: QueryList<MapMarker>;

markerPositions: MarkerData[] = [];
selectedMarker: DataItem;

Expand Down Expand Up @@ -210,9 +230,9 @@ export class BcpDatabaseComponent implements OnInit, AfterViewInit, OnDestroy {
}
}

public markerClick($event) {
public markerClick($event: { latLng: google.maps.LatLng; }) {
this.selectedMarker = this.data.filteredData.find(item => item.location == $event.latLng)
this.mapMarker.marker = $event;
this.mapInfo.open(this.mapMarker);
let marker = this._markers.find(item => item.getPosition().lat == $event.latLng.lat && item.getPosition().lng == $event.latLng.lng);
this.mapInfo.open(marker);
}
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ google-cloud-secret-manager
googlemaps
Jinja2
simplejson
urllib3==1.26.15
urllib3
Pillow>=10.2

0 comments on commit 873f498

Please sign in to comment.