⚡ Removed tooltip for now
This commit is contained in:
+2
-30
@@ -1,10 +1,7 @@
|
||||
import { PickingInfo } from 'deck.gl';
|
||||
import { FormEvent, useCallback } from 'react';
|
||||
import { FormEvent } from 'react';
|
||||
|
||||
export const useActions = ({
|
||||
deckRef,
|
||||
viewState,
|
||||
setClickedItem,
|
||||
setIsAddLoveOpened,
|
||||
setIsLoading,
|
||||
setAddLoveMessage,
|
||||
@@ -75,30 +72,5 @@ export const useActions = ({
|
||||
}
|
||||
};
|
||||
|
||||
const onMapClick = useCallback(
|
||||
(ev: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
|
||||
if (!deckRef.current) return;
|
||||
|
||||
const containerRect = ev.currentTarget.getBoundingClientRect();
|
||||
const x = ev.clientX - containerRect.left;
|
||||
const y = ev.clientY - containerRect.top;
|
||||
|
||||
const pickInfos: PickingInfo | null = deckRef.current.pickObject({
|
||||
x,
|
||||
y,
|
||||
radius: 1,
|
||||
depth: 5,
|
||||
});
|
||||
console.log('pickInfos: ', pickInfos);
|
||||
if (!pickInfos) {
|
||||
setClickedItem(null);
|
||||
return;
|
||||
}
|
||||
|
||||
setClickedItem(pickInfos);
|
||||
},
|
||||
[deckRef, setClickedItem]
|
||||
);
|
||||
|
||||
return { toggleLoveMenu, addPoint, onMapClick };
|
||||
return { toggleLoveMenu, addPoint };
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IconLayer, ScatterplotLayer } from 'deck.gl';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { IconLayer, ScatterplotLayer } from 'deck.gl';
|
||||
import { StringifiedPinIcon } from '@/assets/PinIcon';
|
||||
|
||||
export const useData = () => {
|
||||
@@ -24,8 +24,6 @@ export const useData = () => {
|
||||
zoom: 5,
|
||||
});
|
||||
|
||||
const [clickedItem, setClickedItem] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
if ('geolocation' in navigator == false) {
|
||||
setCanUseGeolocation(false);
|
||||
@@ -121,8 +119,6 @@ export const useData = () => {
|
||||
geoError,
|
||||
layers,
|
||||
canUseGeolocation,
|
||||
clickedItem,
|
||||
setClickedItem,
|
||||
isAddLoveOpened,
|
||||
setIsAddLoveOpened,
|
||||
isLoading,
|
||||
|
||||
Reference in New Issue
Block a user