diff --git a/client/src/components/map/MapPrint/MapPrint.tsx b/client/src/components/map/MapPrint/MapPrint.tsx index 7e10d74..74d41d2 100644 --- a/client/src/components/map/MapPrint/MapPrint.tsx +++ b/client/src/components/map/MapPrint/MapPrint.tsx @@ -4,11 +4,10 @@ import { clearPrintArea, PrintScale, setPreviousView, setPrintScale, setPrintSca import { PrintFormat, PrintOrientation, printResolutions, setPrintOrientation, setPrintResolution, usePrintStore } from '../../../store/print' import { printDimensions, scaleOptions } from '../../../constants/map' import { useObjectsStore } from '../../../store/objects' -// import { getPointResolution } from 'ol/proj' import jsPDF from 'jspdf' import { getCenter } from 'ol/extent' import ScaleLine from 'ol/control/ScaleLine' -import { Button, Checkbox, Dialog, DialogActions, DialogBody, DialogContent, DialogSurface, DialogTitle, Dropdown, Field, Option, Radio, RadioGroup, Text } from '@fluentui/react-components' +import { Button, Checkbox, Dialog, DialogActions, DialogBody, DialogContent, DialogSurface, DialogTitle, Dropdown, Field, Option, Radio, RadioGroup } from '@fluentui/react-components' import { Dismiss24Regular } from '@fluentui/react-icons' const MapPrint = ({ @@ -46,16 +45,6 @@ const MapPrint = ({ const scaleFactor = width / originalSize[0] const newResolution = originalResolution / scaleFactor - // console.log(`New resolution: ${newResolution}`) - - // const center = map.getView().getCenter() - // let scaleResolution = 1 - // if (center) { - // scaleResolution = Number(printScale) / getPointResolution(map.getView().getProjection(), Number(resolution) / 25.4, center) - // // console.log(`Scaled resolution: ${scaleResolution}`) - // } - - console.log(width, height) // Set new high-resolution rendering map.setSize([width, height]) map.getView().setResolution(newResolution) @@ -120,7 +109,6 @@ const MapPrint = ({ const [opened, setOpened] = useState(false) - useEffect(() => { if (printArea && opened) { // backup view before entering print mode @@ -160,7 +148,7 @@ const MapPrint = ({ }, [opened]) return ( - + setPrintResolution(Number(data.optionValue))} @@ -242,112 +229,6 @@ const MapPrint = ({ ) - - // return ( - //
- //
- //
- // - // Предпросмотр области печати - // - - //
- //
- //
- - //
- // Область печати можно передвигать. - - // - - //
- // - // setPrintOrientation(data.value as PrintOrientation)}> - // - // - // - // - - // - // setPrintResolution(Number(data.optionValue))} - // > - // {printResolutions.map((res) => ( - // - // ))} - // - // - - - // - // setPrintScale(id, data.optionValue as PrintScale)} - // > - // {scaleOptions.map((opt) => ( - // - // ))} - // - // - - // setPrintScaleLine(id, event.currentTarget.checked)} - // /> - //
- - //
- // - //
- //
- //
- //
- // ) } export default MapPrint \ No newline at end of file diff --git a/client/src/components/map/MapToolbar/MapToolbar.tsx b/client/src/components/map/MapToolbar/MapToolbar.tsx index 40b7343..9d220d4 100644 --- a/client/src/components/map/MapToolbar/MapToolbar.tsx +++ b/client/src/components/map/MapToolbar/MapToolbar.tsx @@ -1,63 +1,101 @@ -import { IconArrowBackUp, IconArrowsMove, IconCircle, IconExclamationCircle, IconLine, IconPoint, IconPolygon, IconRuler, IconTransformPoint } from '@tabler/icons-react' +import { IconArrowBackUp, IconArrowsMove, IconCircle, IconExclamationCircle, IconLine, IconPoint, IconPolygon, IconTransformPoint } from '@tabler/icons-react' import { getDraw, setCurrentTool, useMapStore } from '../../../store/map'; import { saveFeatures } from '../mapUtils'; import { Button, Tooltip } from '@fluentui/react-components'; import { useAppStore } from '../../../store/app'; +import { useObjectsStore } from '../../../store/objects'; +import { AddFilled, RulerRegular, SubtractFilled } from '@fluentui/react-icons'; const MapToolbar = ({ map_id }: { map_id: string }) => { - const { currentTool } = useMapStore().id[map_id] + const { currentTool, mode, map } = useMapStore().id[map_id] + const { selectedRegion, selectedDistrict, selectedYear } = useObjectsStore().id[map_id] const { colorScheme } = useAppStore(); return ( -
+
-
+ +
+ +
+
-