From 1b02fcfb2a0655299a38ad99e2bcba2b95d4abe2 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 01 三月 2024 09:57:40 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/map/index.jsx | 32 +++++++++++++++++++++++++++-----
1 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/zy-asrs-flow/src/pages/map/index.jsx b/zy-asrs-flow/src/pages/map/index.jsx
index 370f3a2..ba33f5b 100644
--- a/zy-asrs-flow/src/pages/map/index.jsx
+++ b/zy-asrs-flow/src/pages/map/index.jsx
@@ -53,11 +53,33 @@
};
window.addEventListener('resize', handleResize);
- // app init
- app.stage.interactive = true;
- app.stage.hitArea = app.screen;
- globalThis.__PIXI_APP__ = app;
- mapRef.current.appendChild(app.view);
+ setTimeout(() => {
+ // app init
+ app.stage.eventMode = 'auto';
+ app.stage.hitArea = app.screen;
+ globalThis.__PIXI_APP__ = app;
+ mapRef.current.appendChild(app.view);
+
+ // mapContainer ------------------------------
+ const mapContainer = new PIXI.Container();
+ mapContainer.name = "mapContainer";
+ mapContainer.data = {};
+ app.stage.addChild(mapContainer);
+
+ const texture = PIXI.Texture.from('https://pixijs.com/assets/bunny.png');
+ const bunny = new PIXI.Sprite(texture);
+ bunny.anchor.set(0.5);
+ console.log(app.screen);
+ bunny.x = app.screen.width / 2;
+ bunny.y = app.screen.height / 2;
+
+ mapContainer.addChild(bunny);
+
+ app.ticker.add((delta) => {
+ bunny.rotation -= 0.01 * delta;
+ });
+ }, 300)
+
}, []);
React.useEffect(() => {
--
Gitblit v1.9.1