mirror of
https://github.com/zadam/trilium.git
synced 2026-05-07 20:37:57 +02:00
chore(collections/map): fix type issue
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { GeoJSONSource } from "maplibre-gl";
|
||||
import { type GeoJSONSource } from "maplibre-gl";
|
||||
import { useCallback, useContext, useEffect } from "preact/hooks";
|
||||
|
||||
import FNote from "../../../entities/fnote";
|
||||
@@ -63,7 +63,7 @@ export default function Markers({ note }: { note: FNote }) {
|
||||
return key;
|
||||
}
|
||||
|
||||
const features: maplibregl.GeoJSONFeature[] = [];
|
||||
const features: GeoJSON.Feature[] = [];
|
||||
for (const childNote of childNotes) {
|
||||
const location = childNote.getLabelValue(LOCATION_ATTRIBUTE);
|
||||
const latLng = location?.split(",", 2).map((el) => parseFloat(el)) as [ number, number ] | undefined;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MapMouseEvent, Popup } from "maplibre-gl";
|
||||
import { type MapGeoJSONFeature, MapMouseEvent, Popup } from "maplibre-gl";
|
||||
import { useContext, useEffect } from "preact/hooks";
|
||||
|
||||
import { ParentMap } from "./map";
|
||||
@@ -17,10 +17,12 @@ export default function Tooltips() {
|
||||
className: "marker-tooltip"
|
||||
});
|
||||
|
||||
function onMouseEnter(e: MapMouseEvent) {
|
||||
const feature = e.features[0];
|
||||
function onMouseEnter(e: MapMouseEvent & { features?: MapGeoJSONFeature[]; }) {
|
||||
const feature = e.features?.[0];
|
||||
if (!feature || !map || feature.geometry.type !== "Point") return;
|
||||
|
||||
tooltip
|
||||
.setLngLat(feature.geometry.coordinates)
|
||||
.setLngLat(feature.geometry.coordinates as [ number, number ])
|
||||
.setHTML(`<strong>${feature.properties.name}</strong>`)
|
||||
.addTo(map);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user