-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add AOI editing to map during project creation (#1135)
* feat (createNewProject): mapControlComponent - mapControlComponent including edit, undo added * feat AssetModules: icons added * feat (createNewProject): splitTasks - edit task on editBtn click * fix codeRefactor: consoles removed * fix mapControlComponent: undoIcon removed
- Loading branch information
Showing
10 changed files
with
108 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/frontend/src/components/createnewproject/MapControlComponent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React, { useState } from 'react'; | ||
import AssetModules from '../../shared/AssetModules'; | ||
import VectorLayer from 'ol/layer/Vector'; | ||
import CoreModules from '../../shared/CoreModules.js'; | ||
import { CreateProjectActions } from '../../store/slices/CreateProjectSlice'; | ||
|
||
const MapControlComponent = ({ map, hasEditUndo }) => { | ||
const dispatch = CoreModules.useAppDispatch(); | ||
const toggleSplittedGeojsonEdit = CoreModules.useAppSelector( | ||
(state) => state.createproject.toggleSplittedGeojsonEdit, | ||
); | ||
const btnList = [ | ||
{ | ||
id: 'Add', | ||
icon: <AssetModules.AddIcon style={{ fontSize: '20px' }} className="fmtm-text-[#666666]" />, | ||
}, | ||
{ | ||
id: 'Minus', | ||
icon: <AssetModules.RemoveIcon style={{ fontSize: '20px' }} className="fmtm-text-[#666666]" />, | ||
}, | ||
{ | ||
id: 'Edit', | ||
icon: ( | ||
<AssetModules.TimelineIcon | ||
style={{ fontSize: '20px' }} | ||
className={`${toggleSplittedGeojsonEdit ? 'fmtm-text-primaryRed' : 'fmtm-text-[#666666]'}`} | ||
/> | ||
), | ||
}, | ||
]; | ||
|
||
const handleOnClick = (btnId) => { | ||
if (btnId === 'Add') { | ||
const actualZoom = map.getView().getZoom(); | ||
map.getView().setZoom(actualZoom + 1); | ||
} else if (btnId === 'Minus') { | ||
const actualZoom = map.getView().getZoom(); | ||
map.getView().setZoom(actualZoom - 1); | ||
} else if (btnId === 'Edit') { | ||
dispatch(CreateProjectActions.SetToggleSplittedGeojsonEdit(!toggleSplittedGeojsonEdit)); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="fmtm-absolute fmtm-top-[20px] fmtm-left-3 fmtm-z-50 fmtm-bg-white fmtm-rounded-md fmtm-p-[2px] fmtm-shadow-xl fmtm-flex fmtm-flex-col fmtm-gap-[2px]"> | ||
{btnList.map((btn) => { | ||
return ( | ||
<div key={btn.id} title={btn.id}> | ||
{((btn.id !== 'Edit' && btn.id !== 'Undo') || (btn.id === 'Edit' && hasEditUndo)) && ( | ||
<div | ||
className={` fmtm-p-1 fmtm-rounded-md fmtm-duration-200 fmtm-cursor-pointer ${ | ||
toggleSplittedGeojsonEdit && btn.id === 'Edit' | ||
? 'fmtm-bg-red-50' | ||
: 'fmtm-bg-white hover:fmtm-bg-gray-100' | ||
}`} | ||
onClick={() => handleOnClick(btn.id)} | ||
> | ||
{btn.icon} | ||
</div> | ||
)} | ||
</div> | ||
); | ||
})} | ||
</div> | ||
); | ||
}; | ||
|
||
export default MapControlComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters