designsss
This commit is contained in:
1 parent
9401ef3a9e
commit
eb64159275
5 files changed
+225
-60
No files matched your search
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import React, { useEffect, useRef, useState, useCallback } from 'react';
|
||||
import React, { useEffect, useRef, useState, useCallback, createElement } from 'react';
|
||||
import * as maplibregl from 'maplibre-gl';
|
||||
import 'maplibre-gl/dist/maplibre-gl.css';
|
||||
import styles from '@/css/MapView.module.css';
|
||||
@@ -73,7 +73,7 @@ export default function MapView({
|
||||
source: 'osm-tiles',
|
||||
minzoom: 0,
|
||||
maxzoom: 19,
|
||||
},
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
@@ -86,14 +86,21 @@ export default function MapView({
|
||||
|
||||
map.addControl(new maplibregl.NavigationControl({ visualizePitch: true }), 'bottom-right');
|
||||
|
||||
const el = document.createElement("img");
|
||||
el.src = "/icons/person.svg";
|
||||
el.alt = "You";
|
||||
el.width = 42;
|
||||
el.className = styles["sword"];
|
||||
|
||||
const geolocate = new maplibregl.GeolocateControl({
|
||||
positionOptions: {
|
||||
enableHighAccuracy: true,
|
||||
},
|
||||
trackUserLocation: true,
|
||||
showUserLocation: true,
|
||||
showAccuracyCircle: true,
|
||||
showAccuracyCircle: false,
|
||||
});
|
||||
geolocate._dotElement = el;
|
||||
map.addControl(geolocate, 'bottom-right');
|
||||
|
||||
map.addControl(new maplibregl.ScaleControl({ unit: 'metric' }), 'bottom-left');
|
||||
@@ -135,15 +142,21 @@ export default function MapView({
|
||||
|
||||
markers.forEach((markerData) => {
|
||||
if (!currentMarkers.has(markerData.id)) {
|
||||
const popup = new maplibregl.Popup({ offset: 25, className: styles["marker"] }).setHTML(
|
||||
/*const popup = new maplibregl.Popup({ offset: 25, className: styles["marker"] }).setHTML(
|
||||
`<strong>${markerData.title}</strong>${
|
||||
markerData.description ? `<p style="margin:4px 0 0;font-size:12px;">${markerData.description}</p>` : ''
|
||||
}`
|
||||
);
|
||||
);*/
|
||||
|
||||
const newMarker = new maplibregl.Marker({ color: '#e11d48', })
|
||||
const el = document.createElement("img");
|
||||
el.src = "/icons/Schwert-gps.svg";
|
||||
el.alt = "GPS Point";
|
||||
el.width = 80;
|
||||
el.className = styles["sword"];
|
||||
|
||||
const newMarker = new maplibregl.Marker({ element: el, anchor: "bottom" })
|
||||
.setLngLat([markerData.lng, markerData.lat])
|
||||
.setPopup(popup)
|
||||
//.setPopup(popup)
|
||||
.addTo(map);
|
||||
|
||||
newMarker.getElement().addEventListener('click', () => {
|
||||
|
||||
@@ -27,53 +27,42 @@ export default function Tour() {
|
||||
const [ test, setTest ] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
let timerId: string | number | NodeJS.Timeout | undefined;
|
||||
let timerId: string | number | NodeJS.Timeout | undefined;
|
||||
|
||||
const requestPosition = () => {
|
||||
timerId = setTimeout(() => {
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
(position) => {
|
||||
setMarkers([{
|
||||
id: "riddle_one",
|
||||
title: "Erstes Rätsel",
|
||||
description: "Test Punkt verschoben vom Standort",
|
||||
lng: position.coords.longitude + 0.002,
|
||||
lat: position.coords.latitude,
|
||||
}]);
|
||||
},
|
||||
(error) => {
|
||||
requestPosition();
|
||||
}
|
||||
);
|
||||
}, 500);
|
||||
};
|
||||
const requestPosition = () => {
|
||||
timerId = setTimeout(() => {
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
(position) => {
|
||||
setMarkers([{
|
||||
id: "riddle_one",
|
||||
title: "Erstes Rätsel",
|
||||
description: "Test Punkt verschoben vom Standort",
|
||||
lng: position.coords.longitude + 0.002,
|
||||
lat: position.coords.latitude,
|
||||
}]);
|
||||
},
|
||||
(error) => {
|
||||
requestPosition();
|
||||
}
|
||||
);
|
||||
}, 500);
|
||||
};
|
||||
|
||||
requestPosition();
|
||||
requestPosition();
|
||||
|
||||
return () => clearTimeout(timerId);
|
||||
}, []);
|
||||
return () => clearTimeout(timerId);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
return (
|
||||
<div className={styles["screen-container"]}>
|
||||
<div className={styles["top-bar"]}>
|
||||
<p>{"Ruf: " + points}</p>
|
||||
<p>{"Players: " + playersStr}</p>
|
||||
<br></br>
|
||||
<ChargedButton onAction={() => {
|
||||
|
||||
setTourCode("");
|
||||
setCompletedRiddles("");
|
||||
setPlayers("");
|
||||
setPoints("");
|
||||
setStep("0");
|
||||
}} holdDuration={500}>
|
||||
Zurücksetzen
|
||||
</ChargedButton>
|
||||
<ChargedButton onAction={() => {
|
||||
|
||||
}} holdDuration={500}>
|
||||
Test
|
||||
</ChargedButton>
|
||||
<div className={styles["top-bar-content"]}>
|
||||
<div className={styles["points-outer-box"]}>
|
||||
<div className={styles["points-inner-box"]}>
|
||||
Your content goes here
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles["main-content"]}>
|
||||
<div className={styles["map"]}>
|
||||
|
||||
Reference in new issue
Block a user