Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 侧边面板与底部面板展示冲突问题 #3

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { ImplementWidgetProps } from '@antv/li-sdk';
import { MapContainer } from '@antv/li-sdk';
import { useSize } from 'ahooks';
import classNames from 'classnames';
import React, { useEffect, useMemo, useState } from 'react';
import React, { useEffect, useMemo, useRef, useState } from 'react';
import FloatPanel from '../FloatPanel';
import type { Properties } from '../registerForm';
import { CLS_PREFIX } from './constant';
Expand All @@ -18,6 +19,9 @@ const AnalysisLayout: React.FC<AnalysisLayoutProps> = (props) => {

const styles = useStyle();

const bottomPanelContainerRef = useRef<HTMLDivElement>(null);
const size = useSize(bottomPanelContainerRef);

const [collapsed, setCollapsed] = useState(collapsedFloatPanel);
const mapContainerSlots = useMemo(() => ({ content: slotsElements.content, controls: slotsElements.controls }), [
slotsElements.content,
Expand All @@ -34,7 +38,10 @@ const AnalysisLayout: React.FC<AnalysisLayoutProps> = (props) => {

return (
<div className={classNames(styles.analysisLayout, CLS_PREFIX)}>
<div className={styles.layoutContainer}>
<div
className={styles.layoutContainer}
style={showBottomPanel && size?.height ? { height: `calc(100% - ${size.height}px)` } : {}}
>
<MapContainer
className={classNames(styles.mapContainer, `${CLS_PREFIX}__map-conatiner`, {
[styles.showFloatPanel]: showFloatPanel && !collapsed,
Expand All @@ -59,7 +66,7 @@ const AnalysisLayout: React.FC<AnalysisLayoutProps> = (props) => {
)}
</div>
{showBottomPanel && (
<div className={classNames(styles.bottomPanel, `${CLS_PREFIX}__bottom-panel`)}>
<div className={classNames(styles.bottomPanel, `${CLS_PREFIX}__bottom-panel`)} ref={bottomPanelContainerRef}>
{slotsElements.bottomPanel ? slotsElements.bottomPanel({}) : null}
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const useStyle = () => {
display: flex;
flex: auto;
width: 100%;
height: 100%;
`,

bottomPanel: css`
Expand Down
Loading