chore(react/collections/geomap): fix editability

This commit is contained in:
Elian Doran
2025-09-04 16:47:38 +03:00
parent 5854adb806
commit 0f9a529647
2 changed files with 4 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
import Map from "./map";
import "./index.css";
import { ViewModeProps } from "../interface";
import { useNoteLabel, useNoteProperty, useSpacedUpdate } from "../../react/hooks";
import { useNoteLabel, useNoteLabelBoolean, useNoteProperty, useSpacedUpdate } from "../../react/hooks";
import { DEFAULT_MAP_LAYER_NAME } from "./map_layer";
import { divIcon, LatLng } from "leaflet";
import { useCallback, useEffect, useMemo, useState } from "preact/hooks";
@@ -26,7 +26,7 @@ interface MapData {
export default function GeoView({ note, noteIds, viewConfig, saveConfig }: ViewModeProps<MapData>) {
const [ layerName ] = useNoteLabel(note, "map:style");
const [ isReadOnly ] = useNoteLabel(note, "readOnly");
const [ isReadOnly ] = useNoteLabelBoolean(note, "readOnly");
const [ notes, setNotes ] = useState<FNote[]>([]);
const spacedUpdate = useSpacedUpdate(() => {
if (viewConfig) {
@@ -85,7 +85,7 @@ function NoteMarker({ note, editable }: { note: FNote, editable: boolean }) {
icon={icon}
mouseDown={onMouseDown}
draggable={editable}
dragged={onDragged}
dragged={editable ? onDragged : undefined}
/>
}

View File

@@ -6,7 +6,7 @@ export interface MarkerProps {
coordinates: [ number, number ];
icon?: Icon | DivIcon;
mouseDown?: (e: MouseEvent) => void;
dragged: ((newCoordinates: LatLng) => void)
dragged?: ((newCoordinates: LatLng) => void);
draggable?: boolean;
}