From fde2221d08d31f94bcd67367f53f480f57f09fa5 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 29 二月 2024 13:26:06 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/map/index.jsx | 31 +++++++++++++++++++++----------
1 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/zy-asrs-flow/src/pages/map/index.jsx b/zy-asrs-flow/src/pages/map/index.jsx
index 58590b6..afe4232 100644
--- a/zy-asrs-flow/src/pages/map/index.jsx
+++ b/zy-asrs-flow/src/pages/map/index.jsx
@@ -3,23 +3,34 @@
import * as TWEEDLE from 'tweedle.js';
const Map = () => {
- const app = new PIXI.Application({
- width: window.innerWidth,
- height: window.innerHeight,
- antialias: true,
- })
+ const map = React.useRef();
+ React.useEffect(() => {
+ const app = new PIXI.Application({
+ width: window.innerWidth,
+ height: window.innerHeight,
+ background: '#1099bb',
+ antialias: true,
+ })
- app.stage.interactive = true;
- app.stage.hitArea = app.screen;
+ app.stage.interactive = true;
+ app.stage.hitArea = app.screen;
- globalThis.__PIXI_APP__ = app;
+ globalThis.__PIXI_APP__ = app;
- document.body.appendChild(app.view);
+ map.current.appendChild(app.view);
+
+ return () => {
+ app.destroy(true, true);
+ }
+ }, []);
return (
<>
- <h1>Map</h1>
+ <div
+ ref={map}
+ >
+ </div>
</>
)
}
--
Gitblit v1.9.1