diff --git a/apps/client/src/widgets/collections/geomap/index.tsx b/apps/client/src/widgets/collections/geomap/index.tsx index 4f1784850..b8e80ab79 100644 --- a/apps/client/src/widgets/collections/geomap/index.tsx +++ b/apps/client/src/widgets/collections/geomap/index.tsx @@ -38,6 +38,8 @@ enum State { export default function GeoView({ note, noteIds, viewConfig, saveConfig }: ViewModeProps) { const [ state, setState ] = useState(State.Normal); + const [ coordinates, setCoordinates ] = useState(viewConfig?.view?.center); + const [ zoom, setZoom ] = useState(viewConfig?.view?.zoom); const [ layerName ] = useNoteLabel(note, "map:style"); const [ hasScale ] = useNoteLabelBoolean(note, "map:scale"); const [ isReadOnly ] = useNoteLabelBoolean(note, "readOnly"); @@ -50,6 +52,12 @@ export default function GeoView({ note, noteIds, viewConfig, saveConfig }: ViewM useEffect(() => { froca.getNotes(noteIds).then(setNotes) }, [ noteIds ]); + useEffect(() => { + if (!note) return; + setCoordinates(viewConfig?.view?.center ?? DEFAULT_COORDINATES); + setZoom(viewConfig?.view?.zoom ?? DEFAULT_ZOOM); + }, [ note, viewConfig ]); + // Note creation. useTriliumEvent("geoMapCreateChildNote", () => { toast.showPersistent({ @@ -122,10 +130,10 @@ export default function GeoView({ note, noteIds, viewConfig, saveConfig }: ViewM return (
- { if (!viewConfig) viewConfig = {}; @@ -137,7 +145,7 @@ export default function GeoView({ note, noteIds, viewConfig, saveConfig }: ViewM scale={hasScale} > {notes.map(note => )} - + }
);