Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:

- name: Setup Pages
uses: actions/configure-pages@v4
with:
enablement: true # This will enable Pages if not already enabled

- name: Install dependencies
run: npm ci
Expand Down
34 changes: 17 additions & 17 deletions src/components/BlenderView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useRef, useCallback, useEffect } from 'react'
import React, { useState, useCallback, useEffect } from 'react'
import * as THREE from 'three'
import {
Menubar,
Expand Down Expand Up @@ -42,22 +42,22 @@ export function BlenderView({ children, onAddPrimitive, objectCount }: BlenderVi
const [localObjectCount, setLocalObjectCount] = useState(0)
const [mode, setMode] = useState<Mode>('object')
const [device, setDevice] = useState<Device>('desktop')
const [selectedObject, setSelectedObject] = useState<string | null>(null)

const createGeometry = (type: PrimitiveObject['type']): THREE.BufferGeometry => {
switch (type) {
case 'cube':
return new THREE.BoxGeometry(1, 1, 1)
case 'sphere':
return new THREE.SphereGeometry(0.5, 32, 16)
case 'cone':
return new THREE.ConeGeometry(0.5, 1, 32)
case 'cylinder':
return new THREE.CylinderGeometry(0.5, 0.5, 1, 32)
default:
return new THREE.BoxGeometry(1, 1, 1)
}
}
// const [selectedObject, setSelectedObject] = useState<string | null>(null)

// const createGeometry = (type: PrimitiveObject['type']): THREE.BufferGeometry => {
// switch (type) {
// case 'cube':
// return new THREE.BoxGeometry(1, 1, 1)
// case 'sphere':
// return new THREE.SphereGeometry(0.5, 32, 16)
// case 'cone':
// return new THREE.ConeGeometry(0.5, 1, 32)
// case 'cylinder':
// return new THREE.CylinderGeometry(0.5, 0.5, 1, 32)
// default:
// return new THREE.BoxGeometry(1, 1, 1)
// }
// }

const addPrimitive = useCallback((type: PrimitiveObject['type']) => {
setLocalObjectCount(prev => prev + 1)
Expand Down
12 changes: 6 additions & 6 deletions src/components/ui/dropdown-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import { Check, ChevronRight, Circle } from "lucide-react"

import { cn } from "../../lib/utils"

const DropdownMenu = DropdownMenuPrimitive.Root
const DropdownMenu: typeof DropdownMenuPrimitive.Root = DropdownMenuPrimitive.Root

const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
const DropdownMenuTrigger: typeof DropdownMenuPrimitive.Trigger = DropdownMenuPrimitive.Trigger

const DropdownMenuGroup = DropdownMenuPrimitive.Group
const DropdownMenuGroup: typeof DropdownMenuPrimitive.Group = DropdownMenuPrimitive.Group

const DropdownMenuPortal = DropdownMenuPrimitive.Portal
const DropdownMenuPortal: typeof DropdownMenuPrimitive.Portal = DropdownMenuPrimitive.Portal

const DropdownMenuSub = DropdownMenuPrimitive.Sub
const DropdownMenuSub: typeof DropdownMenuPrimitive.Sub = DropdownMenuPrimitive.Sub

const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
const DropdownMenuRadioGroup: typeof DropdownMenuPrimitive.RadioGroup = DropdownMenuPrimitive.RadioGroup

const DropdownMenuSubTrigger = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
Expand Down
10 changes: 5 additions & 5 deletions src/components/ui/menubar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { Check, ChevronRight, Circle } from "lucide-react"

import { cn } from "../../lib/utils"

const MenubarMenu = MenubarPrimitive.Menu
const MenubarMenu: typeof MenubarPrimitive.Menu = MenubarPrimitive.Menu

const MenubarGroup = MenubarPrimitive.Group
const MenubarGroup: typeof MenubarPrimitive.Group = MenubarPrimitive.Group

const MenubarPortal = MenubarPrimitive.Portal
const MenubarPortal: typeof MenubarPrimitive.Portal = MenubarPrimitive.Portal

const MenubarSub = MenubarPrimitive.Sub
const MenubarSub: typeof MenubarPrimitive.Sub = MenubarPrimitive.Sub

const MenubarRadioGroup = MenubarPrimitive.RadioGroup
const MenubarRadioGroup: typeof MenubarPrimitive.RadioGroup = MenubarPrimitive.RadioGroup

const Menubar = React.forwardRef<
React.ElementRef<typeof MenubarPrimitive.Root>,
Expand Down
3 changes: 1 addition & 2 deletions stories/src/billboard.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Meta, StoryObj } from '@storybook/react';
import type { Meta } from '@storybook/react';
import { Billboard, Cylinder, Text } from "@react-three/drei";
import { StoryMap } from "./story-map-storybook";

Expand Down Expand Up @@ -27,4 +27,3 @@ const meta: Meta = {
};

export default meta;
type Story = StoryObj<typeof meta>;
5 changes: 2 additions & 3 deletions stories/src/buffer-geometry-editor.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useCallback, useEffect, useRef, useMemo } from 'react'
import type { Meta, StoryObj } from '@storybook/react'
import { useState, useCallback, useEffect, useRef, useMemo } from 'react'
import type { Meta } from '@storybook/react'
import { StoryMap } from './story-map-storybook'
import { Coordinates } from 'react-three-map'
import { Box, Sphere, Cone, Plane } from '@react-three/drei'
Expand Down Expand Up @@ -332,5 +332,4 @@ const meta: Meta<typeof BufferGeometryEditorComponent> = {
}

export default meta
type Story = StoryObj<typeof meta>

5 changes: 2 additions & 3 deletions stories/src/comparison.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Meta, StoryObj } from '@storybook/react';
import type { Meta } from '@storybook/react';
import { MapControls } from "@react-three/drei";
import { Canvas as FiberCanvas } from "@react-three/fiber";
import { useControls } from "leva";
Expand Down Expand Up @@ -46,9 +46,8 @@ const meta: Meta = {
};

export default meta;
type Story = StoryObj<typeof meta>;

export const WithMapStory: Story = {
export const WithMapStory = {
render: () => <WithMap />,
name: 'WithMap',
};
5 changes: 2 additions & 3 deletions stories/src/extrude/extrude-coordinates.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Meta, StoryObj } from '@storybook/react';
import type { Meta } from '@storybook/react';
import { Environment, Extrude, Html } from "@react-three/drei";
import { useMemo } from "react";
import { Coords, coordsToVector3 } from "react-three-map";
Expand Down Expand Up @@ -73,9 +73,8 @@ const meta: Meta = {
};

export default meta;
type Story = StoryObj<typeof meta>;

export const ExtrudeCoordinatesStory: Story = {
export const ExtrudeCoordinatesStory = {
render: () => <ExtrudeCoordinates />,
name: 'ExtrudeCoordinates',
};
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class BatchedPropertiesTexture extends DataTexture {
const dim = field.dim
const data = image.data
const offset = id * width * 4 + fieldId * 4
for (let i = 0; i < dim; i++) data[offset + i] = values[i] || 0
for (let i = 0; i < dim; i++) (data as any)[offset + i] = values[i] || 0
this.needsUpdate = true
}

Expand Down
3 changes: 1 addition & 2 deletions stories/src/free-3d-buildings/buildings-3d.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Meta, StoryObj } from '@storybook/react';
import type { Meta } from '@storybook/react';
// import { Bloom, EffectComposer } from '@react-three/postprocessing'; // Temporarily disabled
import { levaStore, useControls } from "leva";
import { Suspense, useEffect } from "react";
Expand Down Expand Up @@ -59,4 +59,3 @@ const meta: Meta = {
};

export default meta;
type Story = StoryObj<typeof meta>;
3 changes: 1 addition & 2 deletions stories/src/html-on-top.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Meta, StoryObj } from '@storybook/react';
import type { Meta } from '@storybook/react';
import { Box, Html } from "@react-three/drei";
import { useState } from "react";
import { MathUtils } from "three";
Expand Down Expand Up @@ -27,4 +27,3 @@ const meta: Meta = {
};

export default meta;
type Story = StoryObj<typeof meta>;
5 changes: 2 additions & 3 deletions stories/src/ifc/load-ifc-model.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Meta, StoryObj } from '@storybook/react';
import type { Meta } from '@storybook/react';
import { Plane } from "@react-three/drei";
import { button, folder, useControls } from "leva";
import { Suspense, useCallback, useEffect, useRef, useState } from "react";
import * as THREE from 'three';
import { MathUtils } from "three";
import * as OBC from '@thatopen/components';
import * as FRAGS from '@thatopen/fragments';
// import * as FRAGS from '@thatopen/fragments';
import { StoryMap } from "../story-map-storybook";
import modelUrl from './model.ifc?url';

Expand Down Expand Up @@ -239,4 +239,3 @@ const meta: Meta = {
};

export default meta;
type Story = StoryObj<typeof meta>;
3 changes: 1 addition & 2 deletions stories/src/multi-coordinates.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Meta, StoryObj } from '@storybook/react';
import type { Meta } from '@storybook/react';
import { Box } from "@react-three/drei";
import { Vector3 } from "@react-three/fiber";
import { levaStore, useControls } from "leva";
Expand Down Expand Up @@ -103,4 +103,3 @@ const meta: Meta = {
};

export default meta;
type Story = StoryObj<typeof meta>;
3 changes: 1 addition & 2 deletions stories/src/postprocessing.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Meta, StoryObj } from '@storybook/react';
import type { Meta } from '@storybook/react';
import { Box, Plane } from "@react-three/drei";
import { EffectComposer, N8AO } from '@react-three/postprocessing';
import { levaStore, useControls } from "leva";
Expand Down Expand Up @@ -55,4 +55,3 @@ const meta: Meta = {
};

export default meta;
type Story = StoryObj<typeof meta>;
3 changes: 1 addition & 2 deletions stories/src/render-on-demand.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Meta, StoryObj } from '@storybook/react';
import type { Meta } from '@storybook/react';
import { Box, Stats } from "@react-three/drei";
import { useRef, useState } from "react";
import { MathUtils } from "three";
Expand Down Expand Up @@ -40,4 +40,3 @@ const meta: Meta = {
};

export default meta;
type Story = StoryObj<typeof meta>;
12 changes: 8 additions & 4 deletions stories/src/story-map-storybook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface StoryMapProps extends PropsWithChildren {
maplibreChildren?: ReactNode,
maplibreStyle?: any,
mapboxStyle?: any,
mapStyleUrl?: string, // Added for backward compatibility
}

/** `<Map>` styled for stories */
Expand All @@ -43,9 +44,13 @@ export const StoryMap: FC<StoryMapProps> = (props) => {
mapChildren,
mapboxChildren,
maplibreChildren,
maplibreStyle = 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json',
mapboxStyle = 'mapbox://styles/mapbox/dark-v11'
maplibreStyle,
mapboxStyle = 'mapbox://styles/mapbox/dark-v11',
mapStyleUrl // For backward compatibility
} = props;

// Use mapStyleUrl as fallback for maplibreStyle if provided
const actualMaplibreStyle = maplibreStyle || mapStyleUrl || 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json';

const { mapProvider, overlay } = useControls({
mapProvider: {
Expand All @@ -67,15 +72,14 @@ export const StoryMap: FC<StoryMapProps> = (props) => {
return <div style={{ height: '100vh', position: 'relative' }}>
{mapProvider === MapProvider.maplibre && (
<MaplibreMap
antialias
initialViewState={{
latitude,
longitude,
zoom,
pitch,
bearing
}}
mapStyle={maplibreStyle}
mapStyle={actualMaplibreStyle}
>
<MaplibreCanvas latitude={latitude} longitude={longitude} {...canvasProps}>
{children}
Expand Down
3 changes: 1 addition & 2 deletions stories/src/sunlight/sunlight.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Meta, StoryObj } from '@storybook/react';
import type { Meta } from '@storybook/react';
import { Billboard, Line, Plane, Ring, Sphere, useHelper } from "@react-three/drei";
import { useFrame } from "@react-three/fiber";
import { useControls } from "leva";
Expand Down Expand Up @@ -285,4 +285,3 @@ const meta: Meta = {
};

export default meta;
type Story = StoryObj<typeof meta>;
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

"paths": {
"react-three-map": ["./src/mapbox.index.ts"],
"react-three-map/maplibre": ["./src/maplibre.index.ts"],
"react-three-map/mapbox": ["./src/mapbox.index.ts"],
"react-three-map/maplibre": ["./src/maplibre.index.ts"]
},

/* Linting */
Expand Down