Skip to content

Commit

Permalink
delete the image function in map component
Browse files Browse the repository at this point in the history
  • Loading branch information
CloudLun committed Mar 1, 2024
1 parent 196f2d7 commit 11fe482
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 0 additions & 4 deletions components/map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ const Map = () => {
const { setMap } = useContext(MapContext) as MapContextType
const { openStreetView } = useContext(StreetViewContext) as StreetViewType


let directionImg = new Image(50, 50)
let markerImg = new Image(25, 25)

useEffect(() => {
mapboxgl.accessToken = process.env.NEXT_PUBLIC_MAPBOX_TOKEN as string
const lng = -73.913;
Expand Down
4 changes: 4 additions & 0 deletions hooks/useOnClickSites.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client"
import React, { useEffect, useContext } from 'react'
import mapboxgl, { MapMouseEvent } from 'mapbox-gl'

Expand All @@ -16,6 +17,9 @@ const useOnClickSites = () => {
const { setDirection, setMarker, setDirectionDegree } = useContext(MarkerContext) as MarkerContextType

useEffect(() => {




map?.on("click", 'sites', (e: MapMouseEvent) => {
if (!openStreetView) {
Expand Down
4 changes: 2 additions & 2 deletions utils/markerCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import directionSVG from "../public/icons/direction.svg";
import markerSVG from "../public/icons/marker.svg";
export const markerCreator = (e: MapMouseEvent, m: mapboxgl.Map) => {

let directionImg: HTMLImageElement | undefined;
let markerImg: HTMLImageElement | undefined;
let directionImg: HTMLImageElement | undefined;
let markerImg: HTMLImageElement | undefined;

if (typeof window !== 'undefined') { // Check if window object is available (i.e., if code is executing in a browser environment)
directionImg = new Image(50, 50);
Expand Down

0 comments on commit 11fe482

Please sign in to comment.