change toolbar behavior

This commit is contained in:
2025-10-21 11:26:23 +09:00
parent 81562e3692
commit c176d75b82
3 changed files with 13 additions and 10 deletions

View File

@ -9,7 +9,7 @@ import { AddFilled, RulerRegular, SelectObjectRegular, SelectObjectSkewEditRegul
const MapToolbar = ({
map_id
}: { map_id: string }) => {
const { currentTool, mode, map } = useMapStore().id[map_id]
const { currentTool, mode, map, selectionDragBox } = useMapStore().id[map_id]
const { selectedRegion, selectedDistrict, selectedYear } = useObjectsStore().id[map_id]
const { colorScheme } = useAppStore();
@ -32,7 +32,12 @@ const MapToolbar = ({
<Tooltip content={"Выделение"} relationship='label' hideDelay={0} showDelay={0} withArrow>
<Button icon={<SelectObjectRegular />} appearance={currentTool === 'Selection' ? 'primary' : 'transparent'} onClick={() => {
setCurrentTool(map_id, 'Selection')
if (currentTool === 'Selection') {
map?.removeInteraction(selectionDragBox)
setCurrentTool(map_id, null)
} else {
setCurrentTool(map_id, 'Selection')
}
}} />
</Tooltip>
@ -95,8 +100,6 @@ const MapToolbar = ({
}
}} />
</Tooltip>
</div>
<div style={{ display: 'flex', flexDirection: 'column', zIndex: 1, backdropFilter: 'blur(8px)', backgroundColor: colorScheme === 'light' ? '#FFFFFFAA' : '#000000AA', borderRadius: '4px' }}>

View File

@ -391,7 +391,7 @@ export const addInteractions = (
const measureModify = getMeasureModify(map_id)
if (currentTool !== 'Measure' && currentTool !== 'Mover' && currentTool !== 'Edit' && currentTool !== 'Selection') {
map?.getInteractions().clear()
//map?.getInteractions().clear()
setDraw(map_id, new Draw({
source: getDrawingLayerSource(map_id),
@ -432,7 +432,7 @@ export const addInteractions = (
}
if (currentTool == 'Measure') {
map?.getInteractions().clear()
//map?.getInteractions().clear()
const drawType = measureType;
const activeTip =
@ -478,7 +478,7 @@ export const addInteractions = (
const translate = getTranslate(map_id)
if (translate) {
map?.getInteractions().clear()
//map?.getInteractions().clear()
map?.addInteraction(translate)
}
}
@ -489,8 +489,8 @@ export const addInteractions = (
}
if (currentTool == 'Selection') {
console.log("Selection tool selected")
map?.getInteractions().clear()
console.log(map?.getInteractions().getArray())
//map?.getInteractions().clear()
const selectionDragBox = useMapStore.getState().id[map_id].selectionDragBox

View File

@ -165,7 +165,7 @@ const pages = [
component: <PrintReport />,
drawer: true,
dashboard: true,
enabled: true,
enabled: false,
},
{
label: "Тест БД",