dont pan map on popup

This commit is contained in:
Graham McIntire 2025-06-28 11:12:48 -05:00
parent 9c69141db5
commit 8cb4302c70
No known key found for this signature in database
2 changed files with 90 additions and 83 deletions

View file

@ -800,7 +800,7 @@ let MapAPRSMap = {
// Add popup if content provided
if (data.popup) {
marker.bindPopup(data.popup);
marker.bindPopup(data.popup, { autoPan: false });
}
// Handle marker click
@ -921,7 +921,7 @@ let MapAPRSMap = {
existingMarker.setPopupContent(data.popup);
// Force popup to refresh by unbinding and rebinding
existingMarker.unbindPopup();
existingMarker.bindPopup(data.popup);
existingMarker.bindPopup(data.popup, { autoPan: false });
}
} else {
// Marker doesn't exist, create it

View file

@ -1,96 +1,103 @@
declare namespace L {
class Map {
constructor(element: string | HTMLElement, options?: MapOptions);
setView(center: LatLngExpression, zoom: number, options?: ZoomOptions): this;
getCenter(): LatLng;
getZoom(): number;
getBounds(): LatLngBounds;
remove(): void;
invalidateSize(options?: { animate?: boolean; pan?: boolean }): this;
whenReady(callback: () => void): this;
on(event: string, handler: (e: any) => void): this;
}
class Map {
constructor(element: string | HTMLElement, options?: MapOptions);
setView(center: LatLngExpression, zoom: number, options?: ZoomOptions): this;
getCenter(): LatLng;
getZoom(): number;
getBounds(): LatLngBounds;
remove(): void;
invalidateSize(options?: { animate?: boolean; pan?: boolean }): this;
whenReady(callback: () => void): this;
on(event: string, handler: (e: any) => void): this;
}
interface MapOptions {
zoomControl?: boolean;
attributionControl?: boolean;
closePopupOnClick?: boolean;
}
interface MapOptions {
zoomControl?: boolean;
attributionControl?: boolean;
closePopupOnClick?: boolean;
}
interface ZoomOptions {
animate?: boolean;
duration?: number;
}
interface ZoomOptions {
animate?: boolean;
duration?: number;
}
class LatLng {
lat: number;
lng: number;
constructor(lat: number, lng: number);
}
class LatLng {
lat: number;
lng: number;
constructor(lat: number, lng: number);
}
type LatLngExpression = LatLng | [number, number];
type LatLngExpression = LatLng | [number, number];
class LatLngBounds {
constructor(southWest: LatLngExpression, northEast: LatLngExpression);
getNorth(): number;
getSouth(): number;
getEast(): number;
getWest(): number;
}
class LatLngBounds {
constructor(southWest: LatLngExpression, northEast: LatLngExpression);
getNorth(): number;
getSouth(): number;
getEast(): number;
getWest(): number;
}
class Marker {
constructor(latLng: LatLngExpression, options?: MarkerOptions);
setLatLng(latLng: LatLngExpression): this;
bindPopup(content: string | HTMLElement): this;
setPopupContent(content: string | HTMLElement): this;
setIcon(icon: DivIcon): this;
getLatLng(): LatLng;
}
class Marker {
constructor(latLng: LatLngExpression, options?: MarkerOptions);
setLatLng(latLng: LatLngExpression): this;
bindPopup(content: string | HTMLElement, options?: PopupOptions): this;
unbindPopup(): this;
openPopup(): this;
closePopup(): this;
setPopupContent(content: string | HTMLElement): this;
setIcon(icon: DivIcon): this;
getLatLng(): LatLng;
}
interface MarkerOptions {
icon?: DivIcon;
}
interface MarkerOptions {
icon?: DivIcon;
}
class DivIcon {
constructor(options: DivIconOptions);
}
interface PopupOptions {
autoPan?: boolean;
}
interface DivIconOptions {
html?: string | HTMLElement;
className?: string;
iconSize?: [number, number];
iconAnchor?: [number, number];
}
class DivIcon {
constructor(options: DivIconOptions);
}
class LayerGroup {
addTo(map: Map): this;
clearLayers(): this;
removeLayer(layer: Layer): this;
}
interface DivIconOptions {
html?: string | HTMLElement;
className?: string;
iconSize?: [number, number];
iconAnchor?: [number, number];
}
interface Layer {
_leaflet_id?: number;
}
class LayerGroup {
addTo(map: Map): this;
clearLayers(): this;
removeLayer(layer: Layer): this;
}
class TileLayer {
constructor(urlTemplate: string, options?: TileLayerOptions);
addTo(map: Map): this;
}
interface Layer {
_leaflet_id?: number;
}
interface TileLayerOptions {
attribution?: string;
maxZoom?: number;
}
class TileLayer {
constructor(urlTemplate: string, options?: TileLayerOptions);
addTo(map: Map): this;
}
function map(element: string | HTMLElement, options?: MapOptions): Map;
function marker(latLng: LatLngExpression, options?: MarkerOptions): Marker;
function tileLayer(urlTemplate: string, options?: TileLayerOptions): TileLayer;
function latLngBounds(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds;
function divIcon(options: DivIconOptions): DivIcon;
function layerGroup(): LayerGroup;
function latLng(lat: number, lng: number): LatLng;
function DomUtil(): {
get(id: string): HTMLElement | null;
remove(el: HTMLElement): void;
};
}
interface TileLayerOptions {
attribution?: string;
maxZoom?: number;
}
function map(element: string | HTMLElement, options?: MapOptions): Map;
function marker(latLng: LatLngExpression, options?: MarkerOptions): Marker;
function tileLayer(urlTemplate: string, options?: TileLayerOptions): TileLayer;
function latLngBounds(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds;
function divIcon(options: DivIconOptions): DivIcon;
function layerGroup(): LayerGroup;
function latLng(lat: number, lng: number): LatLng;
function DomUtil(): {
get(id: string): HTMLElement | null;
remove(el: HTMLElement): void;
};
}