From 41c35d6ef35b1b5d347eebb2600f14028731ff47 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 07 十一月 2024 09:30:31 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/map/player.js   |   16 ++++++++++++++++
 zy-acs-flow/src/map/MapPage.jsx |   18 ++++++++++++++++--
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/zy-acs-flow/src/map/MapPage.jsx b/zy-acs-flow/src/map/MapPage.jsx
index abca05b..999486f 100644
--- a/zy-acs-flow/src/map/MapPage.jsx
+++ b/zy-acs-flow/src/map/MapPage.jsx
@@ -19,7 +19,7 @@
 import * as Http from './http';
 import WebSocketClient from './websocket'
 import ConfirmButton from "../page/components/ConfirmButton";
-import { FitScreen, AltRoute } from '@mui/icons-material';
+import { FitScreen, AltRoute, RotateRight } from '@mui/icons-material';
 import MapSearch from "./header/MapSearch";
 import { startupOrShutdown } from "./http";
 import PulseSignal from "../page/components/PulseSignal";
@@ -261,7 +261,7 @@
                         <Box sx={{ mr: 2, display: 'flex', alignItems: 'center' }}>
                             <PulseSignal
                                 negative
-                                negativeColor = '#a4b0be'
+                                negativeColor='#a4b0be'
                                 flag={rcsStatus}
                                 width={12}
                             />
@@ -421,6 +421,20 @@
                         color="primary"
                         size="small"
                         onClick={() => {
+                            player.rotateMap();
+                            setTimeout(() => {
+                                player.adaptScreen();
+                            }, 500)
+                        }}
+                    >
+                        <RotateRight />
+                        {/* &nbsp;{translate('page.map.action.adapt')} */}
+                    </Fab>
+                    <Fab
+                        variant="extended"
+                        color="primary"
+                        size="small"
+                        onClick={() => {
                             player.adaptScreen();
                         }}
                     >
diff --git a/zy-acs-flow/src/map/player.js b/zy-acs-flow/src/map/player.js
index 6960fa9..506e6c0 100644
--- a/zy-acs-flow/src/map/player.js
+++ b/zy-acs-flow/src/map/player.js
@@ -228,6 +228,22 @@
             }, 200).start();
     }
 
+    rotateMap = () => {
+        const bounds = this.mapContainer.getLocalBounds();
+        const centerX = bounds.x + bounds.width / 2;
+        const centerY = bounds.y + bounds.height / 2;
+        this.mapContainer.pivot.set(centerX, centerY);
+        this.mapContainer.position.set(this.app.renderer.width / 2, this.app.renderer.height / 2);
+
+        const rotationIncrement = Math.PI / 2; // 90 degrees in radians
+        const newRotation = this.mapContainer.rotation + rotationIncrement;
+
+        new TWEEDLE.Tween(this.mapContainer)
+            .to({ rotation: newRotation }, 300)
+            .easing(TWEEDLE.Easing.Quadratic.Out)
+            .start();
+    }
+
     showCoordinates = () => {
         this.coordinatesText = new PIXI.Text('{ x: 0, y: 0 }', {
             fill: this.themeMode === 'dark' ? 0xdddddd : 0x333333,

--
Gitblit v1.9.1