mirror of
https://github.com/kunkunsh/kunkun.git
synced 2025-05-24 13:45:03 +00:00
refactor: enhance Globe component's location handling
- Updated the Globe component to conditionally render markers based on the provided locations prop. - Simplified the destructuring of props for better readability. - Retained default marker locations for cases where no locations are provided.
This commit is contained in:
parent
8890d1f140
commit
e7238a20d2
@ -12,8 +12,7 @@
|
|||||||
|
|
||||||
// let className = ""
|
// let className = ""
|
||||||
// export { className as class }
|
// export { className as class }
|
||||||
let { locations = [], class: className }: { class?: string; locations?: [number, number][] } =
|
let { locations, class: className }: { class?: string; locations?: [number, number][] } = $props()
|
||||||
$props()
|
|
||||||
let pointerInteracting: number | null = null
|
let pointerInteracting: number | null = null
|
||||||
let pointerInteractionMovement = 0
|
let pointerInteractionMovement = 0
|
||||||
let canvas: HTMLCanvasElement
|
let canvas: HTMLCanvasElement
|
||||||
@ -54,24 +53,25 @@
|
|||||||
baseColor: [0.3, 0.3, 0.3],
|
baseColor: [0.3, 0.3, 0.3],
|
||||||
markerColor: [251 / 255, 100 / 255, 21 / 255],
|
markerColor: [251 / 255, 100 / 255, 21 / 255],
|
||||||
glowColor: [1, 1, 1],
|
glowColor: [1, 1, 1],
|
||||||
markers: locations.map((location) => {
|
markers: locations
|
||||||
return {
|
? locations.map((location) => {
|
||||||
location: location,
|
return {
|
||||||
size: 0.03
|
location: location,
|
||||||
}
|
size: 0.03
|
||||||
}),
|
}
|
||||||
// [
|
})
|
||||||
// { location: [14.5995, 120.9842], size: 0.03 },
|
: [
|
||||||
// { location: [19.076, 72.8777], size: 0.03 },
|
{ location: [14.5995, 120.9842], size: 0.03 },
|
||||||
// { location: [23.8103, 90.4125], size: 0.05 },
|
{ location: [19.076, 72.8777], size: 0.03 },
|
||||||
// { location: [30.0444, 31.2357], size: 0.07 },
|
{ location: [23.8103, 90.4125], size: 0.05 },
|
||||||
// { location: [39.9042, 116.4074], size: 0.08 },
|
{ location: [30.0444, 31.2357], size: 0.07 },
|
||||||
// { location: [-23.5505, -46.6333], size: 0.05 },
|
{ location: [39.9042, 116.4074], size: 0.08 },
|
||||||
// { location: [19.4326, -99.1332], size: 0.04 },
|
{ location: [-23.5505, -46.6333], size: 0.05 },
|
||||||
// { location: [40.7128, -74.006], size: 0.1 },
|
{ location: [19.4326, -99.1332], size: 0.04 },
|
||||||
// { location: [34.6937, 135.5022], size: 0.05 },
|
{ location: [40.7128, -74.006], size: 0.1 },
|
||||||
// { location: [41.0082, 28.9784], size: 0.06 }
|
{ location: [34.6937, 135.5022], size: 0.05 },
|
||||||
// ],
|
{ location: [41.0082, 28.9784], size: 0.06 }
|
||||||
|
],
|
||||||
// onRender: (state) => {
|
// onRender: (state) => {
|
||||||
// if (!pointerInteracting) {
|
// if (!pointerInteracting) {
|
||||||
// // Called on every animation frame.
|
// // Called on every animation frame.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user