import { Meta, StoryObj } from "@storybook/react"; import { BlendOption, BufferPointMaterial, Cartesian3, Color } from "cesium"; import BufferPoint from "../BufferPoint"; import CameraFlyTo from "../CameraFlyTo"; import Viewer from "../Viewer"; import BufferPointCollection from "./BufferPointCollection"; type Story = StoryObj; export default { title: "BufferPointCollection", component: BufferPointCollection, } as Meta; const positions = Array.from({ length: 50 }, (_, i) => { const angle = (i / 50) * 2 * Math.PI; return Cartesian3.fromDegrees(-95.0 + 0.3 * Math.cos(angle), 40.0 + 0.3 * Math.sin(angle)); }); const opaqueMaterial = new BufferPointMaterial({ color: Color.CYAN, size: 12 }); export const Opaque: Story = { render: () => ( {positions.map((position, i) => ( ))} ), }; /** * Translucent variant — demonstrates the new `blendOption` ctor prop (Cesium 1.142+). * `blendOption` alone is invisible without an alpha-aware material; the * `BufferPointMaterial` here sets `color.alpha < 1` and `outlineColor.alpha < 1` * to actually produce translucent points. */ export const Translucent: Story = { render: () => { const translucentMaterial = new BufferPointMaterial({ color: Color.RED.withAlpha(0.35), outlineColor: Color.YELLOW.withAlpha(0.6), outlineWidth: 2, size: 16, }); return ( {positions.map((position, i) => ( ))} ); }, };