-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
142 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { MeasurePlugin } from '@realsee/dnalogel/dist' | ||
import { createFiveProvider, FiveCanvas } from '@realsee/five/react' | ||
import * as React from 'react' | ||
import Usage from './Usage.tsx' | ||
import { parseWork } from '@realsee/five' | ||
import { ThemeProvider } from '@mui/material' | ||
import useFetchDatas, { DATA_TYPES } from '../utils/useFetchDatas.ts' | ||
import '../utils/$five.ts' | ||
import { useWindowDimensions } from '../utils/useWindowDimensions.ts' | ||
import { theme } from '../utils/theme.ts' | ||
|
||
const FiveProvider = createFiveProvider({ | ||
imageOptions: { size: 512 }, // 图片默认分辨率 | ||
textureOptions: { size: 512 }, // 贴图默认分辨率 | ||
onlyRenderIfNeeds: true, | ||
plugins: [[MeasurePlugin, 'MeasurePlugin']], | ||
}) | ||
|
||
const workCode = (new URLSearchParams(window.location.search).get('workCode') ?? '') as any | ||
const workType = (new URLSearchParams(window.location.search).get('workType') ?? 'real') as any | ||
|
||
const App: React.FC = () => { | ||
const size = useWindowDimensions() | ||
const work = useFetchDatas(DATA_TYPES.WORK, workCode, workCode ? workType : undefined) | ||
|
||
return ( | ||
work && ( | ||
<ThemeProvider theme={theme}> | ||
<FiveProvider initialWork={parseWork(work)}> | ||
<FiveCanvas {...size} /> | ||
<Usage /> | ||
</FiveProvider> | ||
</ThemeProvider> | ||
) | ||
) | ||
} | ||
|
||
export default App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Paper, ButtonGroup, Button } from '@mui/material' | ||
import { FiveModeSwitcher } from '../components/FiveModeSwitcher' | ||
|
||
import { unsafe__useFiveInstance } from '@realsee/five/react' | ||
import { MeasureController } from '@realsee/dnalogel/dist/MeasurePlugin/Controller' | ||
|
||
const PanoMeasurePluginUsage = () => { | ||
const five = unsafe__useFiveInstance() | ||
const measurePlugin = five.plugins.MeasurePlugin as MeasureController | ||
|
||
return ( | ||
<> | ||
<FiveModeSwitcher modeList={['Panorama', 'Mapview', 'Model']} /> | ||
<Paper sx={{ position: 'fixed', top: '10px', right: '10px', backgroundColor: 'transparent' }}> | ||
<ButtonGroup orientation="vertical" variant="contained" style={{ textTransform: 'initial' }}> | ||
<Button onClick={() => measurePlugin.measure()}>Start</Button> | ||
<Button onClick={() => measurePlugin.endMeasure()}>End</Button> | ||
<Button onClick={() => measurePlugin.undo()}>Undo</Button> | ||
<Button onClick={() => measurePlugin.dispose()}>Close</Button> | ||
</ButtonGroup> | ||
</Paper> | ||
</> | ||
) | ||
} | ||
|
||
export default PanoMeasurePluginUsage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" href="data:;base64,iVBORw0KGgo=" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>PanoMeasurePlugin</title> | ||
<style> | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
html, | ||
body #app { | ||
width: 100%; | ||
height: 100%; | ||
overflow: hidden; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="./index"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import App from './App' | ||
|
||
ReactDOM.render(<App />, document.querySelector('#app')) | ||
|
||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { createTheme } from '@mui/material' | ||
|
||
export const theme = createTheme({ | ||
typography: { button: { textTransform: 'none' } }, | ||
}) |