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 popup offscreen #1385

Merged
merged 3 commits into from
Mar 25, 2024
Merged
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
Expand Up @@ -50,6 +50,11 @@ const AsyncPopup = ({
element: popupRef.current,
positioning: 'center-center',
id: popupId,
autoPan: {
animation: {
duration: 250,
},
},
});
setOverlay(overlayInstance);
}, [map, popupRef]);
Expand Down Expand Up @@ -98,7 +103,7 @@ const AsyncPopup = ({
if (!overlay) return;

map.on(showOnHover, (evt) => {
map.updateSize();
// map.updateSize();
overlay.setPosition(undefined);
setPopupHTML('');
setProperties(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const TaskSectionPopup = ({ taskId, body, feature }: TaskSectionPopupPropType) =
<div
className={`fmtm-duration-1000 fmtm-z-[10002] fmtm-h-fit ${
taskModalStatus
? 'fmtm-bottom-0 fmtm-right-0 md:fmtm-top-[calc(40vh)] fmtm-w-[100vw] md:fmtm-w-[50vw] md:fmtm-max-w-[25rem]'
? 'fmtm-bottom-0 md:fmtm-top-[50%] md:-fmtm-translate-y-[35%] fmtm-right-0 fmtm-w-[100vw] md:fmtm-w-[50vw] md:fmtm-max-w-[25rem]'
: 'fmtm-top-[calc(100vh)] md:fmtm-top-[calc(40vh)] md:fmtm-left-[calc(100vw)] fmtm-w-[100vw]'
} fmtm-fixed
fmtm-rounded-t-3xl fmtm-border-opacity-50`}
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/src/views/ProjectDetailsV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ const Home = () => {
dispatch(CoreModules.TaskActions.SetSelectedTask(properties.uid));

dispatch(ProjectActions.ToggleTaskModalStatus(true));
if (windowSize.width < 768) {
if (windowSize.width < 768 && map.getView().getZoom() < 17) {
map.getView().fit(extent, {
padding: [10, 20, 300, 20],
});
} else {
} else if (windowSize.width > 768 && map.getView().getZoom() < 17) {
map.getView().fit(extent, {
padding: [20, 350, 50, 10],
});
Expand Down Expand Up @@ -388,7 +388,7 @@ const Home = () => {
zIndex={5}
/>
)}
<AsyncPopup map={map} popupUI={dataExtractDataPopup} primaryKey={'osm_id'} />
<AsyncPopup map={map} popupUI={dataExtractDataPopup} primaryKey={'osm_id'} showOnHover="singleclick" />
<div className="fmtm-top-28 fmtm-left-5">{window.DeviceMotionEvent}</div>
<div className="fmtm-absolute fmtm-bottom-36 sm:fmtm-bottom-5 fmtm-left-5 fmtm-z-50 fmtm-rounded-lg">
<Accordion
Expand Down
Loading