From f547e6200ad888ed47dd32ed566c5e2b319507ac Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 21 三月 2024 13:09:59 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/map/index.jsx | 112 +++++++++++++++++++++++++++++++-------------------------
1 files changed, 62 insertions(+), 50 deletions(-)
diff --git a/zy-asrs-flow/src/pages/map/index.jsx b/zy-asrs-flow/src/pages/map/index.jsx
index 0d54d1e..0f603ee 100644
--- a/zy-asrs-flow/src/pages/map/index.jsx
+++ b/zy-asrs-flow/src/pages/map/index.jsx
@@ -40,7 +40,8 @@
},
content: {
backgroundColor: '#F8FAFB',
- height: 'calc(100vh - 120px)'
+ height: 'calc(100vh - 120px)',
+ position: 'relative'
},
select: {
color: 'red',
@@ -84,6 +85,9 @@
const [dataFetched, setDataFetched] = React.useState(false);
const [curSprite, setCurSPrite] = React.useState(null);
const prevCurSpriteRef = React.useRef();
+ const hasFloor = true;
+ // const [hasFloor, setHasFloor] = React.useState(true);
+ const [curFloor, setCurFloor] = React.useState(1);
// init func
React.useEffect(() => {
@@ -153,7 +157,7 @@
player.showGridlines();
player.hideStarryBackground();
- player.activateMapEvent(Utils.MapEvent.SELECTION_BOX);
+ player.activateMapEvent(Utils.MapEvent.SELECTION_BOX, model);
Utils.removeSelectedEffect();
setSpriteBySettings(null);
@@ -169,7 +173,7 @@
player.showGridlines();
player.showStarryBackground();
- player.activateMapEvent(null);
+ player.activateMapEvent(Utils.MapEvent.SELECTION_BOX, model);
setDeviceVisible(false);
setDrawerVisible(false);
@@ -213,6 +217,10 @@
}
}, [curSprite]);
const prevCurSprite = prevCurSpriteRef.current;
+
+ // watch curFloor
+ React.useEffect(() => {
+ }, [curFloor]);
// didClickSprite, stop triggers both sprite click and play's selection boxs
React.useEffect(() => {
@@ -261,7 +269,7 @@
/>
)}
</Col>
- <Col span={12} style={{ backgroundColor: styles.dark ? '#2C3A47' : '#4a69bd' }}>
+ <Col span={12} style={{ backgroundColor: styles.dark ? '#2f3542' : '#4a69bd' }}>
<Flex className={styles.flex} gap={'large'} justify={'flex-end'} align={'center'}>
{model === MapModel.OBSERVER_MODEL && (
@@ -341,58 +349,62 @@
</Row>
</Header>
<Content ref={contentRef} className={styles.content}>
- <div ref={mapRef} style={{ position: "relative" }} >
+ <div ref={mapRef} />
+
+ {hasFloor && (
<MapFloor
-
+ curFloor={curFloor}
+ setCurFloor={setCurFloor}
/>
- <FloatButton.Group
- shape="square"
- style={{
- left: 35,
- bottom: 35
+ )}
+
+ <FloatButton.Group
+ shape="square"
+ style={{
+ left: 35,
+ bottom: 35
+ }}
+ >
+ <FloatButton
+ icon={<CompressOutlined />}
+ onClick={() => {
+ player.adaptScreen();
}}
- >
- <FloatButton
- icon={<CompressOutlined />}
- onClick={() => {
- player.adaptScreen();
- }}
- />
- </FloatButton.Group>
+ />
+ </FloatButton.Group>
- <FloatButton.Group
+ <FloatButton.Group
+ hidden={model === MapModel.OBSERVER_MODEL}
+ style={{
+ left: 35,
+ bottom: window.innerHeight / 2
+ }}
+ icon={<AppstoreAddOutlined />}
+ >
+ <FloatButton
hidden={model === MapModel.OBSERVER_MODEL}
- style={{
- left: 35,
- bottom: window.innerHeight / 2
+ type={deviceVisible ? 'primary' : 'default'}
+ tooltip={<div><FormattedMessage id='map.device.add' defaultMessage='娣诲姞璁惧' /></div>}
+ icon={<FileAddOutlined />}
+ onClick={() => {
+ if (deviceVisible) {
+ setDeviceVisible(false);
+ } else {
+ setDeviceVisible(true);
+ setModel(MapModel.MOVABLE_MODEL);
+ }
}}
- icon={<AppstoreAddOutlined />}
- >
- <FloatButton
- hidden={model === MapModel.OBSERVER_MODEL}
- type={deviceVisible ? 'primary' : 'default'}
- tooltip={<div><FormattedMessage id='map.device.add' defaultMessage='娣诲姞璁惧' /></div>}
- icon={<FileAddOutlined />}
- onClick={() => {
- if (deviceVisible) {
- setDeviceVisible(false);
- } else {
- setDeviceVisible(true);
- setModel(MapModel.MOVABLE_MODEL);
- }
- }}
- />
- <FloatButton
- hidden={model === MapModel.OBSERVER_MODEL}
- type={model === MapModel.SETTINGS_MODEL ? 'primary' : 'default'}
- tooltip={<div><FormattedMessage id='map.device.oper' defaultMessage='鍙傛暟璁剧疆' /></div>}
- icon={<SettingOutlined />}
- onClick={() => {
- setModel(model === MapModel.SETTINGS_MODEL ? MapModel.MOVABLE_MODEL : MapModel.SETTINGS_MODEL)
- }}
- />
- </FloatButton.Group>
- </div>
+ />
+ <FloatButton
+ hidden={model === MapModel.OBSERVER_MODEL}
+ type={model === MapModel.SETTINGS_MODEL ? 'primary' : 'default'}
+ tooltip={<div><FormattedMessage id='map.device.oper' defaultMessage='鍙傛暟璁剧疆' /></div>}
+ icon={<SettingOutlined />}
+ onClick={() => {
+ setModel(model === MapModel.SETTINGS_MODEL ? MapModel.MOVABLE_MODEL : MapModel.SETTINGS_MODEL)
+ }}
+ />
+ </FloatButton.Group>
</Content>
</Layout >
--
Gitblit v1.9.1