From 616b9e2d1bee54d2a16d39ba54204c7e950603bb Mon Sep 17 00:00:00 2001 From: mahmoudadel54 Date: Thu, 27 Jun 2024 15:55:30 +0300 Subject: [PATCH] #10322: Fix scale selector to make it compatible with different projections Description: - fix issues of not consistent map print scales with the current map view --- web/client/components/print/MapPreview.jsx | 4 ++-- web/client/plugins/print/Projection.jsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/client/components/print/MapPreview.jsx b/web/client/components/print/MapPreview.jsx index b6aee50810..f6a0d1312d 100644 --- a/web/client/components/print/MapPreview.jsx +++ b/web/client/components/print/MapPreview.jsx @@ -11,7 +11,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import { Glyphicon } from 'react-bootstrap'; -import { getMapZoom, getResolutionMultiplier } from '../../utils/PrintUtils'; +import { getResolutionMultiplier } from '../../utils/PrintUtils'; import ScaleBox from '../mapcontrols/scale/ScaleBox'; import Button from '../misc/Button'; import isNil from 'lodash/isNil'; @@ -152,7 +152,7 @@ class MapPreview extends React.Component { interactive={false} onMapViewChanges={this.props.onMapViewChanges} zoomControl={false} - zoom={this.props.useFixedScales && this.props.scales ? getMapZoom(this.props.map.scaleZoom, this.props.scales) : this.props.map.zoom} + zoom={this.props.map.zoom} // zoom level for map preview [it is precalculated] center={this.props.map.center} id="print_preview" registerHooks={false} diff --git a/web/client/plugins/print/Projection.jsx b/web/client/plugins/print/Projection.jsx index 03370c90d2..6d687cd703 100644 --- a/web/client/plugins/print/Projection.jsx +++ b/web/client/plugins/print/Projection.jsx @@ -24,11 +24,11 @@ function mapTransformer(state, map) { return { ...map, scale: scales[map.zoom], - zoom: map.zoom >= 1 ? map.zoom - 1 : map.zoom, // for print map preview + zoom: map.zoom, projection: srs }; } - return {...map, scale: scales[map.zoom], zoom: map.zoom >= 1 ? map.zoom - 1 : map.zoom}; + return {...map, scale: scales[map.zoom], zoom: map.zoom}; } const validator = (allowPreview) => (state) => {