Skip to content

Commit

Permalink
doc: storybook add stories for three-coverage-heatmap Renderer.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsengyushiang committed May 21, 2024
1 parent f0f4f90 commit 246b2d5
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useRef } from "react";
import ThreeApp from "../../three";
import React, { useEffect, useRef, useState } from "react";
import ThreeRenderer from "../../three";

const Renderer = ({
texture,
Expand All @@ -9,6 +9,7 @@ const Renderer = ({
aabbs,
planes,
}) => {
const [ThreeApp] = useState(new ThreeRenderer());
const divRef = useRef(null);
const canvasRef = useRef(null);

Expand Down
4 changes: 1 addition & 3 deletions packages/three-coverage-heatmap/src/three/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,4 @@ function App() {
};
}

const instance = new App();

export default instance;
export default App;
27 changes: 0 additions & 27 deletions src/stories/App.jsx

This file was deleted.

24 changes: 0 additions & 24 deletions src/stories/App.stories.js

This file was deleted.

2 changes: 2 additions & 0 deletions src/stories/Renderer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Renderer from "three-coverage-heatmap";
export default Renderer;
99 changes: 99 additions & 0 deletions src/stories/Renderer.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import Renderer from "./Renderer";
import { wallsAABBs, furnitureAABBs, getPlanes } from "./data";

export default {
title: "three-coverage-heatmap/Renderer",
tags: ["autodocs"],
component: Renderer,
parameters: {
layout: "fullscreen",
},
};

export const ShowroomFloorAp = {
args: {
texture: "./floorplan.png",
isSignalIndex: false,
signalIntensity: [10],
signals: [[0, 1e-3, 8.1]],
aabbs: [...wallsAABBs, ...furnitureAABBs],
planes: getPlanes(0.8),
},
};

export const ShowroomCeilingAp = {
args: {
texture: "./floorplan.png",
isSignalIndex: false,
signalIntensity: [10],
signals: [[0, 2.0, 8.1]],
aabbs: [...wallsAABBs, ...furnitureAABBs],
planes: getPlanes(0.8),
},
};

export const ShowroomTwoAps = {
args: {
texture: "./floorplan.png",
isSignalIndex: false,
signalIntensity: [10, 10],
signals: [
[0, 1.1, -4],
[0, 2.0, 8.1],
],
aabbs: [...wallsAABBs, ...furnitureAABBs],
planes: getPlanes(0.8),
},
};

export const ShowroomIndexMap = {
args: {
texture: "./floorplan.png",
isSignalIndex: true,
signalIntensity: [10, 10],
signals: [
[0, 1.1, -4],
[0, 2.0, 8.1],
],
aabbs: [...wallsAABBs, ...furnitureAABBs],
planes: getPlanes(0.8),
},
};

export const withoutDoor = {
args: {
texture: "./floorplan.png",
isSignalIndex: false,
signalIntensity: [10, 10],
signals: [
[0, 1.1, -4],
[0, 2.0, 8.1],
],
aabbs: [...wallsAABBs, ...furnitureAABBs],
},
};

export const withoutFurniture = {
args: {
texture: "./floorplan.png",
isSignalIndex: false,
signalIntensity: [10, 10],
signals: [
[0, 1.1, -4],
[0, 2.0, 8.1],
],
aabbs: [...wallsAABBs],
},
};

export const withoutWall = {
args: {
texture: "./floorplan.png",
isSignalIndex: false,
signalIntensity: [10, 10],
signals: [
[0, 1.1, -4],
[0, 2.0, 8.1],
],
},
};

0 comments on commit 246b2d5

Please sign in to comment.