Skip to content

Commit

Permalink
geosolutions-it#10322: Fix scale selector to make it compatible with …
Browse files Browse the repository at this point in the history
…different projections

Description:
- fix issues of not consistent map print scales with the current map view
  • Loading branch information
mahmoudadel54 committed Jun 27, 2024
1 parent 138ae35 commit 616b9e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions web/client/components/print/MapPreview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions web/client/plugins/print/Projection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 616b9e2

Please sign in to comment.