style(map): bug:19705、19707
parent
f23b8d0f0d
commit
297714ce08
|
|
@ -16,11 +16,12 @@ const headerAnimation = {
|
|||
};
|
||||
|
||||
function Header() {
|
||||
const { currentPort, currentBranchOffice, mapMethods, portArea, headerTitle, actions } = useContext(Context);
|
||||
const { currentPort, currentBranchOffice, mapMethods, portArea, headerTitle, actions, closePopup } = useContext(Context);
|
||||
|
||||
const isPortTitle = headerTitle === "秦港股份安全监管平台";
|
||||
|
||||
const onBack = () => {
|
||||
closePopup();
|
||||
sessionStorage.removeItem("mapCurrentBranchOfficeId");
|
||||
if (!currentPort) {
|
||||
window.close();
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const BranchOffice = ({ info, close, enter }) => {
|
|||
<div className="data-label textColor">地址:</div>
|
||||
<div className="data-value">
|
||||
<span className="label-num textColor line-3">
|
||||
{info?.address}
|
||||
{info?.addressBusiness}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import "./index.less";
|
|||
|
||||
function Map(props) {
|
||||
const query = useGetUrlQuery();
|
||||
const { viewer, mapMethods, initMap, externalEntryPort } = useInitMap({
|
||||
const { viewer, mapMethods, initMap, externalEntryPort, closePopup } = useInitMap({
|
||||
request: {
|
||||
getCorpInfoListAll: props.getCorpInfoListAll,
|
||||
},
|
||||
|
|
@ -108,8 +108,8 @@ function Map(props) {
|
|||
}, []);
|
||||
|
||||
const providerValues = useMemo(
|
||||
() => ({ viewer, mapMethods, ...state, actions }),
|
||||
[viewer, mapMethods, state, actions],
|
||||
() => ({ viewer, mapMethods, closePopup, ...state, actions }),
|
||||
[viewer, mapMethods, closePopup, state, actions],
|
||||
);
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ export default function useInitMap(options) {
|
|||
mapMethods.current = mapMethodsValue;
|
||||
// 点位点击处理集合:替代原 PointClickEvent class 实例,负责弹窗和层级进入。
|
||||
const pointClickEvent = usePointClickEvent(viewer, mapMethodsValue);
|
||||
// Cesium 点击事件只在初始化时注册,必须始终使用首次创建的处理器,才能关闭其维护的 Popup 实例。
|
||||
const pointClickEventRef = useRef(pointClickEvent);
|
||||
|
||||
// 获取当前 Cesium 实例,减少内部方法对 ref 结构的重复感知。
|
||||
const getViewer = () => viewer.current;
|
||||
|
|
@ -56,10 +58,10 @@ export default function useInitMap(options) {
|
|||
screenSpaceEventHandler.setInputAction((movement) => {
|
||||
const pick = getViewer().scene.pick(movement.position);
|
||||
if (Cesium.defined(pick) && pick.id?.id) {
|
||||
pointClickEvent.pointClickEvent(pick.id);
|
||||
pointClickEventRef.current.pointClickEvent(pick.id);
|
||||
}
|
||||
else {
|
||||
pointClickEvent.closePopup();
|
||||
pointClickEventRef.current.closePopup();
|
||||
}
|
||||
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
||||
};
|
||||
|
|
@ -143,7 +145,7 @@ export default function useInitMap(options) {
|
|||
if (!id || !name || !hasValidPosition)
|
||||
return false;
|
||||
|
||||
pointClickEvent.pointClickEvent({
|
||||
pointClickEventRef.current.pointClickEvent({
|
||||
monitorItems: {
|
||||
data: {
|
||||
...data,
|
||||
|
|
@ -164,5 +166,6 @@ export default function useInitMap(options) {
|
|||
mapMethods,
|
||||
initMap,
|
||||
externalEntryPort,
|
||||
closePopup: () => pointClickEventRef.current.closePopup(),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue