From 81d4c903f75a71c24699def5a85abcd07d451ce4 Mon Sep 17 00:00:00 2001 From: gman Date: Thu, 26 Oct 2023 14:15:58 +0300 Subject: [PATCH] scale control and minor changes --- src/KartaPage.tsx | 69 +++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/src/KartaPage.tsx b/src/KartaPage.tsx index 2716583..b7fca7c 100644 --- a/src/KartaPage.tsx +++ b/src/KartaPage.tsx @@ -1,6 +1,6 @@ import { Paper, Flex, ScrollArea, Autocomplete } from '@mantine/core'; import { ArticleCardVertical } from './ArticleCard'; -import Map, {Source, Layer} from 'react-map-gl/maplibre'; +import Map, { Source, Layer, ScaleControl } from 'react-map-gl/maplibre'; import { useState, useEffect, useRef } from 'react'; import Fuse from 'fuse.js' @@ -81,42 +81,42 @@ export function KartaPage() { cursor={cursor} mapStyle={mapstyle} interactiveLayerIds={['points-layer']} - onClick={e => {e.features[0] ? setSelected(e.features[0].properties.id) : setSelected(-1); console.log(e.features)}} + onClick={e => { e.features[0] ? setSelected(e.features[0].properties.id) : setSelected(-1) }} onMouseEnter={() => setCursor('pointer')} onMouseLeave={() => setCursor('grab')} onLoad={handleMapLoad} + > + - - a.id)]} - paint={{ - "circle-color": ['match', ['get', 'id'], selected, '#FF0000', '#1c9099'], - "circle-radius": 8, - "circle-opacity": 0.7, - }} - maxzoom={9} - /> - a.id)]} - layout={{ - 'icon-image': 'pin-marker', - 'icon-size': 1 - }} - minzoom={9} - /> - - + a.id)]} + paint={{ + "circle-color": ['match', ['get', 'id'], selected, '#FF0000', '#1c9099'], + "circle-radius": 8, + "circle-opacity": 0.7, + }} + maxzoom={7} + /> + a.id)]} + layout={{ + 'icon-image': 'pin-marker', + 'icon-size': 1 + }} + minzoom={7} + /> + + } - - - )}